Skip to Content
It is currently January 20th, 2020, 4:59 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: July 24th, 2014, 5:09 pm 
Offline
New User
New User

Joined: September 13th, 2009, 9:18 pm
Posts: 14
Location: Round Rock, Texas
I have this pal script running on my station and it works just fine to insert the top 10 songs.
However, I'd like to insert a small .mp3 between each song that says "#9" "#8" etc.
Can someone suggest where / how I might be able to do this?
Code:
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}

_________________
[url]http://www.RoundRockRadio.com
[/url]


Top
 Profile  
Reply with quote  
PostPosted: July 24th, 2014, 7:28 pm 
Offline
Experienced User
Experienced User

Joined: March 26th, 2014, 7:47 pm
Posts: 291
Location: New Jersey
Create files named 1, 2, 3, 4 etc etc 10 and place them in a folder called Top10 in the root of the C Drive (or change the script to point their your desired location)

Pretty easy addition to give it the functionality you are asking for

Code:
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);
Queue.AddFile('C:\Top10\'+IntToStr(C)+'.mp3',ipTop);
D.Next;
end;
             
{==================================================}
PAL.WaitForTime(T['23:59:59']); {Wait for next day}

_________________
[INSERT]Signature Here[/INSERT]


Top
 Profile  
Reply with quote  
PostPosted: July 25th, 2014, 10:26 am 
Offline
New User
New User

Joined: September 13th, 2009, 9:18 pm
Posts: 14
Location: Round Rock, Texas
That worked great, Thanks man.
The problem now is that the script takes so long to run and load the songs into the queue, about 75 seconds, that sometimes it will load something that it shouldn't and cause the countdown to be out of order. There is one song loaded into the queue when this PAL begins running. I'd like to make sure that song plays so the countdown songs would need to load under that one song already in the queue but I can't figure out how to do this. Anyone have an idea or tips on how to do this?

_________________
[url]http://www.RoundRockRadio.com
[/url]


Top
 Profile  
Reply with quote  
PostPosted: July 25th, 2014, 12:16 pm 
Offline
Experienced User
Experienced User

Joined: March 26th, 2014, 7:47 pm
Posts: 291
Location: New Jersey
try it with execution locked, it makes scripts execute faster

Code:
PAL.Loop := True;
PAL.WaitForTime(T['08:00:00']); {Wait for 8am}
{==================================================}
var D : TDataSet;
var C : Integer;
PAL.LockExecution;
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);
Queue.AddFile('C:\Top10\'+IntToStr(C)+'.mp3',ipTop);
D.Next;
end;
PAL.UnLockExecution;             
{==================================================}
PAL.WaitForTime(T['23:59:59']); {Wait for next day}


if that doesn't work you can add a wait near the top
Code:
PAL.WaitForPlayCount(1);

_________________
[INSERT]Signature Here[/INSERT]


Top
 Profile  
Reply with quote  
PostPosted: July 25th, 2014, 1:09 pm 
Offline
New User
New User

Joined: September 13th, 2009, 9:18 pm
Posts: 14
Location: Round Rock, Texas
Although the Pal.LockExceution cut the time down to 21 secs I think I prefer using the PAL.WaitForPlayCount (1); method better.
I really appreciate the help man!
Have a great weekend
James

_________________
[url]http://www.RoundRockRadio.com
[/url]


Top
 Profile  
Reply with quote  
PostPosted: July 25th, 2014, 2:24 pm 
Offline
Experienced User
Experienced User

Joined: March 26th, 2014, 7:47 pm
Posts: 291
Location: New Jersey
you can use them both together. just be sure you put the wait before the lock request

_________________
[INSERT]Signature Here[/INSERT]


Top
 Profile  
Reply with quote  
PostPosted: July 25th, 2014, 2:53 pm 
Offline
New User
New User

Joined: September 13th, 2009, 9:18 pm
Posts: 14
Location: Round Rock, Texas
That's a great idea. Thanks so much!
James

_________________
[url]http://www.RoundRockRadio.com
[/url]


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group