Script for..... Now Playing... sort of

Hi Dears,

Is there a way to change the Metadata given to the stream when one of the two players stopped playing. Sometimes I want to play a record but the metadata is still on the last played song out of one of the players. A more generic text would be cool then.

Thans Wilbert

Well, it requires some effort: As there’s no way to send content to the logger directly, you’d have to employ a silence item as a ”playable dummy“ which carries the desired text, to be started in parallel with the record player.

Ah… Yes… that was what I already did… Just wanted to automate that… Lazy as I am.

THX

We’ve had that before … a very copmplex task, if the metadata has to correspond to the record playing. A little less complicated if only a standard message is to be sent. Anyway, you had to put up some device which triggers the turntable and mAirList simultaneously.

Wilbert, this script should do what you intended: If a command (to be selected, here: EXTERNAL) is launched, a silence item (title and artist to be selected) of a reasonable duration (to be selected, here 15 seconds; in any case longer than the logging delay of your system) is loaded in a player and started automatically.

const
  TITLE       = 'No metadata at the moment';  // Set title part of message
  ARTIST      = 'We will be back soon';       // Set artist part of message
  
  EXTCOMMAND  = 'EXTERNAL';                   // Set command for triggering
  EXTDURATION = 15;                           // Set duration of item

procedure OnExecuteCommand(Command: string);
var
  NextIndex: integer;
  spi: ISilencePlaylistItem;
  pi:  IPlaylistItem;
begin
  if Command = EXTCOMMAND then
  begin
    spi := Factory.CreateSilencePlaylistItem;
    pi := spi;
    pi.SetTitle(TITLE);
    pi.SetArtist(ARTIST);
    pi.SetDuration(EXTDURATION);
    pi.SetAmplification(-12);
    pi.SetItemType(pitMusic);
    CurrentPlaylist.BeginUpdate;
    try
      CurrentPlaylist.Insert(CurrentPlaylist.GetNextIndex, pi);
    finally
      CurrentPlaylist.EndUpdate;
    end;
    while CurrentPlaybackControl.
      GetPlayer(CurrentPlaybackControl.GetPlayerOfItem(pi)).
      GetState = psLoading do 
      Sleep(100);
    CurrentPlaybackControl.GetPlayer(CurrentPlaybackControl.GetPlayerOfItem(pi)).
      ExecutePlayerCommand(pcStart);
  end;
end;

begin
end.

However, you have to take measures to trigger the turntable and mAirList in sync. And it could well be that the script is working only from v7.1 on.

Hi Tondose,

Nice, I will play around with it. Superthanks…

Cheerio Wilbert