I am sending metadata from automation software to shoutcast using PHP. The streaming metadata displays a '+' at every space between artist and title e.g., (The+Cure++Boys+Dont+Cry).
Any ideas of how to change PHP code to remove the '+' from the metadata?
Thanks
The local file options are a text file in the following format:
Title: United States of Whatever
Artist: Liam Lynch
Album:
Time: 01:28
or
html file:
Title: United States of Whatever
Artist: Liam Lynch
The php code I use is:-
$serv["host"][] = "shoutcast server IP";
$serv["port"][] = "shoutcast server port";$serv["passwd"][] = "shoutcast server password";
while(1)
{
$t=time();
clearstatcache();
$mt=@filemtime(songfile);
if ($mt===FALSE || $mt<1)
{
echo "file not found, will retry in 5 seconds";
sleep(5);
continue;
}
if ($mt==$lastmtime)
{
//file unchanged, will retry in 5 seconds
sleep(5);
continue;
}
$da="";
$f=@fopen(songfile, "r");
if ($f!=0)
{
$da=@fread($f, 4096);
fclose($f);
@unlink(songfile);
}
else
{
echo "error opening songfile, will retry in 5";
sleep(5);
continue;
}
$lastmtime=$mt;
for($count=0; $count < count($serv["host"]); $count++)
{
$mysession = curl_init();
curl_setopt($mysession, CURLOPT_URL, "http://".$serv["host"][$count].":".$serv["port"][$count]."/admin.cgi?mode=updinfo&song=".urlencode(trim($da)));
curl_setopt($mysession, CURLOPT_HEADER, false);
curl_setopt($mysession, CURLOPT_RETURNTRANSFER, true);
curl_setopt($mysession, CURLOPT_POST, false);
curl_setopt($mysession, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($mysession, CURLOPT_USERPWD, "admin:".$serv["passwd"][$count]);
curl_setopt($mysession, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($mysession, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt($mysession, CURLOPT_CONNECTTIMEOUT, 2);
curl_exec($mysession);
curl_close($mysession);
}
echo "song updated";
sleep(5);
}
?>
Any ideas of how to change PHP code to remove the '+' from the metadata?
Thanks
The local file options are a text file in the following format:
Title: United States of Whatever
Artist: Liam Lynch
Album:
Time: 01:28
or
html file:
Title: United States of Whatever
Artist: Liam Lynch
The php code I use is:-
$serv["host"][] = "shoutcast server IP";
$serv["port"][] = "shoutcast server port";$serv["passwd"][] = "shoutcast server password";
while(1)
{
$t=time();
clearstatcache();
$mt=@filemtime(songfile);
if ($mt===FALSE || $mt<1)
{
echo "file not found, will retry in 5 seconds";
sleep(5);
continue;
}
if ($mt==$lastmtime)
{
//file unchanged, will retry in 5 seconds
sleep(5);
continue;
}
$da="";
$f=@fopen(songfile, "r");
if ($f!=0)
{
$da=@fread($f, 4096);
fclose($f);
@unlink(songfile);
}
else
{
echo "error opening songfile, will retry in 5";
sleep(5);
continue;
}
$lastmtime=$mt;
for($count=0; $count < count($serv["host"]); $count++)
{
$mysession = curl_init();
curl_setopt($mysession, CURLOPT_URL, "http://".$serv["host"][$count].":".$serv["port"][$count]."/admin.cgi?mode=updinfo&song=".urlencode(trim($da)));
curl_setopt($mysession, CURLOPT_HEADER, false);
curl_setopt($mysession, CURLOPT_RETURNTRANSFER, true);
curl_setopt($mysession, CURLOPT_POST, false);
curl_setopt($mysession, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($mysession, CURLOPT_USERPWD, "admin:".$serv["passwd"][$count]);
curl_setopt($mysession, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($mysession, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt($mysession, CURLOPT_CONNECTTIMEOUT, 2);
curl_exec($mysession);
curl_close($mysession);
}
echo "song updated";
sleep(5);
}
?>