Skip to Content
It is currently August 24th, 2019, 11:45 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Overlay script problem
PostPosted: November 22nd, 2008, 7:48 am 
Offline
Junior User
Junior User

Joined: November 10th, 2008, 11:11 am
Posts: 45
I can't figure out how to modify this script to load the track in aux 1 at the assigned time then wait until the next song with a 5-6 sec ramp then play. Right now it plays the track at the given time regardless of what the current state of the song already playing. What am I overlooking?

Code:
{ SCRIPT MADE BY "blackf0rk", modified by PaulieP }
{ GIVE CREDIT WHERE CREDIT IS DUE, RIGHT? }



PAL.Loop := True;
var liner : TSongInfo;
var StartDeck : TPlayer;
var NextDeck : TPlayer;
Aux1.Eject;

{play liner at xx:03:30}

PAL.WaitForTime('xx:28:00');

liner := CAT['30'].ChooseSong(smRandom, NoRules);
Aux1.QueueSong(liner);

IdlePlayer.Volume := 255;

StartDeck := ActivePlayer;
NextDeck := IdlePlayer;

If Aux1.Status = 1 then
  begin
    Aux1.QueueSong(liner);
  end;

Aux1.Play;

while Aux1.Status=0 do
  begin
  end;


ActivePlayer.Volume := 255;
IdlePlayer.Volume := 255;

{play liner at xx:34:00}

PAL.WaitForTime('xx:30:00');

liner := CAT['30'].ChooseSong(smRandom, NoRules);
Aux1.QueueSong(liner);

IdlePlayer.Volume := 255;

StartDeck := ActivePlayer;
NextDeck := IdlePlayer;

If Aux1.Status = 1 then
  begin
    Aux1.QueueSong(liner);
  end;

Aux1.Play;
while Aux1.Status=0 do  begin  end;


ActivePlayer.Volume := 255;
IdlePlayer.Volume := 255;

  IF  (Now > T['17:55:00']) THEN
begin
PAL.Loop := False;
Queue.Clear;
  end;


Last edited by Elevatorboy on November 22nd, 2008, 9:17 am, edited 1 time in total.
Added code tags to improve script readability


Top
 Profile  
Reply with quote  
PostPosted: November 22nd, 2008, 9:19 am 
Offline
Alumni
Alumni

Joined: October 14th, 2006, 9:38 am
Posts: 5986
Location: Deep in the heart of the PRNJ
This script doesn't test for intro length. Use the Overly Liner PAL in your SAM folders.

_________________
- Stan Olochwoszcz
A proud licensed SAM user since 2002

Raritan Bay Radio


Top
 Profile  
Reply with quote  
PostPosted: November 22nd, 2008, 9:56 am 
Offline
Junior User
Junior User

Joined: November 10th, 2008, 11:11 am
Posts: 45
OK, found it and ran it but cannot make it start looking for a compatible song at XX:30:00 or what ever break I want it to run in. From what I see (and might be looking for the wrong thing) it runs it every 30 minutes instead of ONLY at half past the hour. What do I have to add, or take out to make it play at the right time?

{ About:
This script will play a liner in Aux1 as soon as a new track starts
The liner will only be played if
a) The song has an intro of specified minimem duration
b) The song is of type S, i.e. a normal song.

Then the script will wait the specified amount of time before
it tries to play another liner.

This script can help brand your station and make it sound like a true
commercial terrestrial station.
any source connected

Usage:
a) Make sure you use the song information editor to specify intro times for your tracks!
b) Make sure the AGC settings on Aux1 is to your liking. Also set the volume a bit louder
on Aux1 so you cna clearly hear the liner above the active Deck audio.
c) Edit the configuration details below.
Make sure to change the category to the one you use to store your liners.
}
{ CONFIGURATION }
{==================================================}
const MIN_INTRO = 5*1000; //5 seconds
const MIN_WAIT = '+00:15:00'; //Wait 15 minutes between liners
const LINERS_CATEGORY = '30';


{ IMPLEMENTATION }
{--------------------------------------------------}
function ExtractIntro(Song : TSongInfo):Integer; forward;

var Song, Liner : TSongInfo;
var Waiting : Boolean = True;
var Intro : Integer = 0;
Aux1.Eject;

{Step1: Queue up the deck, ready for play}
Liner := CAT[LINERS_CATEGORY].ChooseSong(smLRP,NoRules);
if (Liner=nil) then
WriteLn('No valid liner found')
else if (not Aux1.QueueSong(Liner)) then
WriteLn('Failed to queue song: '+Liner['filename']);

{Wait for a valid song with intro}
while Waiting do
begin
{Step2: Wait for the song to change}
PAL.WaitForPlayCount(1);

{Step3: Grab current song information}
Song := ActivePlayer.GetSongInfo;

if (Song=nil) then
WriteLn('The active player contained no song info??')
else
begin
{Extract the intro time - this is a bit tricky}
Intro := ExtractIntro(Song);

{Start playing the liner if the current song matches our rules}
if(Song['songtype']='S') and (Intro>=MIN_INTRO) then
begin
Aux1.Play;
Waiting := False;
end;
Song.Free; Song := nil;
end;
end;

{Wait 5 minutes before we do this all again}
PAL.WaitForTime(MIN_WAIT);
PAL.Loop := True;

{................................................}
function ExtractIntro(Song : TSongInfo):Integer;
var
P : Integer;
XFade : String;
begin
Result := -1;
XFade := Trim(Song['xfade']);

WriteLn('Decoding XFade string');
WriteLn('XFade: '+XFade);

if XFade = '' then
Result := -1
else
begin
P := Pos('&i=',XFade);
if (P > 0) then
begin
Delete(XFade,1,P+2);
P := Pos('&',XFade);
if (P>0) then
Delete(XFade,P,Length(XFade));

Result := StrToIntDef(XFade,-1);
WriteLn('Intro time detected: '+XFade);
end;
end;
end;

{--------------------------------------------------}


Top
 Profile  
Reply with quote  
PostPosted: November 22nd, 2008, 10:29 am 
Offline
SVS Member
SVS Member

Joined: May 8th, 2004, 9:00 am
Posts: 10439
Location: Denver, CO
try changing
Code:
const MIN_WAIT = '+00:15:00'; //Wait 15 minutes between liners

to
Code:
const MIN_WAIT = 'XX:30:00'; //Wait till bottom of hour between liners

_________________
- Rob Oyler, SVS
Image


Top
 Profile  
Reply with quote  
PostPosted: November 22nd, 2008, 11:23 am 
Offline
Junior User
Junior User

Joined: November 10th, 2008, 11:11 am
Posts: 45
nope... didn't work. Now it plays the liner on every song regardless of intro length


Top
 Profile  
Reply with quote  
PostPosted: November 22nd, 2008, 11:31 am 
Offline
Junior User
Junior User

Joined: November 10th, 2008, 11:11 am
Posts: 45
ok, I was wrong, sorry, it does work. Just when I run it then it play the liner on the next song then it starts timing to the time I entered. I hope that makes sense to you.


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

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 5 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