We are in the process of migrating the Spacial Wiki content to our new Help Center at spacial.com.
Please visit the Help Center for latest Tips and Tricks, Documentation and Troubleshooting.
spacial.com/help-center

How to play Top10 requests at a certain time?

From SpacialAudio

Jump to: navigation, search

PAL script to play top10 requests at a specified time

PAL.Loop := True;
PAL.WaitForTime(T['08:00:00']); {Wait for 8am}
{==================================================}
var D : TDataSet;
var C : Integer;
D := Query('SELECT songlist.*, count(*) as cnt '+
              'FROM songlist,requestlist '+
              'WHERE songlist.ID = requestlist.songID '+
              '      AND requestlist.code < 700 '+
              'GROUP BY songlist.ID '+
              'ORDER BY cnt DESC LIMIT 10',[],True);
{Add requests to Queue.
We add to the top of the Queue, effectively reversing the
order of the requests - playing #10 first and #1 last}
C := 0;
D.First;
while not D.EOF do
begin
C := C + 1;
WriteLn('#'+IntToStr(C)+'. '+D['artist']+' - '+D['title']);
Queue.AddFile(D['filename'],ipTop);
D.Next;
end;
              
{==================================================}
PAL.WaitForTime(T['23:59:59']); {Wait for next day}
Personal tools