[icecast-dev] ice-metadata header incomplete?

msmith@labyrinth.net.au
Fri, 06 Aug 2004 14:57:29 -0000

Colin Snover <colin@zetafleet.com> said:

>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I'm trying to write a PHP script that communicates with the Icecast2
server
> directly to retrieve current song information. Since the documentation for
> the ICE/SHOUT protocol is, frankly, pretty much non-existant, I did a
search
> on Google and eventually came up with this site:
> 	http://www.smackfu.com/stuff/programming/shoutcast.html
>

If you're streaming mp3, and your streaming client supports setting metadata
on icecast2 servers (this requires, among other things, a version of icecast2
no more than two weeks old. I know of no source clients other than very recent
versions of oddsock that can do this correctly), then this should work.

However, this is horrifically inefficient - you're getting the entire stream
even though you're interested solely in the metadata. It also only works for
mp3.

If you're streaming ogg vorbis, then the metadata is transmitted in the
actual
ogg vorbis data, according to the specification. You can read the
specification for details on how to make use of this.

A better way to do this is to request /admin/stats.xml from the server, and
parse the information you're interested in out of this (I think it's
included,
though I haven't checked). You'll need to authenticate to get this
document,
with username "source", and whatever password you have configured.

Mike