Richard G Elen
2019-Sep-12 21:05 UTC
[Icecast] Best method of grabbing Now Playing metadata with PHP?
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. 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. 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. MANY thanks in advance for any help you can provide - and my apologies for my lack of knowledge and for having to ask such an apparently basic question. --Richard E
Fred Gleason
2019-Sep-12 22:49 UTC
[Icecast] Best method of grabbing Now Playing metadata with PHP?
On Thu, 2019-09-12 at 22:05 +0100, Richard G Elen wrote:> 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?You may want to take a look at GlassPlayer: https://github.com/RadioFreeAsia/GlassPlayer While (as the name implies) it is primarily an audio stream player, when invoked with the '--metadata-out --json' options, GlassPlayer will emit a JSON-formatted update each time stream metadata changes. It derives these updates from the audio bitstream itself --i.e. no polling of or interaction with the IceCast administrative interface whatever is required. For example: *** snip snip *** [fredg at elastigirl ~]$ glassplayer --metadata-out --json http://streamer.example.com:8000/SomeMountpoint { "Metadata": { "icy-url": "stream.example.com", "icy-name": "WXYZ", "icy-genre": "Various", "icy-description": "WXYZ Stream" } } { "Metadata": { "StreamTitle": "Do It Again - Steely Dan" } } *** snip snip *** Cheers! |---------------------------------------------------------------------| | Frederick F. Gleason, Jr. | Chief Developer | | | Paravel Systems | |---------------------------------------------------------------------| | There is only one thing worse than having your competitors trying | | to inter-operate with your systems - and that is to have your | | competitors *not* trying to inter-operate with your systems. | | | | -- Alan(UK), GrokLaw.net | |---------------------------------------------------------------------|
Martin Harrison
2019-Sep-13 06:03 UTC
[Icecast] Best method of grabbing Now Playing metadata with PHP?
<div dir='auto'>One way is to put a admin.cgi file on the icecast server to catch the metadata from a source and then forward to icecast and your other purposes. <div dir="auto">Another is to look at the icecast playlist log file.</div><div dir="auto">Another would be to poll the icecast status XML or JSON page.</div><div dir="auto">Or you could receive and decode the actual stream.</div><div dir="auto">I don't believe there is a hook from icecast like the connect and disconnect hooks.</div></div>
Richard Elen
2019-Sep-13 15:04 UTC
[Icecast] Best method of grabbing Now Playing metadata with PHP?
Hi, Fred... Many thanks for the suggestion! If we simply want to output metadata as you describe, how much,if any, of the prerequisites described in https://github.com/RadioFreeAsia/GlassPlayer/blob/master/INSTALL can we dispense with? We are dealing with a shared hosting system for the host so installing the bare minimum would be a good idea (especially as we may have to ask the provider to do it! The streaming server is a dedicated machine, but the logging system we need to run this on is shared hosting). Thanks, --Richard E On 12-Sep-19 23:49, Fred Gleason wrote:> You may want to take a look at GlassPlayer: > https://github.com/RadioFreeAsia/GlassPlayer > > While (as the name implies) it is primarily an audio stream player, > when invoked with the '--metadata-out --json' options, GlassPlayer will > emit a JSON-formatted update each time stream metadata changes. It > derives these updates from the audio bitstream itself --i.e. no polling > of or interaction with the IceCast administrative interface whatever is > required.
Thomas B. Rücker
2019-Sep-14 17:56 UTC
[Icecast] Best method of grabbing Now Playing metadata with PHP?
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. 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.
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