I have seen this before on other Shoutcast php scripts that allow users to tune in to your radio station through a selection of media players from the statistics page.

I found a pretty good standalone script that lists the stream info and the last 19 songs. It also allows the user to tune in by clicking on a playlist link for Winamp, Real, WMP, and Quicktime. I have seen others use iTunes as well.

http://www.szone.us/f6/standalone-php-shoutcast-status-5/

Comments

zmeharen’s picture

I've looked through the script I mentioned above and a simple winamp playlist link is generated as such:

        <img src="images/im_winamp.gif" alt="Listen w/ Winamp" border="0" hspace="2" /><a href="' . $listenamp . '">Winamp</a> 

where $listenamp is configured in the config.php file as

       $listenamp = 'http://' . $scip . ':' . $scport . '/listen.pls';

I attempted to alter the shoutcast.module code by obtaining the value of the host and port and
adding it to $block_content at the end before the detail link.

	$host = variable_get('shoutcast_ip_'.$delta, '127.0.0.1');
	$port = variable_get('shoutcast_port_'.$delta, '8000');
	$listenamp = 'http://' . $host . ':' . $port . '/listen.pls';
	$block_content .= '<a href="' . $listenamp . '">Listen to Radio now</a><br>';

It seems to break the code and the block doesn't show. I'm not very familiar with Drupal's coding practices so maybe there is something wrong with my implementation.

zmeharen’s picture

I didn't have much time but I read thru the drupal api on creating a link and have got it working.
I made a url() call and did a check to make sure that the server status was up as well.
If you feel the code doesn't meet any standards let me know.


// when using checkboxes we have to cast the variable as a string
    if ((string) $options['details_link'] == 'details_link' && user_access('access shoutcast detail')) {
      $host = variable_get('shoutcast_ip_'.$delta, '127.0.0.1');
      $port = variable_get('shoutcast_port_'.$delta, '8000');
      $listenamp = 'http://' . $host . ':' . $port . '/listen.pls';
	if($sc_srv_status =='Up'){
	$block_content .= '<a href="' . url($listenamp) .'">Listen to Radio now</a>';
	}
      $block_content .= '<br><a href="' . url('shoutcast') .'/'. $delta. '">Details...</a>';
    }