This update includes a check of mAirList’s “OnAir status” - useful for when you’re pre-recording shows or do not want details to be uploaded.
[code]// Intelligent Now Playing Script v2
// by Charlie Davy
// last modified 16th January 2009
// This script examines each audio item played via a Player and performs a task based upon the track’s length.
// The 3 settings below work for most situations, however you can fine-tune them if you wish.
// The last.fm links work for most artist/groups - it adds a nice touch, I think.
// Update: The OnAir switch is considered within this script, if you are “Off Air”, this script does nothing.
// If you are “On Air”, the script runs as normal. Useful in a multi-studio environment where pre-recorded
// shows may interfer with your live “now playing” display!
// IMPORTANT!! You MUST rename this file to .mls when adding it to mAirListConfig
const
IDENT = 900000000; // 90 seconds
MUSIC = 900000000; // 90 seconds
PRE_REC = 4200000000; // 7 minutes
procedure OnPlayerStart(PlayerControl: IPlayerControl; Item: IPlaylistItem);
var sl: TStringList;
begin
if Engine.GetOnAir = False then begin
SystemLog(‘mAirList is in production mode, so no action taken…’);
// Let’s ignore any track that has the “Exclude from Logging” option enabled
end else if (pioNoLogging in Item.GetOptions) then begin
sl := TStringList.Create;
sl.Add(‘Sorry, no details available for this item…’);
sl.SaveToFile(‘C:\nowplaying.php’);
sl.Free;
HTTPGetAsync(‘http://server:port/admin.cgi?pass=password&mode=updinfo&song=See our website for information’);
SystemLog(‘This item will not be logged…’);
// If the track is over 7 minutes, assume it’s a pre-recorded programme
end else if (Item.GetDuration > PRE_REC) then begin
sl := TStringList.Create;
sl.Add(‘Sorry, no details available for this item…’);
sl.SaveToFile(‘C:\nowplaying.php’);
sl.Free;
HTTPGetAsync(‘http://server:port/admin.cgi?pass=password&mode=updinfo&song=See our website for information’);
SystemLog(‘This item is a pre-record or longer than 7 minutes…’);
// If the track is more than 90 seconds, assume it’s a song
end else if (Item.GetDuration > MUSIC) then begin
sl := TStringList.Create;
sl.Add(’’ + Item.GetArtist + ’ - ’ + Item.GetTitle);
sl.SaveToFile(‘C:\nowplaying.php’);
sl.Free;
HTTPGetAsync(‘http://server:port/admin.cgi?pass=password&mode=updinfo&song=’ + Item.GetArtist + ’ - ’ + Item.GetTitle);
SystemLog('Now Playing… ’ + Item.GetArtist + ’ - ’ + Item.GetTitle);
// If the track is under 90 seconds, assume it’s an advert or jingle
// You may wish to comment this section out as sending this info for such a short time may seem pointless!
end else if (Item.GetDuration < IDENT) then begin
sl := TStringList.Create;
sl.Add(‘More music soon’);
sl.SaveToFile(‘C:\nowplaying.php’);
sl.Free;
HTTPGetAsync(‘http://server:port/admin.cgi?pass=password&mode=updinfo&song=More Music Soon’);
SystemLog(‘Playing Adverts or Jingles…’);
end;
end;
begin
end.[/code]