Note that this Wiki is a work in progress, items may not be updated or may disappear entirely as the pages are updated.

CBS NEWS PAL

From SpacialAudio

Jump to: navigation, search

Link To Other PAL Articles

Table of Contents   Quick Start Guide   PAL Scripting 101   Objects   Script Examples    Music1 24 Hour PAL Script    Music 1 Hourly PAL   CBS News Scripts    Write some useful scripts


   Feed #7 at 11


Each News feed is avaialble at different intervals. 
1 : CBS Radio Network Newscast
04/03/2009 01:59:00 AM - Hourly-02
Conclusion: Every hour top of the hour.

2 : CBS Radio Network Newscast 
04/03/2009 02:30:00 AM - Update-02
Conclusion: Every hour bottom of the hour.

3 : 60 Minutes - Full Broadcast In Audio
Sun, 29 Mar 2009 18:00:00 -0400
Sun, 22 Mar 2009 20:00:00 -0400
Sun, 15 Mar 2009 19:00:00 -0400 
Sun, 08 Mar 2009 18:00:00 -0400
Sun, 01 Mar 2009 19:00:00 -0500
Sun, 22 Feb 2009 19:00:00 -0500
Sun, 15 Feb 2009 19:00:00 -0500
Sun, 08 Feb 2009 20:00:00 -0500
Conclusion: Every Sunday (18:00:00 -0400) to (20:00:00 -0400)

4 : Tech Report
Thu, 02 Apr 2009 01:00:00 -0400
Wed, 01 Apr 2009 12:00:00 -0400
Wed, 01 Apr 2009 08:00:00 -0400
Tue, 31 Mar 2009 02:00:00 -0400
Wed, 18 Mar 2009 12:00:00 -0400
Fri, 06 Mar 2009 19:00:00 -0500
Mon, 02 Mar 2009 21:00:00 -0500
Fri, 27 Feb 2009 05:00:00 -0500
Wed, 18 Feb 2009 13:00:00 -0500
Thu, 12 Feb 2009 15:00:00 -0500
Sat, 31 Jan 2009 16:00:00 -0500
Conclusion: Random times.

5 : CBS News Weekend Roundup 
Fri, 27 Mar 2009 17:00:00 -0400
Fri, 13 Mar 2009 16:00:00 -0400
Fri, 06 Mar 2009 18:00:00 -0500
Fri, 20 Feb 2009 16:00:00 -0500
Fri, 06 Feb 2009 16:00:00 -0500
Fri, 30 Jan 2009 16:00:00 -0500
Conclusion: Every Friday (16:00:00 -0500) to (18:00:00 - 0500)

6 : CBS News Entertainment Report 
Thu, 02 Apr 2009 19:00:00 -0400
Tue, 31 Mar 2009 19:00:00 -0400
Sun, 29 Mar 2009 18:00:00 -0400
Thu, 26 Mar 2009 23:00:00 -0400
Tue, 24 Mar 2009 18:00:00 -0400
Mon, 23 Mar 2009 19:00:00 -0400
Conclusion: Random times.


7 : World News Roundup
Thu, 02 Apr 2009 08:00:00 -0400
Wed, 01 Apr 2009 08:00:00 -0400
Tue, 31 Mar 2009 08:00:00 -0400
Mon, 30 Mar 2009 08:00:00 -0400
Fri, 27 Mar 2009 08:00:00 -0400
Conclusion: Monday - Friday 08:00:00 -0400
----
'''CBS NEWS ON THE HOUR'''
3-minute newscast on the last stories that hour. :00 to :05 Sunday through Saturday/24 hours. 

'''UPDATES'''
One minute single subject broadcast at :31 Sunday through Saturday/24 hours.

'''ENTERTAINMENT REPORT'''
A daily Entertainment features, on entertainment news. One report a day. Monday through Friday AM Entertainment Report at 4:35am. 60 seconds in length. 

'''60 MINUTES ON THE RADIO'''
Simulcast of TV’s most watched news magazine program.  Available at 11:30pm every Sunday.

'''WEEKEND ROUNDUP'''
In-depth weekly program featuring reports and discussions with reporters and
newsmakers of the week. Fridays at 4:10pm. 48 minutes in length. 



   TOP

CBS News #7, Play at 11am

The pal scripts for the CBS news feed can be modified to play the news at the time you want. Here are a few examples.


This is one of the scripts, Feed #7. This one has been tested. It will Play at 11am and has been tested and amended by



{## This version will clear the queue and play the feed at a specific time 11:00AM in this case ##}
{==========[ Configuration options ]==========}
const secret_token = 'SVCXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const workdir = 'f:\CBSFeeds\';
const feedID = '7';
{=============================================}

function RndStr:String; forward;

var url       : string;
var infoFile  : string;
var stateFile : string;
var mediaFile : string;
var stateCRC  : string = '';
var newCRC    : string = '';
var feedInfo  : TStringList;

var LoopA : Boolean = true;
var LoopB : Boolean = true;


{## Initialization ##}
CreateDir(workdir);


{## Phase1: Check if new feed is available ##}
//Get CRC/Date of last downloaded file
stateFile := workdir+feedID+'_'+secret_token+'.crc';
infoFile  := workdir+feedID+'_'+secret_token+'.info';

if FileExists(stateFile) then
begin
  stateCRC := LoadStringFromFile(stateFile);
  WriteLn('OldCRC: '+stateCRC);
end;

//Download new instruction file
//url := 'http://localhost/streamads_api/feed.txt?feedID=' + feedID + '&=' + secret_token;
url := 'http://feed.spacialnet.com/feeds/pal.instruction.php?feedID=' + feedID + '&token=' + secret_token;
WebToFile(infoFile, url);

//Wait 5 seconds for file to download
PAL.WaitForTime('+00:00:05');

{## Phase2: Download feed ##}
while LoopA and FileExists(infoFile) do
begin
  feedInfo := TStringList.Create;
  feedInfo.LoadFromFile(infoFile);
  DeleteFile(infoFile);

  WriteLn('Status:'+feedInfo.Values['status']);
  newCRC := feedInfo.Values['date_updated'];
  WriteLn('New CRC: '+newCRC);
  while (newCRC<>'') and (newCRC<>stateCRC) do
  begin
    stateCRC := newCRC;

    url := feedInfo.Values['download'];
    mediaFile := feedInfo.Values['filename'];
    WriteLn('File:'+mediaFile);

    mediaFile := workdir + RndStr + '_' + ExtractFileName(mediaFile);
    WebToFile(mediaFile, url);

    //Wait for file to download
    PAL.WaitForTime('+00:00:05');
    while FileExists(mediaFile) and LoopB do
    begin
      //Store current State CRC
      SaveStringToFile(stateFile, stateCRC);

      {## Phase3: Schedule for playback ##}
      //Waiting for 11:00 AM however you can change this to 
      //your choice or change it to XX:00:00 to play at the top of the hour

  PAL.WaitForTime(T['11:00:00']);
  Queue.Clear;
  Queue.AddFile(mediaFile, ipTop);
  ExecSQL('UPDATE songlist SET songtype=:songtype, album=:album WHERE filename = :filename', ['N','CBS-FEED-'+feedID,mediaFile]);
  CAT['Play once and erase'].AddFile(mediaFile, ipTop);
  ActivePlayer.FadeToNext;



      //Exit loop
      LoopB := false;
    end;
  end;

  //Exit loop
  LoopA := false;
  feedInfo.Free;
end;


      //Wait 30min before we start checking again
      WriteLn('Waiting to start new polling cycle');
      PAL.WaitForTime('+00:30:00');
{## Phase4: Rinse and Repeat ##}
PAL.Loop := true;
PAL.WaitForTime('+00:05:00');

function RndStr:String;
var Hour, Min, Sec, MSec: Integer;
begin
  DecodeTime(Now, Hour, Min, Sec, MSec);
  Result := IntToStr(Hour)+IntToStr(Min)+IntToStr(Sec);
end;