Jump to content

Pal script


airfm

Recommended Posts

I need a script that will start a programme at a certain time and run its until over (ie start at 2200 and run for 60-70 mins and then return to playlist / auto dj) and can two run together ie 2200 and then 2300 Many thanks Brendan KISS FM DANCE:doh:
Link to comment
Share on other sites

  • 3 weeks later...

I got this from the SpacialAudio Help forums. I had to do some tweaking to get it to work right with my set up. If you don't know much about PAL don't expect to just paste it in and have it work right. You do need to change some parts of it to make it work.

It is a pretty neat script though.

 

http://spacialaudio.com/knowledge/attachment.php?attId=62

 

}

 

 

 

 

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

 

// 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 I'm making a point.

 

CatA := 'World';

CatB := 'Country';

CatC := 'Electronic';

CatD := 'Christian';

 

F := false;

 

// Event One

// Is it 8am, monday, tuesday, wednesday thursday or friday?

if (now >= T['07:58:00']) and (now

((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

// Is it 11am monday, wedneday or thursday?

if (now >= T['10:58:00']) and (now

((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

((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

((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

(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

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...