Now Playing & On Air

Is there a line that I can add to this script so it will only run if the machine is in an ‘on air’ state?

For example if the station is ‘off air’ and someone is playing around then the script will not export the now playing information to the website.

[code]procedure OnPlayerStart(PlayerControl: IPlayerControl; Item: IPlaylistItem);
var sl: TStringList;
begin
sl := TStringList.Create;
sl.Add(Item.GetArtistsString + ’ - ’ + Item.GetTitle);
sl.SaveToFile(‘C:\nowplaying\nowplaying.php’);
sl.Free;
end;

begin
end.
[/code]

Chris.

In fact it’s this script I am running, not the previous posting… ;D

[code]{-------------------------------------------------------------------------------
NotPlayingHTML.mls - Notification Script for mAirList

Writes a HTML page with the currently playing sing.

Author: Torben Weibert tw@mAirList.com
Date: 2010-01-19

See http://www.mAirList.com for further information.
-------------------------------------------------------------------------------}

procedure OnPlayerStart(PlaylistIndex: integer; PlayerIndex: integer; Item: IPlaylistItem);
var
sl: TStringList;
begin
sl := TStringList.Create;
try
sl.Add(’’);
sl.Add(‘Now Playing’);
sl.Add(’’);
sl.Add(’’);
sl.Add(’’);
sl.Add(’’);
sl.Add(’’);
sl.Add(’’);
sl.Add(’ ’ + Item.GetArtistsString + ’ - ’ + Item.GetTitle + ’ ‘);
sl.Add(’
’);
sl.SaveToFile(‘e:\apps\nowplaying\nowplaying.php’);
finally
sl.Free;
end;
end;

begin
end.
[/code]

Just add the following line at the beginning of the procedure (after the initial “begin”):

if not Instance.GetOnAir then exit;