Skip to Content
It is currently March 9th, 2021, 5:12 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: PAL Jingle Issue
PostPosted: April 25th, 2020, 3:15 pm 
Offline
Junior User
Junior User

Joined: April 21st, 2013, 12:27 pm
Posts: 53
Hello. I'm trying to make a script that will play a jingle ebfore playing any other track.
Code:
/ Playlist script by DarthManâ„¢

// define current/next song, active player variables

var iCurrentSong, iNextSong : TSongInfo;
var iActivePlayer : TPlayer;
var bPlayListGenerated : Boolean = False;
// continuous loop

pal.loop := True;
// lock pal execution

Pal.LockExecution;

iActivePlayer := ActivePlayer;
iCurrentSong := iActivePlayer.GetSongInfo;
iNextSong := Queue.NextInQueue;
Queue.Add(iNextSong, ipTop);

// if current song is not null and is type song, not jingle etc and there is no next track

if iCurrentSong <> nil then
begin
    if ((iCurrentSong['songtype'] = 'S') and (iNextSong = nil)) then
    begin
        Cat['Jingles (All)'].QueueBottom(smRandom, NoRules);
        Cat['Underground'].QueueBottom(smPriority, EnforceRules);
    end;
end
else
begin
    Cat['Underground'].QueueBottom(smPriority, EnforceRules);
end;

bPlayListGenerated := ((iCurrentSong <> nil) and (iNextSong <> nil));

//unlock pal execution

Pal.unLockExecution;

//free the variables if the playlist was generated

if bPlayListGenerated = True then
begin
     iCurrentSong.Free;
     iNextSong.Free;
     iActivePlayer.Free;
end;

//wait for count

Pal.WaitForPlayCount(1); //Restart after 1 play


What could be wrong?
It works, then 2nd time it doesn,t 3rd time it works again etc.


Top
 Profile  
Reply with quote  
 Post subject: Re: PAL Jingle Issue
PostPosted: April 25th, 2020, 5:28 pm 
Offline
SVS Member
SVS Member

Joined: May 5th, 2008, 4:53 pm
Posts: 305
Hello,

I tested your script.
Your script do not work properly because you have an Access vionation.

Line 18 is missing a TSongInfo check for nil. So before Queue.Add insert it.

Code:
if iNextSong <> nil then
Queue.Add(iNextSong, ipTop);


After this change anything works as expected.

Best Regards

_________________
Ivan Radolović - Spacial Volunteer Support (SVS)


Top
 Profile  
Reply with quote  
 Post subject: Re: PAL Jingle Issue
PostPosted: April 26th, 2020, 2:58 am 
Offline
Junior User
Junior User

Joined: April 21st, 2013, 12:27 pm
Posts: 53
IvanR wrote:
Hello,

I tested your script.
Your script do not work properly because you have an Access vionation.

Line 18 is missing a TSongInfo check for nil. So before Queue.Add insert it.

Code:
if iNextSong <> nil then
Queue.Add(iNextSong, ipTop);


After this change anything works as expected.

Best Regards


Got it, thanks =D


Top
 Profile  
Reply with quote  
 Post subject: Re: PAL Jingle Issue
PostPosted: April 26th, 2020, 12:24 pm 
Offline
Junior User
Junior User

Joined: April 21st, 2013, 12:27 pm
Posts: 53
I noticed that the script still has a few issues, after 2 tracks are played, always the 3rd doesn't have a jingle. Any ideas?


Top
 Profile  
Reply with quote  
 Post subject: Re: PAL Jingle Issue
PostPosted: April 28th, 2020, 1:52 pm 
Offline
Junior User
Junior User

Joined: April 21st, 2013, 12:27 pm
Posts: 53
Fixed it, using just
Code:
if iNextSong <> nil then
begin
    Queue.Add(iNextSong, ipTop);
end
else
begin
    Cat['Jingles (All)'].QueueBottom(smRandom, NoRules);
    Cat['Underground'].QueueBottom(smWeighted, EnforceRules);
end;


This solved the issue and the playlist is well-generated now.


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

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 31 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:  
cron
Powered by phpBB® Forum Software © phpBB Group