Note that this Wiki is a work in progress, items may not be updated or may disappear entirely as the pages are updated.
Music1 hourly import
From SpacialAudio
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 Scripting - "Hello World" Example and Using Pal For Category Based Rotation
Pal Script to import your hourly generated play lists in to SAM Broadcaster
The following pal script will load your hourly 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 hourly playlists into the queue at 3 minutes before the hour
based on the naming scheme of Music 1 for hourly playlists
yymmdd.hh.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;
const PlaylistPath = 'C:\Sam Vitals\Play 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, HourLength : Integer;
var HoldYear,TheYear,TheMonth, TheDay, TheHour, 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
Present:= Now;
DecodeTime(Present, Hour, Min, Sec, MSec);
writeln ( IntToStr(Hour));
Hour := Hour + 1;
If (Hour = 24) then
Hour := 0; // set it to mid night
writeln ('Hour to get ' + IntToStr(Hour));
if (Hour = 0) Then
Present:= Now + 1;
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);
TheHour := IntToStr(Hour);
MonthLength := length(TheMonth) ;
DayLength := length(TheDay);
HourLength := length(TheHour);
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
LessThan := HourLength < 2;
If (LessThan) Then
TheHour := '0'+ TheHour; // if a single digit add 0 to front
Playlist := PlayListPath + TheYear+TheMonth+TheDay+ '.' + TheHour + Fileextension;
// writeln (TheYear);
// writeln (TheMonth);
// writeln (TheDay);
writeln (Playlist);
PAL.WaitforTime(T['xx:55:00']); // wait for 5 minutes befor the hour
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['xx:59:59']);
Link To Other PAL Articles
- PAL Script Examples
- Music1 24 Hour PAL Script
- Music 1 Hourly PAL
- CBS News Scripts
- Video on CBS PAL scripts
- Write some useful scripts
- PAL Scripting - "Hello World" Example and Using Pal For Category Based Rotation
