| View previous topic :: View next topic |
| Author |
Message |
WAB
Joined: 29 Aug 2007 Posts: 27
|
Posted: Wed Aug 29, 2007 4:37 pm Post subject: Some usefull hints I'd like to know... |
|
|
Hi, we've been using in our radio station icecast for streaming for some time and it's sure a good one. But I think it's time we get a bit deeper. Of course help is appreciated...
1) we want to show the sum of the people listening via icecast in our web
2) could we have some kind of a script in our web summing the listeners without reseting every time our icecast server gets offline?
3) 1 PC is using winamp, the sound mixes in a console and ends up in the server PC running icecast. Could we somehow show the track we're playing in our web? Having in mind we're using MuSE ver. 0.9.2 can we show in the listener's player which track we're playing at the moment?
Thanks |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Wed Aug 29, 2007 11:03 pm Post subject: |
|
|
You can always get a backend script to query the stats from icecast, that could then be used to help generate your own web pages. As for the track information this depends on many factors, format, if mp3 then is metadata insertion requested, is metadata sent to icecast etc
karl. |
|
| Back to top |
|
 |
Anonymous Guest
|
Posted: Fri Aug 31, 2007 9:48 am Post subject: |
|
|
Check http://yoururl.tld:port/admin/stats.xml (e.g. http://yourradio.com:8000/admin/stats.xml)
There you find all the information you need..
A lil php-function for parsing this page could be:
| Code: |
function getIce( $host, $port, $mount, $user, $passwd ) {
$error = false;
$fp = fsockopen( $host, $port, $errno, $errstr, 10 );
if ( !$fp ) {
$error = $errstr ."(". $errno .")";
} else {
fputs( $fp, "GET /admin/stats.xml HTTP/1.1\r\n" );
fputs( $fp, "Host: ". $host ."\r\n" );
fputs( $fp, "Authorization: Basic ".base64_encode("$user:$passwd")."\r\n" );
fputs($fp, "User-Agent: Mozilla\r\n");
fputs( $fp, "Connection: close\r\n\r\n" );
$xml = "";
while ( !feof( $fp ) ) {
$xml .= fgets( $fp, 512 );
}
fclose($fp);
if ( stristr( $xml, "HTTP/1.0 200 OK" ) == true ) {
$xml = trim( substr( $xml, 42 ) );
} else {
$error = "Bad login";
}
if ( !$error ) {
$res = array();
preg_match( "/\<icestats\>(.*?)\<\/icestats\>/", $xml, $parser );
preg_match( "/\<source mount=\"\/". $mount ."\"\>(.*?)\<\/source\>/", $parser[1], $parser );
preg_match( "/\<listeners\>(.*?)\<\/listeners\>/", $parser[1], $d );
$res["listeners"] = $d[1];
preg_match( "/\<max_listeners\>(.*?)\<\/max_listeners\>/", $parser[1], $d );
$res["max_listeners"] = $d[1];
preg_match( "/\<title\>(.*?)\<\/title\>/", $parser[1], $d );
$res["title"] = $d[1];
} else {
$res = false;
}
}
return $res;
}
|
And yes: This could be done way better than I did in the example above..
Cheers,
stimpy |
|
| Back to top |
|
 |
WAB
Joined: 29 Aug 2007 Posts: 27
|
Posted: Sun Sep 02, 2007 5:06 pm Post subject: This seems neat... |
|
|
| I'll check it as soon as possible. Thanks a lot. As for the mp3s let's say all requirements are met. Then what??? |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group subRebel style by ktauber
|