dit is een PAL script dat zorgt als jij met samPHPweb een plaat aanvraagt dat die eerst een jingle speelt en dan het plaatje

Code: Selecteer alles
{ PAL script to manually handle requests to play within a
category based rotation logic system }
PAL.Loop := True;
{-->Insert first songs into queue}
CAT['Jingles (All)'].QueueBottom(smLemmingLogic,NoRules);
CAT['Power hit'].QueueBottom(smWeighted,EnforceRules);
CAT['Heavy Rotation'].QueueBottom(smWeighted,EnforceRules);
CAT['Jingles (All)'].QueueBottom(smLemmingLogic,NoRules);
{-->Insert next request + Jingle if request was found}
var AQuery : TDataSet;
var Song : TSongInfo;
AQuery := Query('SELECT songlist.*, requestlist.ID as requestID '
+' FROM songlist,requestlist '
+' WHERE (requestlist.ETA<:now) AND (requestlist.status=''new'') AND (songlist.ID=requestlist.songID) '
+ 'ORDER BY requestlist.ETA ASC '
+' LIMIT 1 ',[Now],True);
if not(AQuery.BOF and AQuery.EOF) then
begin
{A cool idea would be to insert a jingle here
that says "The next song is by request" or something simular}
{For example: Queue.AddFile('c:\.mp3',ipBottom);}
Queue.AddFile('c:\request.wav',ipBottom);}
{Copy the needed information from the dataset}
Song := TSongInfo.Create();
Song['ID'] := AQuery['ID'];
Song['filename'] := AQuery['filename'];
Song['artist'] := AQuery['artist'];
Song['title'] := AQuery['title'];
Song['duration'] := AQuery['duration'];
Song['requestID'] := AQuery['requestID'];
{Add request to queue}
Queue.Add(Song,ipBottom);
WriteLn('Request handled: '+Song['artist']+' - '+Song['title']);
{Change status of request}
ExecSQL('UPDATE requestlist SET status=:status WHERE (songID = :songID) AND ((status=''new'') OR (status=''pending'')) ',['pending',song['ID']]);
{Insert Jingle after request}
CAT['Jingles (All)'].QueueBottom(smLRP,NoRules);
end
else
WriteLn('No request found');
{-->Insert final category}
CAT['Rare rotation'].QueueBottom(smWeighted,EnforceRules);
{Wait for songs in queue to play}
while (Queue.Count > 0) do
PAL.WaitForPlayCount(1);