Track update on an event

Hi,

I’m not sure if this falls into the realms of scripts, but I’m wondering if it is possible to do the following.

Like most playout software, mairlist can update the “now playing” details to Shoutcast and other service providers based on the current playing item, but can it do it on an event.

Here’s an example of what I’m trying to do. Say I have an event like a live feed via a line input, could mairlist be setup to push a customer Track Artist/Title to shoutcast when the event is triggered?

Reason is I plan to syndicate the “now playing” details to TuneIn api, as well as my own website. On my site I use it to trigger some events too, displaying content to users based on the “now playing” info.

In v5.1, you can use a script like this:

begin
  Instance.GetLogger.CurrentTitleLog(nil, '', 0, '', 'New title');
end.

The first four parameters are only used internally, you can ignore them. The last parameter is the stream title which will be propagated to all active outgoing Shoutcast/Icecast connections.

Extend the script so it reads the title from a text file:

var
  sl: TStringList;

begin
  sl := TStringList.Create;
  try
    sl.LoadFromFile('c:\nowplaying.txt');
    if sl.Count > 0 then 
      Instance.GetLogger.CurrentTitleLog(nil, '', 0, '', sl[0]);
  finally
    sl.Free;
  end;
end.

Call that in a loop from the event scheduler.

Even more advanced, now as a background script with a 10s timer, and caching the last title to prevent unnecessary updates:

var
  lastTitle: string;

procedure OnTimer;
var
  sl: TStringList;
begin
  sl := TStringList.Create;
  try
    sl.LoadFromFile('c:\nowplaying.txt');
    if (sl.Count > 0) and (sl[0] <> lastTitle) then begin 
      Instance.GetLogger.CurrentTitleLog(nil, '', 0, '', sl[0]);
      lastTitle := sl[0];
    end;
  finally
    sl.Free;
  end;
end;

procedure OnLoad;
begin
  lastTitle := '';
  EnableTimer(10000); // every 10 seconds
end;

begin
end.

(None of these scripts have been tested, just hacked them here into the forum.)