Jump to content

I need a Script to show the Current DJ on air (Details Below)


mrdata71
 Share

Recommended Posts

Hello there:

 

I just switched to a Centova cast V3 Streaming server for Shoutcast V1 and V2.

 

I lost my ability to have a remote PHP script to show whether the current DJ is Auto DJ or the DJ that is streaming.( I had one through Makeavoice)

 

Here is the code they used:

 

 

If someone can help me with making one that would be most helpful.

 

Thank you in advance!

Link to comment
Share on other sites

Looks like that script still works? Or is that just a sample stream?

 

What does it look like when the DJ is streaming? To me, this could prove difficult as SHOUTcast does not output anything natively to tell whether its Auto DJ or someone DJing. The AutoDJ software is separate from SHOUTcast, so you would need to find out what Makeavoice use (Centova? WHM?), and use their API's to determine.

Studiio - All-In-One Radio Communication Platform
SMS | Phone Calls | Social Media | Content

Link to comment
Share on other sites

I think he implied that it already worked. What he asked for is a new script for his new Stream Host. Edited by shoutcaststreaming

SCS - Dedicated Bandwidth Servers

Shoutcast / Icecast / Windows Media

Transcoding - Auto DJ - Mobile Radio - FLASH Players - Auto DJ

Broadcasting World's Stream Host of the Month

Link to comment
Share on other sites

In that case, there are a couple of possibilities. First one depends on knowing what Centova Cast uses for AutoDJ and if it has an api you can access to pull the needed info. So, you would need to ask them about that. The other way is to "hijack" one of the Shoutcast v2 stats and parse the xml data. That one would require your DJs to either be able to either prepend or apend the song title updates (some software provides a means to do this, including LCDJ and SAM Broadcaster) with their DJ names or use the Genre setting for this purpose. It is also possible to pull from Shoutcast v1.x but, only via the title updates means.

 

I can help you out with some code for all that, but I would need to know what Shoutcast version?

Link to comment
Share on other sites

Give this a try and let me know how it works for you. The code itself is just a couple lines, but I thought it best to put in a good amount of comments to explain what is going on.

 

// First we need to make a connection to your Shoutcast server stats xml page. Change host and port of the url to yours and the sid number too if needed (default is 1).
$url = "http://host:port/stats?sid=1";
$xml = simplexml_load_file($url) or die("feed not loading");

// Use SERVERGENRE instead of SONGTITLE to parse DJ name from the Genre.
// $genre = $xml->SERVERGENRE;
// echo $genre;

// Next we pull the SONGTITLE from the xml and split the variable with delimiter ":"

$songTitle = $xml->SONGTITLE;
$parts = explode(':', $songTitle);

// $parts should now contain 2 strings of text in an array if a DJ is onair, and just one if not.
// Use $parts[0] for prepended song titles and $parts[1] for appended song titles.
// For prepended (DJ name before title info), DJs must prepend in the format of "DJname: " (without "s.)
// For appended (DJ name after title info), DJs must append in the format of ":DJname" (without "s.)
// The colon is important as it is what tells us where the DJ name ends and the Song Title begins.

// Next we check if anything is in the second part of our array.
if($parts[1] == ""){ 

// If there is nothing in the second part of the array, we know that the Auto DJ is on.
echo "AutoDJ OnAir!";

// Instead of just saying AutoDJ OnAir, we can echo out an image based on one located in 
// a folder called djimages like this
// echo "djimages/AutoDJ.jpgAuto DJ";

} else {

// If $parts[1] does have text, our DJ is on.
echo $parts[0]." OnAir";

// Instead of just saying DJ XYZ OnAir, we can echo out an image based on one located in
// a folder called djimages where the image filename is the same as the djname used like this:
// echo "djimages/".$parts[0].".jpgAuto DJ";
}
?>

Edited by PapaBearPW
Fixed an error in the code...
Link to comment
Share on other sites

I am getting an error in the code when I put it into an HTMl box on my website:

 

SERVERGENRE; // echo $genre; // Next we pull the SONGTITLE from the xml and split the variable with delimiter ":" $songTitle = $xml->SONGTITLE; $parts = explode(':'

Edited by mrdata71
something did not paste
Link to comment
Share on other sites

i was trying to upload it to my Centova Cast where i send my songs so i made a new folder called PHP. I was able to upload it as an MP3 and reame it as .php but i cant access the file with iframe code.

 

You need to upload to your webserver, not Centova Cast. Centova Cast is for music files, your website is for hosting.. your website. Looks like you host your website through GoDaddy, either use FTP/SFTP or their web interface to upload the script.

Studiio - All-In-One Radio Communication Platform
SMS | Phone Calls | Social Media | Content

Link to comment
Share on other sites

OK I cannot FTP or they won tell me how to do so. Has anyone ever FTP'ed to a Godaddy site?

 

https://godaddy.com/help/ftp-how-to-upload-files-96

 

You can FTP using the guide in their support portal above. Unless you use GoDaddy's website builder, in that case you won't be able to upload this PHP script as SCS has mentioned above.

Studiio - All-In-One Radio Communication Platform
SMS | Phone Calls | Social Media | Content

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...