Complete PHP and HTML scripting...

Hey,

I’m trying to build a script that will show information about what is currently, just been and is about to be played. I think I’ve seen a script that does this, but I don’t know where.

I’ve managed to adapt the script NowPlayingHTML.mls to a php script, so that it will provide me with variables, instead of text. This way the website can use the information however it likes:

[code]procedure OnPlayerStart(PlayerControl: IPlayerControl; Item: IPlaylistItem);
var sl: TStringList;
begin
sl := TStringList.Create;
sl.Add(’<?php’);
sl.Add(’$track = “’ + Item.GetTitle + '”;’);
sl.Add(’$artist = “’ + Item.GetArtist + '”;’);
sl.Add(’?>’);
sl.SaveToFile(‘c:\NowPlaying.php’);
sl.Free;
end;

begin
end.[/code]

But what I would like to have, is something that would show what is about to be played, what has just been played, how long the tracks are, the album, etc, etc…

What are the variables I would need for that?

Earl

Indeed there was, do you mean this one ?

I also took a script like that and had a tweak, this is what I have on my PC although I don’t actually use it and some of the scripting may be out of date:

[code]procedure OnPlayerStart(PlayerControl: IPlayerControl; item: IPlaylistItem);
var sl: TStringList;
idx, i: Integer;
pi: IPlaylistItem;
begin
idx := CurrentPlaylist.IndexOf(item);
if idx = -1 then begin
SystemLog(‘Sorry, there has been an error with the Playlist …’);
exit;
end;

sl := TStringList.Create;
sl.Add(’<?php’);
i := 0;
while (idx < CurrentPlaylist.GetCount) and (i < 5) do begin
pi := CurrentPlaylist.GetItem(idx);
if not pi.GetHistoryFlag then begin
sl.Add(’$playa’ +(IntToStr(i)) + ‘="’ + pi.GetArtist + ‘";’);
sl.Add(’$playb’ +(IntToStr(i)) + ‘="’ + pi.GetTitle + ‘";’);
// sl.Add(’$playc’ +(IntToStr(i)) + ‘="’ + FormatDateTime(‘hh:mm:ss’, (pi.GetDuration/10000000)/(246060)) + ‘";’);
// sl.Add(’$playd’ +(IntToStr(i)) + ‘="’ + FormatDateTime(‘hh:mm:ss’, pi.GetStartTime)+ ‘";’);
i := i + 1;
end;
idx := idx + 1;
end;
sl.Add(’?>’);
sl.SaveToFile(‘S:\nowplaying\comingup.php’);
sl.Free;
end;

begin
end.[/code]

Should give you a headstart, anyway!

Hi!

Thanks for that, seems your script is just what I need.

The linked script seems to just throw up a load of errors, not sure how to fix them…

Thanks again!

Earl