Now playing in TXT file

I want to export the song that is currently playing in a text file (txt extension) so that I can display it in Twitch when I am streaming.

Does someone has a script for this? I am a total novice when it comes to scripting in mAirlist.

So the only thing that needs to be in the TXT file is for example: Abba - Dancing Queen
That is the only thing that needs to be displayed.

I hope you can help me!

You can use simple logging in a text file with overwriting at each new entry.

Where can I find this? I’ve looked in “Configuration” -> Logging -> Add. But what do I have to choose?

And do I need to do something else? Sorry for asking all this but I’m a novice when it comes to this kind of stuff.

Radio automation, database, playlist, layout and so on I have no problem with but this is a bit out of my league I’m afraid :wink:

Ivan

Sorry, took a while… mAirList PC was sleeping. :zzz:
“Turn It On Again” (Genesis, 1980) :sunglasses:

Please follow these screenshots:


In the dialog you must create a txt-file and set to “Overwrite this file each time a log entry is written”.
UTF-8 is recommended if some characters may cause trouble.

Line format %a - %b gives you…

A list of logging variables can be found here:
https://wiki.mairlist.com/reference:logging_variables

If you only want to log music items but no jingles, station-ids etc., please use the filter function.
Test & try it to find the best log for your stream. Have fun!

Thank you @UliNobbe! This did the job!

Thanks for the help!

Ivan

1 Like

Unfortunately the logging is not working for external streams passing through. They can update the Encoder but are not passed over to the logging interface.
Neither on streams within a player nor on streams via stream monitor.

// Called when metadata is received from a (relayed) stream
procedure OnItemMetadata(Item: IPlaylistItem; Metadata: string);
var
  sl: TStringList;
begin
  sl := TStringList.Create;
  try
    sl.Add(Metadata);
    sl.SaveToFile('C:\sometextfile.txt');
  finally
    sl.Free;
  end;
end;

EDIT: Or even easier with mAirList’s ref-counted IStrings interface:

// Called when metadata is received from a (relayed) stream
procedure OnItemMetadata(Item: IPlaylistItem; Metadata: string);
var
  sl: IStrings;
begin
  sl := Factory.CreateStrings;
  sl.Add(Metadata);
  sl.SaveToFile('C:\sometextfile.txt');
end;
2 Likes

Thanks, is there a way to trigger any built in Logging, that is already configured, to have the same output as if a player is running?
I want the relayed stream, so there is no need to maintain various scripts fot various logging outputs. One of my customers is using http get logging or mySQL logging. I did not double check.

The problem is that the logging interfaces uses all the invidual item properties (artist, title, duration, etc.) to specify the output format. Whereas the incoming stream data is a just a plain string. Before that could be passed to the logging system, we would need to find a good way to split that back into artist, title etc. Not so easy in the general case.

Ok, I will double check, how they actually insert the Data.
I assume in this case they use httpGet, and I can pass it 1:1 there.