We are in the process of migrating the Spacial Wiki content to our new Help Center at spacial.com.
Please visit the Help Center for latest Tips and Tricks, Documentation and Troubleshooting.
spacial.com/help-center

Music1 24 hour PAL

From SpacialAudio

Jump to: navigation, search

Link To Other PAL Articles

Table of Contents   Quick Start Guide   PAL Scripting 101   Objects   Script Examples    Music1 24 Hour PAL Script    Music 1 Hourly PAL   CBS News Scripts    Write some useful scripts


Pal Script to import your hourly generated play lists in to SAM Broadcaster

The following pal script will load your 24 hour play lists in the queue of your SAM Broadcaster.
Be sure that the output file format from Music 1 matches the format in The Script and make sure the directory is correct. Or change the naming in the PAL script.
For help with Music 1 watch the video tutorials http://www.gomusic1.com/Videos/SE2_Videos/se2_videos.html
The 2 most common problems are

  • const PlaylistPath = 'C:\Sam Vitals\Play logs\'; // location your Music 1 play lists are saved.

If the path to your output is different than what is in the above line of the script.
You need to change it to the correct path.

  • The default naming convention used in the script is different than the format you have M1 outputting

if it is outputting yyyy-mm-dd.hh.m3u
You need to change the script so it uses the whole year instead of just the last 2 characters.
change
HoldYear := IntToStr(Year);;
TheYear := Copy(HoldYear,3,2);
to
HoldYear := IntToStr(Year);
TheYear := HoldYear;

To take a look in the output wind for exactly what and where the script is looking uncomment out the follow lines
Playlist := PlayListPath + TheYear+TheMonth+TheDay+ '.' + TheHour + Fileextension;
// writeln (TheYear);
// writeln (TheMonth);
// writeln (TheDay);
writeln (Playlist);
to
writeln (TheYear);
writeln (TheMonth);
writeln (TheDay);
The writeln will output in the SAM IDE , Edit Output Window for the script


{*******************************************************************************

PAL script for putting Music 1 SE playlists into the que at 23:30 (11:30PM)

based on the naming scheme of Music 1

yymmdd.m3u



You will need to change the constants to meet your needs.

The load time can be changed as well as clearing que or waiting for 1 song play clear queue and add.

This is a basic script . A starting Place



******************************************************************}



PAL.Loop := True;
//make sure to change the Playlistpath variable to point to where the playlist files are located
const PlaylistPath = 'c:\SAM LOGS\'; // location your Music 1 playlists are saved

const Fileextension = '.m3u'  ; // the playlist extension



var Present: DateTime;

var Year, Month, Day, Hour, Min, Sec, MSec,DayLength,MonthLength : Integer;

var HoldYear,TheYear,TheMonth, TheDay,Playlist :String;

var LessThan : Boolean;





  Present:= Now + 1;  // since we are loading a few minutes before the next day we want the next days list



  DecodeDate(Present, Year, Month, Day);

  HoldYear :=  IntToStr(Year);

  TheYear := Copy(HoldYear,3,2); // copy the last 2 digits of the year 2007 would copy the 07

  TheMonth :=  IntToStr(Month);

  TheDay := IntToStr(Day);

  MonthLength := length(TheMonth) ;

  DayLength := length(TheDay);

  LessThan := MonthLength < 2;

  If (LessThan)  Then

    TheMonth := '0'+ TheMonth; // if a single digit add 0 to front

  LessThan := DayLength < 2;

 If (LessThan)  Then

    TheDay := '0'+ TheDay; // if a single digit add 0 to front



  Playlist := PlayListPath + TheYear+TheMonth+TheDay+Fileextension;



//  writeln (TheYear);

//  writeln (TheMonth);

//  writeln (TheDay);

//   writeln (Playlist);


PAL.WaitforTime(T['23:55:00']);  // wait for 11:55pm 

if(FileExists(Playlist))then

 begin
   Queue.Clear;

  Queue.AddList(Playlist,ipBottom); // add playlist to bottom of the queue
   ActivePlayer.FadeToNext;
   WriteLn('Loaded: '+Playlist);
 end

else

 begin

   WriteLn('PLAYLIST NOT VALID!');

   WriteLn(Playlist);

 end;



PAL.WaitforTime(T['23:59:59']); // wait for midnight before restarting process


Back to Top


Link To Other PAL Articles

Personal tools