Hi,
As everybody suggested to me, I tried to create mairlist v2.2 scripts (instead of v3 scripts).
I updated the one I gave you previously. But there are still problems with the GetStartTime(sttEstimated).
I loaded the playlist in a temporary one. And I made the loop. But all items returns 00:00:00…
Here is the code :
[code]{-------------------------------------------------------------------------------
Load the correct playlist and pointe to the correct item to play.
Author: Sylvain Michelizza
Date: 2007-03-??
See http://www.mAirList.com for further information.
-------------------------------------------------------------------------------}
const
LOGS_PATH = ‘D:\RADIO_LOGS’;
var
Temporary_playlist: IPlaylist;
First_item_pos: integer;
First_item: IPlaylistItem;
function Search_playlistItem_position(pCurrent_playlist: IPlaylist): integer;
var
current_item: IPlaylistItem;
current_starttime: TDateTime;
curr_hour, curr_min, curr_sec, curr_ms: Word;
hour, min, sec, ms: Word;
exit_status: Boolean;
pos, real_position: integer;
diff_before, diff_after: ShortInt;
begin
DecodeTime(now, hour, min, sec, ms);
pos := 0;
diff_before := 0;
diff_after := 0;
exit_status := False;
repeat
current_item:=pCurrent_playlist.GetItem(pos);
//current_starttime := pCurrent_playlist.GetBackTiming(pos, btEstimated);
current_starttime := current_item.GetStartTime(sttEstimated);
DecodeTime(current_starttime, curr_hour, curr_min, curr_sec, curr_ms);
SystemLog(current_item.GetTitle);
SystemLog(IntToStr(curr_hour)+':'+IntToStr(curr_min)+':'+IntToStr(curr_sec));
diff_after:= min - curr_min;
if diff_after <= 0 then
begin
// Comparing...
if diff_after = 0
then real_position:= pos
else if Abs(diff_before) < Abs(diff_after)
then real_position:= pos-1
else real_position:= pos;
exit_status:= True;
end;
diff_before:= diff_after;
pos := pos+1;
until (exit_status = True) or (pos = pCurrent_playlist.GetCount);
Result:= real_position;
end;
procedure OnStartup;
begin
//Playlist(0).LoadFromM3U(‘C:\Playlists’ + FormatDateTime(‘ddd dd mm - hh’, now) + ‘.m3u’);
Temporary_playlist := Factory.CreatePlaylist;
Temporary_playlist.LoadFromFile(LOGS_PATH + FormatDateTime(‘yyyymmdd’, now) + ‘.m3u’);
First_item_pos:= Search_playlistItem_position(Temporary_playlist);
SystemLog(IntToStr(First_item_pos));
{PlaybackControl(0).SetAutomation(true);
CurrentPlaylist.Assign(Temporary_playlist);
First_item:= CurrentPlaylist.GetItem(First_item_pos);
PlaybackControl(0).AutomationJump(iFirst_item);
PlaybackControl(0).AutomationJumpSoft(First_item);
//PlaybackControl(0).AutomationPlay;}
end;
begin
end.[/code]
At the end, I made a display of the calculated position (unlikely always 0). I commented remaining instructions at the moment for test.