WriteLn('New song started');
WriteLn('Waiting 5 Seconds before checking if it is a Request');
// Wait a few seconds just in case this song is a Jingle. If it is, and it is under 10 seconds the script will still get the correct info for the song after.
PAL.WaitForTime(T['+00:00:05']); //Wait 5 secs
PAL.LockExecution;
// Instantiate a Song Info object
var Song : TSongInfo;
Song := TSongInfo.Create;
WriteLn('Checking if song has been Requested......');
if ((ActivePlayer.GetSongInfo['requestID']) = 0) then WriteLn('Song is not a Request');
// Check if current song has a request ID
if ((ActivePlayer.GetSongInfo['requestID']) > 0) then
Begin
WriteLn('Song is a Request');
var reqInfo : TDataSet = Query('SELECT name, msg FROM requestlist WHERE id = ' + ActivePlayer.GetSongInfo['requestID'], [], true);
var Requested_by : String = reqInfo['name'];
var Dedication_Message : String = reqInfo['msg'];
reqInfo.Free;
If (Requested_by = '') then Requested_by := 'Anonymous';
If (Dedication_Message = '') then Dedication_Message := 'Nothing...';
If ((Requested_by = 'Anonymous') and (Dedication_Message = 'Nothing...')) then
Begin
WriteLn('Song is a Request without Dedication');
WriteLn(Requested_by); // This should aways echo Anonymous
WriteLn(Dedication_Message); // This should aways echo Nothing...
Song['artist'] := ActivePlayer.GetSongInfo['artist'] + ' - ' + ActivePlayer.GetSongInfo['title'];
Song['title'] := '~Requested~';
Encoders.SongChange(Song);
End
else
Begin
WriteLn('Song is a Request with a Dedication');
WriteLn(Requested_by);
WriteLn(Dedication_Message);
Song['artist'] := ActivePlayer.GetSongInfo['artist'] + ' - ' + ActivePlayer.GetSongInfo['title'];
Song['title'] := '~Requested by ' + Requested_by + ' : Who had this to say:- ' + Dedication_Message + '~';
Encoders.SongChange(Song);
End;
End;
PAL.UnlockExecution;
WriteLn('Done....');
// Release data structures
Song.Free;
WriteLn('Waiting for next song to start');
PAL.WaitForPlayCount(1); {Wait for 1 songs to play}
ако някои го подкара моля кажете как става



