|
|
#1 |
|
Junior Member
Join Date: Jan 2001
Posts: 15
|
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...
|
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Feb 2003
Location: NYC Metro
Posts: 209
|
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
|
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jan 2001
Posts: 15
|
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...??
|
|
|
|
|
|
#4 | |
|
Moderator Alumni
Join Date: May 2000
Location: Next Door
Posts: 8,942
|
Quote:
-Jay | Radio Toolbox.com |
|
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Jan 2001
Posts: 15
|
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!
|
|
|
|
|
|
#6 |
|
Moderator
Join Date: Apr 2000
Posts: 4,491
|
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 |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Jan 2001
Posts: 15
|
OK!
but how would can I get it through XML or the admin-page? |
|
|
|
|
|
#8 |
|
Moderator
Join Date: Apr 2000
Posts: 4,491
|
|
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Jan 2001
Posts: 15
|
Thanx! I'll check it out!
|
|
|
|
|
|
#10 |
|
Junior Member
Join Date: Jan 2001
Posts: 15
|
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 |
|
|
|
|
|
#11 |
|
Moderator
Join Date: Apr 2000
Posts: 4,491
|
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 |
|
|
|
|
|
#12 |
|
Junior Member
Join Date: Jan 2001
Posts: 15
|
no biggie... I'll just give a f***
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|