본문 바로가기

SHOUTCast AutoDJ

반응형

acho que esse script deve ajudar com status:

 

<?php

//Configuration
$streaming = http://www.criawebs.com.br

$scdef = "Radio"; // Default station name to display when server or stream is down

$scip = ""; // ip or url of shoutcast server (DO NOT ADD HTTP:// don't include the port)

$scport = ""; // port of shoutcast server

$scpass = ""; // password to shoutcast server

//End configuration

 

$scfp = fsockopen("$scip","$scport");

if(!$scfp) {

$scsuccs=1;

echo''.$scdef.' Offline';

}

if($scsuccs!=1){

fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n");

while(!feof($scfp)) {

$page .= fgets($scfp, 1000);

}

 

$loop = array("STREAMSTATUS", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS");

$y=0;

while($loop[$y]!=''){

$pageed = ereg_replace(".*<$loop[$y]>", "", $page);

$scphp = strtolower($loop[$y]);

$$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed);

if($loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE || $loop[$y]==SERVERTITLE)

$$scphp = urldecode($$scphp);

 

 

$y++;

}

 

$pageed = ereg_replace(".*<SONGHISTORY>", "", $page);

$pageed = ereg_replace("<SONGHISTORY>.*", "", $pageed);

$songatime = explode("<SONG>", $pageed);

$r=1;

while($songatime[$r]!=""){

$t=$r-1;

$playedat[$t] = ereg_replace(".*<PLAYEDAT>", "", $songatime[$r]);

$playedat[$t] = ereg_replace("</PLAYEDAT>.*", "", $playedat[$t]);

$song[$t] = ereg_replace(".*<TITLE>", "", $songatime[$r]);

$song[$t] = ereg_replace("</TITLE>.*", "", $song[$t]);

$song[$t] = urldecode($song[$t]);

$dj[$t] = ereg_replace(".*<SERVERTITLE>", "", $page);

$dj[$t] = ereg_replace("</SERVERTITLE>.*", "", $pageed);

$r++;

}

//end song info

 

fclose($scfp);

}

 

 

if($streamstatus == "1"){

?>

<a href="#" title="Atualizar Locutor" onclick="atualiza_dados('dj','http://habbix.com.br/stats/dj.php')"><font face="Verdana" size="1" color="ffffff"><? echo $servertitle; ?></font></a>

<?

}elseif($streamstatus == "0")

{

?>

<a href="#" title="Atualizar Locutor" onclick="atualiza_dados('dj','stats/dj')">Offline!</a>

<?

}else{

?>

<a href="#" title="Atualizar Locutor" onclick="atualiza_dados('dj','stats/dj')">Atualize...</a>

<?

}

?>

반응형

댓글


Copyright ⓒ SmartWeb All rights reserved.