Starting off, Advice please

Thanks,

I have PM’d him and I really hope he can help, I looked at that script however specifiying a time, date and year confused me a little as It would be repreated many times so It wouldnt be much help because I want it playing more than once, so hopefully Torben has an idea of how to do it so it can repeat it.

Cheers

Ok, here’s the solution to the 2-week-schedule:

mAirList 2.1.36 will provide a new function “ISOWeek” which calculates the week number according to ISO 8601 (week starts with Monday, first week is the one with at least four days in the new year). You can then determine the schedule week (1 or 2) with a simple modulo operation:

[code]var week: string;

begin
week := IntToStr(ISOWeek(now) mod 2 + 1);
SystemLog(week);
end.[/code]

As soon as .36 is out (within the next few days), I will help you with the complete script.

Thank you very much, I look forward to it.

Ok, here's the solution to the 2-week-schedule:

mAirList 2.1.36 will provide a new function “ISOWeek” which calculates the week number according to ISO 8601 (week starts with Monday, first week is the one with at least four days in the new year). You can then determine the schedule week (1 or 2) with a simple modulo operation:

[code]var week: string;

begin
week := IntToStr(ISOWeek(now) mod 2 + 1);
SystemLog(week);
end.[/code]

As soon as .36 is out (within the next few days), I will help you with the complete script.

Ok, here’s the complete script:

[code]const
PlaylistFolder = ‘C:\temp\playlists’;
TOHFolder = ‘C:\temp\TOH’;

var
nexthour: TDateTime;
week: string;
dayandhour: string;
pl: IPlaylist;

begin
// calculate TDateTime of start of next hour (:00:00)
nexthour := trunc((now + 0.04166) * 24) / 24;

week := IntToStr(ISOWeek(nexthour) mod 2 + 1);
dayandhour := FormatDateTime(‘ddd-hh’, nexthour);
SystemLog(week);
SystemLog(dayandhour);

// load TOH playlist
pl := CreatePlaylistFromFile(TOHFolder + ‘\Week’ + week + ‘-’ + dayandhour + ‘.m3u’);

// set the “fixed” time of the first item to :00:00 of the upcoming hour
// (strip the integer (date) part of the time)
pl.GetItem(0).SetStartTime(sttFixed, nexthour - int(nexthour));

// append the TOH playlist to the current playlist
CurrentPlaybackControl.GetPlaylist.AppendPlaylist(pl);

// apend the music playlist
CurrentPlaybackControl.GetPlaylist.LoadFromFile(PlaylistFolder + ‘\Week’ + week + ‘-’ + dayandhour + ‘.m3u’, true);
end.[/code]

It assumes that your music and TOH playlists are organized in the following way:

  • There is (at each) one file per hour per day per week, named “WeekX-weekday-hour.m3u”, for example “Week1-Thu-16.m3u” or “Week2-Fri-07.m3u”. Note that in this 24-hour-format. 12 midnight is considered hour 0 of the next day.

  • The playlists reside in the two folders specified at the beginning of the script, which you can easily adjust. Do not put a trailing slash at the end.

The script also takes care of setting the fixed time: It loads the contents of the corresponding TOH playlist into a temporary playlist item, adjusts the fixed time of the first element, and then appends it to the main playlist. Thereafter, the music playlist is loaded and appended. This way, you do not need to manually set the fixed time of the first element in all of your TOH playlists.

The script is supposed to be run a few minutes before reaching the TOH. Just set the event scheduler to “each hour at 55 minutes” or so.

Torben

Thank you very much Torben, I have made all the files for me to generate the playlists and tried some out and it seems to work a treat.

Theres just 1 thing I would like to know and that would be how to tell it to fade out the current item on the hour (even if its not got to the end of the playlist) so it starts the next hour bang on time because it appears it finishes what its playing first.

Cheers
Ste Crook

The “automatically jump to fixed time elements in automation” option must be enabled for the playlist. I’m not sure if it is by default, just check it.

I have been playing about with it a lot recently, sounds great!! Thank you