DailyShows.PAL

This plays a series of shows at specific times for a specific duration then switches back to the main Clockwheel or whatever you are using to fill the queue otherwise.

As you will see from the configurations section. It’s quite complex and not for the faint-hearted. Take your time to go through it, and you will see that all of the sections repeat section, just at different times.

Enjoy.

The zip file can be found here:

{ Comments:
   This script is a rejigged version of the "multiple shows on multiple days'
   script put on the Knowledge Base by
   Steve Kunitzer many years ago.
   http://www.festerhead.com
   I've taken out a lot of the text specific to Steve's location and
   made it a bit more generic. Also added lots of comments trying to explain
   what things do.
   
   The fundamental concept of this script is as follows;
   Your normal Category Rotation operates. You might be using weighted or
   category rotation, and configured in the Config section as normal.
   This script when running, will at specific times clear the queue, and load
   in either an hours worth of material from selected categories, and in one
   case, it loads in half an hours worth. Actually slightly less. 56 minutes and
   28 minutes. This allows for some variation, as well as adding your own
   promos and station IDs which I haven't included in this script, but is
   easy enough to do. See the ChickenMan.pal script for an example.
   
   I've changed all the Category calls to variables so you can easily change
   what is played in the various slots. I will eventually put promos and IDs
   in this script too I guess.
   
   The script relies on there being an extra table in the SAMDB.
   Extract from Steve's script.
   I added a table to the SAMDB called showstatus and then added two fields.
   The first one is event varchar(255) and
   the second one is ID char(1). I added the number 1 into this field.
   
   Because I'm causing ChickenMan.pal to use this same table, thus avoiding
   having the DB cluttered with little tables, I've also added a field called
   ChickenID, (multipleinit(9))
   I guess they could be char too, but their contents are numeric, and change,
   where as the ID used for this script - does not change.
   If you plan on using other scripts likethis one, keep this in mind.
   ie:
   Table: showstatus  Fields:
                      event (varchar 255)
                      ID    (char 1)
                      
   If using ChickenMan add   
		     chickenID (mediumint 9)
                      
                      
   You can then also add other fields to the table as you need them. KISS.
   
   This script plays the following program at these times, for that duration, while Clock-wheel or other scripts fill in the rest.

    1.   8am, monday, tuesday, wednesday thursday or friday   World Music     1h
    2.   11am monday, wedneday or thursday                    Electronic      1h
    3.   12 noon, monday, wednesday, thursday or friday       World Music   0.5h
    4.   4pm, on Monday or Wednseday                          Country Music   1h
    5.   8pm, Monday, Tuesday or Wednesday                    Christian Music 1h
    
  To Create New Events, simply recreate the code between the comments
  // Event x
  ....
  // End of Event x
  


  Remembering to add any (var Catx : string, and Catx := 'string'; 's that you
  need.

Caveat Utilitor... 
}




PAL.Loop := True;
var D: Integer;                  // return from SQL calls
var F : Boolean;                 // switch to controll additional activities in events.
var E : DateTime = Queue.ETA;    // Return the length of the queues

WriteLn(E);
// Create as many of these as you have categories you are going to use.
var CatA : string;
var CatB : string;
var CatC : string;
var CatD : string;

// I know it could be simplified, but ......

CatA := 'World';
CatB := 'Country';
CatC := 'Electronic';
CatD := 'Classical';

F := false;

// Event One
// Is it 8am, monday, tuesday, wednesday thursday or friday?
if (now >= T['07:58:00']) and (now <= T['07:59:00']) and
((DayOfWeek(Now) = Monday) or 
(DayOfWeek(Now) = Tuesday) or 
(DayOfWeek(Now) = Wednesday) or 
(DayOfWeek(Now) = Thursday) or 
(DayOfWeek(Now) = Friday)) then
         begin
            Queue.Clear;
               repeat
                  cat[CatA].QueueTop(smLemmingLogic,EnforceRules);
               until (Queue.Duration >= 3360000);
               // 56 minutes  of world music
            F := true;
         end;         
   if (F) then                        // If F is true. set in queue load above.
      begin
         WriteLn('Wait for 1 track');
         PAL.WaitForPlayCount(1);
         // wait for one track to play
      end;
   if (F) then
      begin
         D:=ExecSQL('UPDATE showstatus SET event = "World Music Hour" WHERE ID = 1',[]);
         WriteLn('World Music Hour');   // this displays in the pal window.
      end;
   if (F) then
      begin
         E := Queue.ETA;
         WriteLn('Time to wait');
         WriteLn(E);
         PAL.WaitForTime(E);
         // ok, hang about for the length of the queue.
      end;
   if (F) then
      begin
         D:=ExecSQL('UPDATE showstatus SET event = "The Quantum Daily Mix" WHERE ID = 1',[]);
         WriteLn('Quantum Daily Mix');
         F := false;
         // It's now after 9am, so back to the normal daily Mix.
         // This is every day except Sat, and Sun
      end;
// End of Event One

// Event Two. F now False again. In the 'showstatus' field in the db.
// Is it 11am monday, wedneday or thursday?
if (now >= T['10:58:00']) and (now <= T['10:59:00']) and
((DayOfWeek(Now) = Monday) or 
(DayOfWeek(Now) = Wednesday) or 
(DayOfWeek(Now) = Thursday)) then
         begin
            Queue.Clear;
               repeat
                  cat[CatC].QueueTop(smLemmingLogic,EnforceRules);
               until (Queue.Duration >= 3360000);
               // Stuff 56 minutes worth of Electronica into the queue.
            F := true;
         end;         
   if (F) then
      begin
         WriteLn('Wait for 1 track');
         PAL.WaitForPlayCount(1);
         // wait to play one track
      end;
   if (F) then
      begin
         WriteLn('Updating the show');
         D:=ExecSQL('UPDATE showstatus SET event = "Electronic Madness" WHERE ID = 1',[]);
      end;
   if (F) then
      begin
         E := Queue.ETA;
         WriteLn('Time to wait');
         WriteLn(E);
         PAL.WaitForTime(E);
      end;
   if (F) then
      begin
         D:=ExecSQL('UPDATE showstatus SET event = "The Quantum Daily Mix" WHERE ID = 1',[]);
         WriteLn('Quantum Daily Mix');
         F := false;
         // The hour of Electronic is over, back to the daily mix.
         // Remember, this is Mon, Wed and Thu only.
      end;
      
      
// Event Three
// Is it 12 Midday, Monday, Wednesday, Thursday or Friday?
if (now >= T['11:58:00']) and (now <= T['11:59:00']) and
((DayOfWeek(Now) = Monday) or
(DayOfWeek(Now) = Wednesday) or
(DayOfWeek(Now) = Thursday) or
(DayOfWeek(Now) = Friday)) then
   begin
      Queue.Clear;
      Queue.AddFile('E:\StationMusic\WaveTest.mp3',ipBottom);
      // Get the listeners attention. This is a klaxon...
   repeat
      cat[CatA].QueueBottom(smRandom,EnforceRules);
      cat[CatA].QueueBottom(smRandom,EnforceRules);
      cat[CatA].QueueBottom(smLRP,EnforceRules);
      cat[CatA].QueueBottom(smLRP,EnforceRules);
   until (Queue.Duration >= 1680000);
       // Load 28 minutes of music ( about half an hour !!! )
      Queue.AddFile('E:\StationMusic\WaveTest.mp3',ipBottom);
      // Get the listeners attention. This is a klaxon... 5 seconds
      F := true;
   end;
if (F) then
   begin
      WriteLn('Waiting for one song to play...');
      PAL.WaitForPlayCount(1);
      // play one track then continue
   end;
if (F) then
   begin
      D:=ExecSQL('UPDATE showstatus SET event = "The Weekly Edge Sampler" WHERE ID = 1',[]);
      WriteLn('The Weekly Edge Sampler');
   end;
if (F) then
   begin
      WriteLn('Wait for 10 Minutes');      
      PAL.WaitForTime(T['+00:10:00']);
   end;
if (F) then
   begin
      Queue.AddFile('E:\StationMusic\WaveTest.mp3',ipTop);
      // Blow them away with the dive dive dive klaxton...
   end;
if (F) then
   begin
      E := Queue.ETA;
      WriteLn('Time to wait');
      WriteLn(E);
      PAL.WaitForTime(E);
      // Wait for the que to end.
   end;
if (F) then
   begin
      D:=ExecSQL('UPDATE showstatus SET event = "The Quantum Daily Mix" WHERE ID = 1',[]);
      WriteLn('Quantum Daily Mix');
      F := false;
      // ok, back to the normal scheduling.
   end;
   
// Event Four.
// Is it 4pm, on Monday or Wednseday?
if (now >= T['15:58:00']) and (now <= T['15:59:00']) and
((DayOfWeek(Now) = Monday) or 
(DayOfWeek(Now) = Wednesday)) then
         begin
            Queue.Clear;
               repeat
               // Load an hour of Country
                  cat[CatB].QueueTop(smLemmingLogic,EnforceRules);
               until (Queue.Duration >= 3360000);
            F := true;
         end;         
   if (F) then
      begin
         WriteLn('Wait for 1 track');
         PAL.WaitForPlayCount(1);
      end;
   if (F) then
      begin
         WriteLn('Updating the show');
         D:=ExecSQL('UPDATE showstatus SET event = "The Best of Country" WHERE ID = 1',[]);
      end;
   if (F) then
      begin
         E := Queue.ETA;
         WriteLn('Time to wait');
         WriteLn(E);
         PAL.WaitForTime(E);
         // Play the queue
      end;
   if (F) then
      begin
         D:=ExecSQL('UPDATE showstatus SET event = "The Quantum Daily Mix" WHERE ID = 1',[]);
         WriteLn('Quantum Daily Mix');
         F := false;
         // ok, back to the normal scheduling
      end;
      
// Event Five.
// Is it 8pm, Monday, Tuesday or Wednesday?
if (now >= T['19:58:00']) and (now <= T['19:59:00']) and ((DayOfWeek(Now) = Monday) or 
(DayOfWeek(Now) = Tuesday) or 
(DayOfWeek(Now) = Wednesday)) then
         begin
            Queue.Clear;
               repeat
               // Load an hour of Christian music
                  cat[CatD].QueueTop(smLemmingLogic,EnforceRules);
               until (Queue.Duration >= 3360000);
             F := true;
         end;         
   if (F) then
      begin
         WriteLn('Wait for 1 track');
         PAL.WaitForPlayCount(1);
      end;
   if (F) then
      begin

         D:=ExecSQL('UPDATE showstatus SET event = "The Sabbath Hour" WHERE ID = 1',[]);
         WriteLn('The Sabbath Hour');
      end;
   if (F) then
      begin
         E := Queue.ETA;
         WriteLn('Time to wait');
         WriteLn(E);
         PAL.WaitForTime(E);
      end;
   if (F) then
      begin
         D:=ExecSQL('UPDATE showstatus SET event = "The Quantum Daily Mix" WHERE ID = 1',[]);
         WriteLn('Quantum Daily Mix');
         F := false;
      end;
// end of event
// Event Six.
// Is it 7am, on Sunday?
if (now >= T['07:58:00']) and (now <= T['07:59:00']) and
((DayOfWeek(Now) = Sunday)) then
         begin
            Queue.Clear;
               repeat
               // Load an hour of Christian
                  cat[CatD].QueueTop(smLemmingLogic,EnforceRules);
               until (Queue.Duration >= 3360000);
            F := true;
         end;
   if (F) then
      begin
         WriteLn('Wait for 1 track');
         PAL.WaitForPlayCount(1);
      end;
   if (F) then
      begin
         WriteLn('Updating the show');
         D:=ExecSQL('UPDATE showstatus SET event = "The Mission Station Hour" WHERE ID = 1',[]);
      end;
   if (F) then
      begin
         E := Queue.ETA;
         WriteLn('Time to wait');
         WriteLn(E);
         PAL.WaitForTime(E);
         // Play the queue
      end;
   if (F) then
      begin
         D:=ExecSQL('UPDATE showstatus SET event = "The Quantum Daily Mix" WHERE ID = 1',[]);
         WriteLn('Quantum Daily Mix');
         F := false;
         // ok, back to the normal scheduling
      end;