LoopSongs.PAL

//Loop Queue Script
//As a track plays, adds the track back to the bottom of the queue

var Song : TSongInfo;
var Q    : TDataSet;
PAL.Loop := True;
PAL.WaitForPlayCount(1);
PAL.LockExecution;
Q := Query('SELECT filename FROM historylist ORDER BY date_played DESC',[],True);
if not Q.IsEmpty then
Queue.AddFile(Q['filename'],ipBottom);
Q.Free;
PAL.UnlockExecution;