Now playing for player 1

Hello,

Im looking for a script that saves the now playing info to a txt file. The script should only work for player 1…

Thanks!
Joris

I’m fairly sure that scripts already exist to do this.

Do a search in this forum for “now playing script” and let us know if that didn’t help.

BFN
Cad

Hi,

If i use this script:

[code]procedure OnPlayerStart(Playlist0: integer; PlayerIndex: integer; Item: IPlaylistItem);
var
sl: TStringList;
begin
item := Playlist(0).GetPlayer(PlayerIndex).GetItem;
if Instance.GetOnAir = True then begin
sl := TStringList.Create;
sl.Add(’’ + Item.GetArtist + ‘’ + ’ - ’ + ‘’ + Item.GetTitle + ‘’);
sl.SaveToFile(‘D:\Users\Joris\Desktop\RDS.txt’);
sl.Free;
end;
end;

begin
end.[/code]

It works. But i get still a error…:

Runtime error "Null Pointer Exception" in notification script D:\Users\Joris\Desktop\nu1.mls (line 8, column 9) handling message: 

Joris

Try to remove the line “item := Playlist(0).GetPlayer(PlayerIndex).GetItem;”.

There’s no need to retrieve the item again from the player, as it is already passed as a parameter to the procedure.

Hi Torben,

If i delete the line there is no error anymore but its still gets the data from all playlist’s. Not only from Playlist 1…

Joris

Try this:

[code]procedure OnPlayerStart(Playlist0: integer; PlayerIndex: integer; Item: IPlaylistItem);
var
sl: TStringList;
begin
if Playlist0 = 0 and PlayerIndex = 0 then begin
if Instance.GetOnAir = True then begin
sl := TStringList.Create;
sl.Add(’’ + Item.GetArtist + ‘’ + ’ - ’ + ‘’ + Item.GetTitle + ‘’);
sl.SaveToFile(‘D:\Users\Joris\Desktop\RDS.txt’);
sl.Free;
end;
end;
end;

begin
end.
[/code]

BFN
Cad

I get an (5:42): Type mismatch error…

Joris

Add parentheses:

if (Playlist0 = 0) and (PlayerIndex = 0) then begin

D’OH! :-[

How stupid of me! I always get that wrong in mAirList Script!

Sorry about that: and Torben is correct.

BFN
Cad

Nice! It’s working fine.

Is it also possible to get the next playing song and the previous played song written into the file?
In the settings i’ve set “numbers to keep in the playlist history” to 2.

I have test the script but it also write station ID to the file. Is there a way so it only write music to the file?

//Joakim

Actually you can do this without any script in the current versions - the file logging has an “overwrite” option. And you get the nice item type filter.

where we find it ?