I am trying to automatically insert a File into playlist as next item if it exists.
As a basic approach I tried the following:
procedure OnPlayerEOFWarning(PlaylistIndex: integer; PlayerIndex: integer);
begin
if FileExists('s:\External\Playme.mp3') then
begin
newItem := Factory.CreateFilePlaylistItem('s:\External\Playme.mp3', [fitAutoCue]);
CurrentPlaylist.Insert(CurrentPlaylist.IndexOf(activeItem) + 1, newItem);
end;
end;
When I try to load the code, mAirlist complains about the number of parameters (obviously for the nerItem:=… line).
I tried to find help about the parameters in the mAirlistScriptingHelp.chm, but there is not text in it (only chapters).
What am I doing wrong in the script ?
Any ideas how to make the scripting help (chm-file) work ?
This must be a very old copy of the CHM file - the second parameter is not “iLoadData: boolean” anymore, but actually a set of “TFileImportTask” flags, telling mAirList which sources to check for metadata: tags, database, Auto Cue, …
Please regard the CHM file only as a list of available functions. It’s generated directly from my source code, and there is hardly any documentation for the functions, most of which are internal anyway. Feel free to ask questions for a particular problem.
Regarding the error message, it looks like “activeItem” and “nextItem” haven’t been declared - there is no “var” section at all.
The easiest method to find the right insertion point is to use the “GetNextIndex” function - it will return the index of the item that is going to be played next.
procedure OnPlayerEOFWarning(PlaylistIndex: integer; PlayerIndex: integer);
begin
if FileExists('s:\External\Playme.mp3') then
CurrentPlaylist.Insert(CurrentPlaylist.GetNextIndex, Factory.CreateFilePlaylistItem('s:\External\Playme.mp3', [fitAutoCue]));
end;