Thomas B. Rücker
2019-Sep-15 08:11 UTC
[Icecast] Best method of grabbing Now Playing metadata with PHP?
Hi, On 9/14/19 5:56 PM, Thomas B. Rücker wrote:> Hi, > > On 9/12/19 9:05 PM, Richard G Elen wrote: >> Hi... >> >> Can someone do me the favour of pointing us at a routine, library, >> script or technique that will grab Now Playing metadata (Title, >> Artist, Album) remotely (ie from another machine) from an Icecast >> 2.4.x server reliably for logging purposes, preferably using PHP? >> >> Ideally we would grab the metadata when it changes - all the methods >> we've tried so far require us to poll the server so have not been as >> accurate as we would like. > > I'd look at the playlist.log, if you can access the logs for your > Icecast server and configure it. > > >> But there seem to be plenty of systems out there - Online Radio Box >> for example - that manage to get the start time exactly right, so it >> must be possible. > > You can just ingest the actual stream, but somehow I doubt you actually > require *that* level of accuracy.If for some reason you do want to explore such a path, you might want to look at the STATS stream instead. It will give you a comprehensive flow of data in real time and if necessary you can use it to trigger requests for further data from e.g. the JSON endpoint.> Polling the /status-json.xsl every few seconds and looking for changes > should work just as well. > > >> I'm not a programmer - I deal with music licensing mainly - so I will >> be passing details you give me on to our developer who is great on >> databases but not so good on the ins and outs of getting data out of >> Icecast. Needless to say, I have ploughed through the documentation >> provided but I evidently need something a bit more basic. > > Maybe you should consider directing them to this mailing list. It might > be possible to come up with a simpler solution in technical discussion.Cheers, TBR
Robert Jeffares
2019-Sep-15 21:31 UTC
[Icecast] Best method of grabbing Now Playing metadata with PHP?
Hi Thomas, I use a program called streamgrabber which will record an mp3 stream and produce a .cue file which contains the data you seek. The .cue is a basic text file. This is a sample.. TRACK 01 AUDIO TITLE "xxx" PERFORMER "xxx" INDEX 01 00:00:00 TRACK 02 AUDIO TITLE "xxxS" PERFORMER "xxx" INDEX 01 04:15:00 TRACK 03 AUDIO TITLE "xxx" PERFORMER "xxx" INDEX 01 05:56:00 Once you have the metadata you can manage it as you wish. I run it from a shell script which is set up to record an hour at a time. I don't use streamgrabber to get the metadata, I use it for a logger, the cue file is a by product. You may need to run it on your stream to make sure it gets the data you seek. I run on a Ubuntu server it also runs on Windows https://sourceforge.net/projects/streamgrabber/ hopefully it solves your problem. regards Robert
Richard Elen
2019-Sep-16 08:13 UTC
[Icecast] Best method of grabbing Now Playing metadata with PHP?
Hi... A thank-you to everyone who's provided suggestions on this topic here. As a result we have several approaches to build on. I'm very grateful for the assistance of respondents to this list. Best, --Richard E