I had this working before, but now I can’t seem to get it to run - Probably something very simple, hence my post on here for the experts! Playlists on our system are hourly, in the format ddmmyy-hh, so today’s playlist for 10am would be 030906-10.m3u - The event “fires”, but doesn’t load the playlist.
Here’s my script file:
begin
CurrentPlaylist.Append('D:\Playlists\' + FormatDateTime('ddmmyy-hh', now + 0.04166) + '.m3u');
end.
D:\Playlists\ exists and contains the playlists. So I’m a bit stumped ;( I’m not quite sure how your datetime system works, Torben - is it universal or are you in control of it ? ie: YY would be 06, but YYYY would be 2006 for example. DDD would be Sun, DD is 03… and so on.
I’ve tried the script with the 2 commands between begin/end - and also with their own begin/end statements. Both produce that error message.
I don’t suppose there’s a way to add these dd mm yy variables to the Load Playlist event, is there ? So in the load playlist window, we have this:
D:\Playlists\ddmmyy-hh.m3u
Or perhaps:
D:\Playlists\%dd%mm%yy-%hh.m3u
ADDITIONAL…
I also cannot get this one to work (same error) with a daily playlist:
[code]var i: integer;
begin
for i := CurrentPlaylist.GetHistoryCount to CurrentPlaylist.GetCount - 1 do
if CurrentPlaylist.GetItem(i).GetTitle = ‘START OF HOUR’ then begin
CurrentPlaylist.AutomationJump(CurrentPlaylist.GetItem(i));
break;
end;
end.[/code]
Our “top of hour” dummy always has the format START OF HOUR 13:00:00 (for 1pm).
I don't suppose there's a way to add these dd mm yy variables to the Load Playlist event, is there ?
Of course there is, but I would like to avoid that. Have you seen all of those possible variables on the FormatDateTime help page mentioned above? I would have to implement manual replacement for al of these. And then, you would have to tell mAirList that it’s the next hour to consider, not the current. Other users might need variables for the current hour … tricky.
You see, all of this is very custom. And the idea is to use scripts for this. Let’s get this working
Can you please post the complete script (including begin and end) that causes the Invalid Class Typecast error?
Our "top of hour" dummy always has the format [b] START OF HOUR 13:00:00[/b] (for 1pm).
Then you have to compare only the first 13 (= length of “START OF HOUR”) characters of the title to the magic words. You can use the Pascal function “copy” for this:
[code]var i: integer;
begin
for i := CurrentPlaylist.GetHistoryCount to CurrentPlaylist.GetCount - 1 do
if copy(CurrentPlaylist.GetItem(i).GetTitle, 1, 13) = ‘START OF HOUR’ then begin
CurrentPlaylist.AutomationJump(CurrentPlaylist.GetItem(i));
break;
end;
end.[/code]
I’m obviously missing something (perhaps obvious), but I just used that example you posted and it brings the same error. I have turned-off the PlaylistHistory feature - Is that related ?
So, just to be sure - My script file only contains:
[code]var i: integer;
begin
for i := CurrentPlaylist.GetHistoryCount to CurrentPlaylist.GetCount - 1 do
if copy(CurrentPlaylist.GetItem(i).GetTitle, 1, 13) = ‘START OF HOUR’ then begin
CurrentPlaylist.AutomationJump(CurrentPlaylist.GetItem(i));
break;
end;
end.[/code]
We’d prefer hourly playlists, as it speeds up loading and makes starting automation from another PC or mid-way fairly easy. But when I try both daily+hourly playlists - the script produces this same error message.
Just to be sure - it’s the latest mAirList version you’re using, isn’t it?
Is the “Invalid Class Typecast” error displayed as a message box or in the system log? In case of the latter, it should tell the row and column at which the error occured, just like “[Error] (2:3): …”. What’s the position of that Typecast error?
I can’t seem to get any more info out of that drop-down box… Just invalid typecast. Here’s the first few lines of a playlist, just to show you how it looks:
#mAirList DUMMY 0 START OF HOUR 00:00:00
D:\BUZZ RADIO\GENERIC IDENTS\Buzz Radio - Generic Ident 3.mp3
D:\AUDIO TO IMPORT\Nerina Pallot - Everybody's Gone to War.mp3
D:\GALAXY\Galaxy Songs\Sandi Thom - What If I'm Right.mp3
Yes - Works fine if I use “Run Script” from the Open menu. ?! Here’s my Event dialogue-box - Which fires the event, and yes - the dreaded Typecast Error was present in the error box.
Hm. Then it seems to be an issue related to the event scheduler, rather than an error within the script. I’m at the office right now, rather busy, but I will take a look at it later this day.
Ok, it’s the event scheduler causing the error message, and it happens with any script executed through an event. I have corrected the error, it will be fixed in 1.5.23 (released tonight).
Jump To Next Hour
This would run at 58 minutes past, and using the line: [b]#mAirList DUMMY 0 START OF HOUR 16:00:00 /b at the start of each hour, this script checks the first 13 characters from the text: “START OF HOUR” and jumps to the next occurance…
[code]var i: integer;
begin
for i := CurrentPlaylist.GetHistoryCount to CurrentPlaylist.GetCount - 1 do
if copy(CurrentPlaylist.GetItem(i).GetTitle, 1, 13) = ‘START OF HOUR’ then begin
CurrentPlaylist.AutomationJump(CurrentPlaylist.GetItem(i));
break;
end;
end.[/code]
No… Only 1 of these is required. It depends if you use Hourly or Daily playlists. If using Daily, you’ll want to use the “Jump” script at 58 ish, and a daily “Load Playlist” at 23:58 to load the next day.
The Hourly playlist will just require the “Load Next” playlist at 58 mins. The “Load Current” is just a quick way of loading the current playlist without having to look for it on the hard-drive
I’m trying to jump mAirList 2.1.19 (temp fix executable) to a dummy file called “New Hour Starts Here”.
This is the script I’ve tried based on what I’ve read in this topic:
var i: integer;
begin
for i := CurrentPlaylist.GetHistoryCount to CurrentPlaylist.GetCount - 1 do
if copy(CurrentPlaylist.GetItem(i).GetTitle, 1, 19) = ‘New Hour Stars Here’ then begin
CurrentPlaylist.AutomationJump(CurrentPlaylist.GetItem(i));
break;
end;
end.
However all I get in return is an error unknown identifier ‘AUTOMATIONJUMP’.
begin
for i := 0 to CurrentPlaylist.GetCount - 1 do
if copy(CurrentPlaylist.GetItem(i).GetTitle, 1, 13) = ‘START OF HOUR’ then begin
CurrentPlaybackControl.AutomationJump(CurrentPlaylist.GetItem(i));
break;
end;
end.[/code]
(“CurrentPlaylist” refers to the playlist data, “CurrentPlaybackControl” to the object which handles the data, i.e., which loads, starts, stops players etc.)
Torben
PS: Hint: When posting scripts, please wrap them in the code environment (click the “Code” button above the editor window), it’s much easier to read then, because indentation is preserved.
I tried to replace AutomationJump with AutomationNext which I just found in the script help documents (under construction). However invalid number of parameters is the error I got. I didn’t think it would be as easy as replacing a word :o)