I’m starting to write some scripting code which will ideally use start times of Items in Playlists, but running the code below gives bizarre results:
var
i, iMax: integer;
pi: IPlaylistItem;
s: string;
begin
iMax := CurrentPlaylist.GetCount - 1;
for i := 0 to iMax do
begin
pi := CurrentPlaylist.GetItem(i);
s := 'Item ' + IntToStr(i) + ' times: Fixed=';
s := s + FormatDateTime('hh:nn:ss ', pi.GetStartTime(sttFixed));
s := s + ' Plan=' + FormatDateTime('hh:nn:ss ', pi.GetStartTime(sttPlanned));
s := s + ' Est=' FormatDateTime('hh:nn:ss ', pi.GetStartTime(sttEstimated));
s := s + ' Real=' FormatDateTime('hh:nn:ss ', pi.GetStartTime(sttReal));
SystemLog(s);
end;
end.
In all cases, and whether in AUTO/playing, AUTO/stopped, ASSIST/playing, and ASSIST/idle, I see the following results:
[ul][li]Fixed times return a value of 00:00:00 if the Item does NOT have a Fixed time (hopefully you can see why this could cause enormous problems? :o)[/li]
[li]Planned times always return a value of 00:00:00 (same problem as with Fixed times).[/li]
[li]Estimated and Real times always return a value of [empty string] (after being formatted by FormatDateTime!).[/li][/ul]
It looks like Estimated and Real (presumably Real is an already-past Start Time, i.e. for Items already played/playing but still shown as History Items in the Playlist?) simply don’t return any value at all. It doesn’t seem to matter if the Item is playing, cued, stopped, or already played.
Fixed does return correct values if the Item has one, though I’m not sure what to write to find the type (soft, fixed) of ‘fixed’ time? BUT if the Item DOES NOT have any ‘fixed’ time, whatever is returned works out as 00:00:00, i.e. midnight. I strongly suggest it would be better to return nil (or should that be null?) for ANY GetStartTime if a time genuinely does not exist; returning (presumably zero?) the equivalent of midnight could lead to some horrible problems!
Is there a difference between Estimated start time and Planned start time? I’m confused as to the exact meaning of each of the four stt enumerations.
Slightly off-topic, but there also does not seem to be any way for a script to find out the Category (File, Dummy, Command, etc.) of a PlaylistItem, or am I being stupid again?!! That would be another huge help (for example, I might want to process only COMMANDs or BREAKs).
Finally, am I right in thinking that IPlaylist.Delete(iItem) is the correct way to Delete (remove) a PlaylistItem from a Playlist? I need to be sure of that before I write any scripts which delete any current Playlist items which would start after the ‘top of hour’ before Appending the next hour’s music etc.
BFN
CAD