Skip to Content
It is currently July 21st, 2019, 6:26 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: August 13th, 2018, 10:02 am 
Offline
Junior User
Junior User

Joined: September 20th, 2006, 3:33 pm
Posts: 28
I've had the lineroverlay pal script working for several years to insert my station id at the start of songs every so often.

Today, my server had an issue which somehow caused the exe for sam broadcaster 4.9.8 to get deleted.

I ended up having to reboot the server, followed by completely reinstalling SAM.

I've configured sam again, and got the updates to my playlist page going again, but I can't seem to get the lineroverlay pal script working correctly.

I have a 3 second promo file that says the name of my station that I want to play over the beginning of tracks every so often.

I've set up the lineroverlay pal script as follows:

Code:
{ CONFIGURATION }
{==================================================}
const MIN_INTRO = 1*1000; //1 second
const MIN_WAIT  = '+00:15:00'; //Wait 15 minutes between liners
const LINERS_CATEGORY = 'promos';


{ 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(smRandom,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;

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


My liner file is set as category type P in SAM, but when I run the pal manually, I get the error 'No valid liner found'.

Can anyone shed any light on why this is erroring out when it runs?


Top
 Profile  
Reply with quote  
PostPosted: August 13th, 2018, 2:01 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7863
Location: Aachen (Germany)
Ok, so it's type P, but is it inside a category named "promos" (all lowercase)?
You know the default category for Promos is called "Promos (All)", right?

The error you report should only ever appear if there are no tracks at all inside the category you name at the top of the file.
I'd guess this is a typo in either your category name or some confusion over the actual category/playlist name and the one you typed in the script.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: August 13th, 2018, 3:01 pm 
Offline
Junior User
Junior User

Joined: September 20th, 2006, 3:33 pm
Posts: 28
Thanks....that worked. I didn't know that the name was "Promos (All)"

In all honesty, I couldn't find anywhere that was mentioned at all.

Thanks for the help...it's appreciated


Top
 Profile  
Reply with quote  
PostPosted: August 14th, 2018, 2:52 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7863
Location: Aachen (Germany)
csc2ya wrote:
I didn't know that the name was "Promos (All)"

In all honesty, I couldn't find anywhere that was mentioned at all.


I couldn't find where you saw a category called Promos either.

There's basically 3 types of objects in the categories window of SAM:
#1 Folders - Folder icon with a green arrow - Can only contain categories, but no tracks. Serve no purpose for the program itself, but are only graphical candy for grouping related items.
#2 Meta-Categories - Watchface with a green arrow, follow a naming scheme of "Songtype (All)" - Automatically contain all tracks of the corresponding songtype and can be read just like other categories. You can't remove tracks from there, just move them elsewhere or remove them from SAM alltogether. Also they can't have any children.
#3 Regular categories - just a folder icon without any decorations - If they're inside one of the Folders, they're limited to that songtype as well. If they're inside the Playlists "Folder", you can mix and match different songtypes here.

You probably mistook the Promos (All) category for the Promos Folder.


Attachments:
sam-promos.PNG
sam-promos.PNG [ 4.61 KiB | Viewed 746 times ]

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 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