Jump to content

Request List to Queue


Recommended Posts

Hi :) well here I have here my "Little Program" its just a Copy/Paste of ideas, this simple program do this:

 

1 - Load the variables of course.

2 - Save the actual Queue.

3 - Clear, and load the numbers of request songs you select.

4 - Save it in a playlist, in the location you want.

5 - Reload the queue (Like if nothing happen).

6 - Clear the Request song list, of course this is optional.

 

This program I make because, my radio open the "Request time" of one category at certain time for example "Electronic"... then i close it, save the votation in a playlist, clear the request, and open a new "Request time" with another category for example "Jazz", finally I get all the playlists of all the "Request times" of the day, and we have the "Top's Nights" where I load all the diferents result of votation of the day.

You can do this no only with day, you can do it with, weeks, month, where ever.

Of course im sure you can improve it (I only know a little bit about PAL), but work well.

 

{================================================= =}

var D : TDataSet;
var C : Integer;
D := Query('SELECT songlist.*, count(*) as cnt '+
'FROM songlist,requestlist '+
'WHERE songlist.ID = requestlist.songID '+
' AND requestlist.code 'GROUP BY songlist.ID '+
'ORDER BY cnt DESC LIMIT 10',[],True); {Change the "10" with any number you want}

PAL.WaitForPlayCount(1); {Wait 1 Song its a little security}

PAL.LockExecution; {Go! Go! Go!}
Queue.SaveAsM3U('c:\Playlist.m3u'); {Export the actual playlist}
Queue.Clear;

{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'],ipBottom);
D.Next;
end;

Queue.SaveAsM3U('c:\Requests.m3u'); {Export the request loaded}
Queue.Clear;
Queue.AddList('c:\Playlist.m3u', ipTop); {Reload the Playlist}
PAL.UnlockExecution;

ExecSQL('DELETE FROM requestlist',[]); {Clear the Request List}

{================================================= =}

 

Note: The wait Count, its because in that way you are sure, you have 1 song playing (that give you 3 minutes aprox) and 1 song or more at queue.

 

Sorry about my english, and of course enjoy :)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...