![]() |
duration of song...?
is it possible to get the duration of the song from shoutcast using php? and if... How?
Or does this only work with SAM... :igor: |
yes there are several neat little things you can use to do this, check out radiotoolbox, you will find the link in the FAQ's
|
I'm actually looking for just a php-script, I can include in my original script... (A script showing track-name etc...) All I'm missing is the script for the duration of the song (Mins, seconds) to show up... But I don't know how to get this from the server...??
|
Quote:
|
here's a code sniplet I use...
// Connect to server $fp=fsockopen($host,$port,&$errno,&$errstr,10); if (!$fp) { echo "error in fsockopen<br>\n$errno - ($errstr)<br>\n"; } // Get data from server fputs($fp,"GET /7 HTTP/1.1\nUser-Agent:Mozilla\n\n"); // exit if connection broken for($i=0; $i<30; $i++) { if(feof($fp)) break; $fp_data=fread($fp,31337); usleep(500000); } // Strip useless junk from source data $fp_data=ereg_replace("^.*<body>","",$fp_data); $fp_data=ereg_replace("</body>.*","",$fp_data); // Place values from source into variable names list($current,$status,$peak,$max,$reported,$bit,$song,) = explode(",", $fp_data); where exactly would I find the duration and how would I convert it to mins, secs...? Hope you can help!:eek: |
SHOUTcast doesn't report the song length. The best you can do with the data SHOUTcast provides is determine the song length of previously played files by subtracting playedat times.
Tom |
OK!
but how would can I get it through XML or the admin-page? |
|
Thanx! I'll check it out!
|
Okay... the XML grabber worked to get the current playing, listener info etc... but how can I make it show the duration (how many mins, secs) of song...
Ex: Now playing: Eminem - 8 mile Track length: 6:00 |
As I said earlier you will not be able to determine the length of the currently playing track, however by subtracting playedat times you can get the duration of previously played tracks.
Tom |
no biggie... I'll just give a f***
|
| All times are GMT. The time now is 16:12. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.