Skip to Content
It is currently December 2nd, 2022, 9:52 pm

All times are UTC - 6 hours [ DST ]




 [ 22 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: May 22nd, 2012, 9:14 am 
Offline
New User
New User

Joined: October 18th, 2007, 1:27 am
Posts: 16
Location: Houston, TX USA
Good morning, all.
I need help with my pal script, copied below.
I use it to broadcast locally produced news update at the half-hour mark and it works just fine. The problem I have, though, is I also have pre-recorded shows as well as live stream relays that last one hour or more and it would be nice if I could make the script to not distrupt such shows.

What obtains presently is that when it's time for the news update, sam fades out the current show. But I don't want that to happen, I want sam to either not play the news update at all if I have 20+ minutes left on the active player, or just pause active player, take the news update and return to the show.

Another question, though unrelated: I the past I could adjust the weight of certain songs to make them play more frequently than others but I don't know how to do that in this sam4.9.4. Any help on that too, would be appreciated.

You guys have helped me greatly in the past and I appreciate it.

Code:
PAL.LOOP := True;
Pal.WaitforTime ('XX:29:45'); {## Wait for next hour}
Queue.Clear;
CAT['Station Image'].QueueTOP(smLRP, NoRules);
Queue.AddFile('C:\news\News Update.mp3',ipTop);
ActivePlayer.FadeToNext;
function ActivePlayer:TPlayer;
begin
if DeckA.Status = psPlaying then
Result := DeckA
else
Result := DeckB;
end;

//ActivePlayer.FadeToNext; {Uncomment If You Would Like to start news immediately after it has loaded}


Top
 Profile  
 
PostPosted: May 24th, 2012, 2:46 am 
Offline
New User
New User

Joined: December 12th, 2010, 3:31 am
Posts: 24
Location: Smolensk Province, Russia
This should do the work:

Code:
PAL.LOOP := True;
Pal.WaitforTime ('XX:29:45'); {## Wait for next hour}
Queue.Clear;
Queue.AddFile('C:\news\News Update.mp3',ipTop);
     If DeckA.Status = psPlaying then
                                      Begin
                                            DeckA.Pause;
                                            DeckB.QueueSong(Queue.NextInQueue);
                                            DeckB.Play;
                                        End
                                   Else
                                       Begin
                                             DeckB.Pause;
                                             DeckA.QueueSong(Queue.NextInQueue);
                                             DeckA.Play;
                                        End;


Top
 Profile  
 
PostPosted: May 24th, 2012, 5:54 am 
Offline
New User
New User

Joined: October 18th, 2007, 1:27 am
Posts: 16
Location: Houston, TX USA
Thanks, robot-gobot.

Is there a way to make it pause only if ative player has X or more minutes to play? The reason is, I'll prefer for it not to pause if the ative player only has a song playing but rather fade to next and go to the news immediate. I want the pause condition to only apply if the active player has x minutes or more left to play.
Is that possible?
Thanks for your help.


Top
 Profile  
 
PostPosted: May 24th, 2012, 7:07 am 
Offline
New User
New User

Joined: December 12th, 2010, 3:31 am
Posts: 24
Location: Smolensk Province, Russia
Yes, it is possible:
Code:
PAL.Loop := True;
Pal.WaitforTime ('XX:29:45'); {## Wait for next hour}
Queue.Clear;
Queue.AddFile('C:\news\News Update.mp3',ipTop);
If ((ActivePlayer.Duration)-(ActivePlayer.CurTime) > 60000) and FileExists('C:\news\News Update.mp3') then
    Begin
        If DeckA.Status = psPlaying then
            Begin
                DeckB.QueueSong(Queue.NextInQueue);
                DeckA.Pause;
                DeckB.Play;
            End
        Else
            Begin
                DeckA.QueueSong(Queue.NextInQueue);
                DeckB.Pause;
                DeckA.Play;
            End;
    End
Else
   If FileExists('C:\news\News Update.mp3') then
    ActivePlayer.FadeToNext;


Replace 60000 with your time (in milliseconds).


Last edited by Elevatorboy on May 25th, 2012, 5:14 am, edited 2 times in total.
Removed full quotation of immediately preceding post


Top
 Profile  
 
PostPosted: May 24th, 2012, 7:55 am 
Offline
New User
New User

Joined: October 18th, 2007, 1:27 am
Posts: 16
Location: Houston, TX USA
You're awesome! Just what the doctor prescribed.
For fair of asking for too much favour, if I want it to clear the queue afterwards, where can I add
Code:
Queue.Clear;
.
Thanks again.


Top
 Profile  
 
PostPosted: May 24th, 2012, 8:03 am 
Offline
New User
New User

Joined: December 12th, 2010, 3:31 am
Posts: 24
Location: Smolensk Province, Russia
Just add
Code:
Queue.Clear;
as the last string of the script. Not sure though why would you want to do this since we already cleared queue at the begining of the script.


Last edited by Elevatorboy on May 25th, 2012, 5:14 am, edited 2 times in total.
Removed full quotation of immediately preceding post


Top
 Profile  
 
PostPosted: May 24th, 2012, 9:33 am 
Offline
New User
New User

Joined: October 18th, 2007, 1:27 am
Posts: 16
Location: Houston, TX USA
Quote:
as the last string of the script. Not sure though why would you want to do this since we already cleared queue at the begining of the script.

Actually, the script inject three files into the queue, with the news update on top, when it pause and takes the news, the other two files will still be in the queue.
Have a great day.


Top
 Profile  
 
PostPosted: May 25th, 2012, 1:03 am 
Offline
New User
New User

Joined: December 12th, 2010, 3:31 am
Posts: 24
Location: Smolensk Province, Russia
Hmm.. The script i posted injects only one file into the queue (C:\news\News Update.mp3). Are you sure you`re not missing anything?

Have a great day too!


Last edited by Elevatorboy on May 25th, 2012, 5:15 am, edited 1 time in total.
Removed full quotation of immediately preceding post


Top
 Profile  
 
PostPosted: May 25th, 2012, 3:05 am 
Offline
New User
New User

Joined: October 18th, 2007, 1:27 am
Posts: 16
Location: Houston, TX USA
Quote:
Hmm.. The script i posted injects only one file into the queue (C:\news\News Update.mp3). Are you sure you`re not missing anything?

You're right. I did modify the script this way:
Code:
PAL.Loop := True;
Pal.WaitforTime ('XX:29:45'); {## Wait for next hour}
Queue.Clear;
CAT['Station Image'].QueueTOP(smLRP, NoRules);
Queue.AddFile('C:\news\newspromo.mp3',ipTop);
Queue.AddFile('C:\news\News Update.mp3',ipTop);

If ((ActivePlayer.Duration)-(ActivePlayer.CurTime) > 600000) and FileExists('C:\news\News Update.mp3') then
    Begin
        If DeckA.Status = psPlaying then
            Begin
                DeckB.QueueSong(Queue.NextInQueue);
                DeckA.Pause;
                DeckB.Play;
            End
        Else
            Begin
                DeckA.QueueSong(Queue.NextInQueue);
                DeckB.Pause;
                DeckA.Play;
            End;
    End
Else
   If FileExists('C:\news\News Update.mp3') then
    ActivePlayer.FadeToNext;
Queue.Clear;

I removed the last string upon realizing that it cleared the queue almost immediately and so did not play the newsupdate.
I still would want the script be able to clear the other two items from the queue in the even there's
Code:
((ActivePlayer.Duration)-(ActivePlayer.CurTime) > 600000)
only.
But the script itself is a huge help as it is. Perhaps, the reason I didn't want to bother you any further.


Top
 Profile  
 
PostPosted: May 25th, 2012, 7:34 am 
Offline
New User
New User

Joined: December 12th, 2010, 3:31 am
Posts: 24
Location: Smolensk Province, Russia
So you want to play 'C:\news\News Update.mp3', then 'C:\news\newspromo.mp3' and then CAT['Station Image'].QueueTOP(smLRP, NoRules) when your hour long show fades to next song in queue. But if there is more then 10 minutes of the show left (i.e. show doesn`t fade to next, but pauses) you want to play only 'C:\news\News Update.mp3' and then resume the show?


Top
 Profile  
 
PostPosted: May 25th, 2012, 8:00 am 
Offline
New User
New User

Joined: October 18th, 2007, 1:27 am
Posts: 16
Location: Houston, TX USA
robot-gobot wrote:
So you want to play 'C:\news\News Update.mp3', then 'C:\news\newspromo.mp3' and then CAT['Station Image'].QueueTOP(smLRP, NoRules) when your hour long show fades to next song in queue. But if there is more then 10 minutes of the show left (i.e. show doesn`t fade to next, but pauses) you want to play only 'C:\news\News Update.mp3' and then resume the show?

That's correct.


Top
 Profile  
 
PostPosted: May 25th, 2012, 8:30 am 
Offline
New User
New User

Joined: December 12th, 2010, 3:31 am
Posts: 24
Location: Smolensk Province, Russia
That should be rather easy to implemet. I`ll try to post a new script sometime tomorrow since i am extremely busy right now.


Top
 Profile  
 
PostPosted: May 25th, 2012, 10:41 am 
Offline
New User
New User

Joined: October 18th, 2007, 1:27 am
Posts: 16
Location: Houston, TX USA
Very well. I can wait.


Top
 Profile  
 
PostPosted: May 26th, 2012, 1:41 am 
Offline
New User
New User

Joined: December 12th, 2010, 3:31 am
Posts: 24
Location: Smolensk Province, Russia
Here is the new script:
Code:
PAL.Loop := True;
Pal.WaitforTime ('XX:36:55'); {## Wait for next hour}
PAL.LockExecution;
Queue.Clear;
CAT['Station Image'].QueueTOP(smLRP, NoRules);
Queue.AddFile('C:\news\newspromo.mp3',ipTop);
Queue.AddFile('C:\news\News Update.mp3',ipTop);
If ((ActivePlayer.Duration)-(ActivePlayer.CurTime) > 60000) and FileExists('C:\news\News Update.mp3') then
    Begin
        If DeckA.Status = psPlaying then
            Begin
                DeckB.QueueSong(Queue.NextInQueue);
                DeckA.FadeToPause;
                DeckB.Play;
            End
        Else
            Begin
                DeckA.QueueSong(Queue.NextInQueue);
                DeckB.FadeToPause;
                DeckA.Play;
            End;
       Queue.Clear;
    End
Else
   If FileExists('C:\news\News Update.mp3') then
    ActivePlayer.FadeToNext;
PAL.UnlockExecution;


Top
 Profile  
 
PostPosted: May 26th, 2012, 8:28 pm 
Offline
New User
New User

Joined: October 18th, 2007, 1:27 am
Posts: 16
Location: Houston, TX USA
robot-gobot wrote:
Here is the new script:

I will test it out and let you know how it works. Have a nice weekend.


Top
 Profile  
 
Display posts from previous:  Sort by  
 [ 22 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours [ DST ]


Who is online

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