Search code examples
pythondjangostreamicecastinternet-radio

Title of icecast stream (without status.xsl)


I try to have the title (artist - song) for some icecast streams. There are lot of discussion about it here and most of them just check the status.xsl (like Icecast Now Playing PHP script does).
But :
- lot of stream does not allow another script to read this file (for example
http://95.81.147.3/status.xsl?mount=/fip/all/fiphautdebit.mp3 )
- as ePirat says a lot, it is not safe to parse html like this. But he proposes a solution only when we have access to the server.

From what I read : there is metadata in icecast stream itself but the solution give works only for shoutcast. So as for this link.
The closest thing i found is this code review but although the title says icecast i just see shoutcast code with the Icy-MetaData check.

This very complete link can be useful (The out-of-band standards section) but it is explained that is does not work still.

The question is basically : in order to get the Artist - song information, how to read metadata of an icecast stream, when :
- I'm not admin of the server
- I don't want / can't parse the status.xsl ?

Thanks for your help


Solution

  • Since Icecast 2.4 the preferred way to get machine readable meta-data about the streams running through a server is status-json.xsl. This JSON API is default enabled on all installations.

    If status-json.xsl returns a 404, then the server administrator has consciously chosen to disable access. In such a case and in case of old Icecast installations (2.3.x) that won't be retrofitted with the JSON API (it would be enough for the administrator to copy status-json.xsl and xml2json.xslt to the web directory) the approach of trying to parse the stream itself for metadata is an ugly but possible one. One has to wonder though if the administrator has chosen to disallow metadata access, if they are OK in general with use of their stream beyond simple listening.