|
From: OryNider <ory...@us...> - 2008-03-06 03:11:47
|
Update of /cvsroot/mxbb/mx_shotcast In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5080 Modified Files: cur_song.php db_install.php db_upgrade.php getinfo.php mx_install_readme.htm radioplayer.php Added Files: play.php Removed Files: play_real.php play_wmp.php shotcast_config.php Log Message: version 2.0 Index: db_upgrade.php =================================================================== RCS file: /cvsroot/mxbb/mx_shotcast/db_upgrade.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** db_upgrade.php 28 Feb 2008 06:26:38 -0000 1.6 --- db_upgrade.php 6 Mar 2008 03:09:28 -0000 1.7 *************** *** 31,35 **** } ! $mx_module_version = '1.0.8'; $mx_module_copy = 'mxBB <i> - Shotcast</i> module by OryNider & <a href="http://www.mxbb.net" target="_blank">Mx Team</a>'; --- 31,35 ---- } ! $mx_module_version = '2.0.0-RC1'; $mx_module_copy = 'mxBB <i> - Shotcast</i> module by OryNider & <a href="http://www.mxbb.net" target="_blank">Mx Team</a>'; Index: mx_install_readme.htm =================================================================== RCS file: /cvsroot/mxbb/mx_shotcast/mx_install_readme.htm,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mx_install_readme.htm 28 Feb 2008 06:26:38 -0000 1.4 --- mx_install_readme.htm 6 Mar 2008 03:09:28 -0000 1.5 *************** *** 235,239 **** <tr> <td height="45"> ! <p><b><font size="2" face="Fixedsys">v. 1.0.0</font></b></p> <p><font face="Fixedsys"><span style= "font-size: 16px; line-height: normal; font-weight:bold">Module</span><br /> --- 235,239 ---- <tr> <td height="45"> ! <p><b><font size="2" face="Fixedsys">v. 2.0.0-Beta</font></b></p> <p><font face="Fixedsys"><span style= "font-size: 16px; line-height: normal; font-weight:bold">Module</span><br /> --- shotcast_config.php DELETED --- Index: cur_song.php =================================================================== RCS file: /cvsroot/mxbb/mx_shotcast/cur_song.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cur_song.php 24 Feb 2008 01:14:04 -0000 1.3 --- cur_song.php 6 Mar 2008 03:09:18 -0000 1.4 *************** *** 88,92 **** </HEAD> <body> ! <span style="font-weight : bold;"><?=$song[0];?></span> </body> </HTML> \ No newline at end of file --- 88,101 ---- </HEAD> <body> ! <?php ! if($radio->song()) ! { ! echo '<span style="font-weight : bold;">'.$radio->song().'</span>'; ! } ! else ! { ! echo '<span style="font-weight : bold;">'.$song[0].'</span>'; ! } ! ?> </body> </HTML> \ No newline at end of file Index: db_install.php =================================================================== RCS file: /cvsroot/mxbb/mx_shotcast/db_install.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** db_install.php 28 Feb 2008 06:26:37 -0000 1.6 --- db_install.php 6 Mar 2008 03:09:18 -0000 1.7 *************** *** 35,39 **** } ! $mx_module_version = '1.0.8'; $mx_module_copy = 'mxBB <i> - Shotcast</i> module by OryNider & <a href="http://www.mxbb.net" target="_blank">Mx Team</a>'; --- 35,39 ---- } ! $mx_module_version = '2.0.0-RC1'; $mx_module_copy = 'mxBB <i> - Shotcast</i> module by OryNider & <a href="http://www.mxbb.net" target="_blank">Mx Team</a>'; Index: radioplayer.php =================================================================== RCS file: /cvsroot/mxbb/mx_shotcast/radioplayer.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** radioplayer.php 28 Feb 2008 06:26:39 -0000 1.6 --- radioplayer.php 6 Mar 2008 03:09:29 -0000 1.7 *************** *** 61,68 **** <meta name="keywords" content="Radio Player" /> <meta name="author" content="Radio Player originaly made by: Niklas Pull - http://pull.zapto.org" /> ! <title>Radio Player :: <?=$station;?></title> ! <? //include($module_root_path . "stylesheet.$phpEx");?> <style type="text/css"> <!-- body { margin: 0; --- 61,76 ---- <meta name="keywords" content="Radio Player" /> <meta name="author" content="Radio Player originaly made by: Niklas Pull - http://pull.zapto.org" /> ! <!-- First load standard template *.css definition, located in the the phpbb template folder --> ! <link rel="stylesheet" href="<?php echo PHPBB_URL . TEMPLATE_ROOT_PATH . $theme['head_stylesheet']; ?>" type="text/css" /> ! <!-- Then load MX-Publisher template *.css definition for mx, located in the the portal template folder --> ! <link rel="stylesheet" href="<?php echo PORTAL_URL . TEMPLATE_ROOT_PATH . $theme['head_stylesheet']; ?>" type="text/css" /> <style type="text/css"> <!-- + * { + margin: 0; + padding: 0; + font-family: Verdana; + font-size: 10px; + } body { margin: 0; *************** *** 70,276 **** font-family: Verdana; font-size: 10px; BACKGROUND-IMAGE: url('<?=$module_root_path;?>images/<?=SKIN;?>/playerbg.png'); } ! a{ text-decoration: none; } ! #main { ! width: 350px; ! height: 100px; ! position: relative; ! left: 0px; ! top: 0px; ! margin:0; ! padding:0; ! background-image: url('<?=$module_root_path;?>images/<?=SKIN;?>/player.png'); ! background-repeat: no-repeat; ! background-attachment: fixed; ! background-color: #eeeeee; } ! #display { ! width: 315px; ! height: 39px; ! position: relative; ! left: 18px; ! top: 18px; } ! #display_low { ! width: 310px; ! height: 21px; ! position: relative; ! left: 3px; ! top: 3px; } ! #bottom { ! width: 350px; ! height: 39px; ! position: relative; ! left: 0px; ! top: 22px; } ! #songtitle { ! width: 310px; ! height: 12px; ! position: relative; ! left: 3px; ! top: 3px; } ! #station { ! width: 150px; ! position: relative; ! left: 23px; ! top: 30px; } ! #bitrate { ! width: 55px; ! position: relative; ! left: 185px; ! top: 18px; } ! #equalizer { ! width: 55px; ! position: relative; ! left: 280px; ! top: 0px; } ! #icon { ! width: 55px; ! position: relative; ! left: 300px; ! top: 10px; } ! #iframe { ! width: 0px; ! position: relative; ! left: 0px; ! top: 0px; } ! table { ! font-family: Verdana; ! font-size: 10px; } ! --> ! </style> ! <!-- script language="javascript" type="text/javascript" src="<?=$module_root_path;?>templates/radioplayer.js"></script --> ! <script language="javascript"> ! function Ajax(){ ! var xmlHttp; ! try{ ! xmlHttp=new XMLHttpRequest(); ! } ! catch (e){ ! try{ ! xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); ! } ! catch (e){ ! try{ ! xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); ! } ! catch (e){ ! return false; ! } ! } ! } ! ! xmlHttp.onreadystatechange=function(){ ! if(xmlHttp.readyState==4){ ! document.getElementById('songtitle').innerHTML=xmlHttp.responseText; ! setTimeout('Ajax()',25000); ! } } ! xmlHttp.open("GET","<?=$module_root_path;?>cur_song.<?=$phpEx;?>",true); ! xmlHttp.send(null); } ! ! window.onload=function(){ ! setTimeout('Ajax()',1); } ! ! function radio_player() { ! props=window.open('<?=$module_root_path;?>radioplayer.<?=$phpEx;?>?lang=&z=wmp', 'poppage', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=1, width=350, height=100 left = 100, top = 100'); } </script> </head> <body> ! <div id="iframe"> ! <SCRIPT language="javascript"> ! <!-- ! document.writeln("<iframe width=\"350\" height=\"0\""); ! document.writeln(" id=\"myiframe\" name=\"myiframe\""); ! document.writeln(" src=\"<?=$module_root_path;?>radio_update.<?=$phpEx;?>\""); ! document.writeln(" scrolling=\"no\""); ! document.writeln(" style=\"width:350px;height:0px;border:0px\">"); ! document.writeln("Sorry, your browser doesn't seem to support IFrames!"); ! document.writeln("</iframe>"); ! document.writeln(""); ! //--> ! </SCRIPT> </div> - <div id="main"> ! <div id="display"> ! <div id="songtitle"> ! <? ! if($text[1] == 0) ! { ! echo "<b>Radio station currently Offline.</b>"; ! } ! else ! { ! echo "Checking for song title..."; ! } ! ?> ! </div> ! <div id="display_low"> ! <table border="0" cellpadding="0" cellspacing="0" width="300" height="21"> ! <tr class="table"> ! <td align="left" valign="bottom"> ! <i>Station: <b><?=$station;?></b></i> ! </td> ! <td align="center" valign="bottom"> ! <?=$text[5];?> kbps ! </td> ! <td align="right" valign="bottom"> ! <img src="<?=$module_root_path;?>images/equalizer_<?=$status;?>.gif" height="21"> ! </td> ! </tr> ! </table> ! </div> ! </div> ! <div id="bottom"> ! <table border="0" cellpadding="0" cellspacing="0" width="350" height="39"> ! <tr class="table"> ! <td width="193"> ! <img src="<?=$module_root_path;?>images/<?=SKIN;?>/player2.png" width="193" height="39" usemap="#play" border="0"> ! </td> ! <td width="157" height="39" background="<?=$module_root_path;?>images/<?=SKIN;?>/player3_<?=$player;?>.png"> ! Switch to: ! <a href="<?=$module_root_path;?>radioplayer.<?=$phpEx;?>?player=<?=$changeto;?>"> ! <img src="<?=$module_root_path;?>images/<?=SKIN;?>/small_<?=$changeto;?>.png" border="0"> ! </a> ! </td> ! </tr> ! </table> ! </div> </div> ! <div id="iframe"> ! <? ! if($status == 'play') ! { ! ?> ! <iframe src="<?=$module_root_path;?><?=$status;?>_<?=$player;?>.<?=$phpEx;?>" name="stream" width="0" height="0"></iframe> ! <? ! } ! ?> </div> ! <map name="play"> ! <area shape="rect" alt="Stop" coords="55,0,78,27" href="<?=$module_root_path;?>radioplayer.<?=$phpEx;?>?player=<?=$player;?>" target="_self"> ! <area shape="rect" alt="Play" coords="21,0,47,28" href="<?=$module_root_path;?>radioplayer.<?=$phpEx;?>?player=<?=$player;?>&status=play" target="_self"> ! </map> </body> ! </html> --- 78,254 ---- font-family: Verdana; font-size: 10px; + color: #ffffff; BACKGROUND-IMAGE: url('<?=$module_root_path;?>images/<?=SKIN;?>/playerbg.png'); } ! a, a:visited, a:active{ text-decoration: none; + color: #8a99f4; + border: 0px; } ! select{ ! font-family: Verdana; ! font-size: 10px; ! background-color: #f1f1f1; ! border: 0px; } ! #shell{ ! background-image: url('<?=$module_root_path;?>images/<?=SKIN;?>/shell.jpg'); ! width: 320px; ! height: 142px; ! left: 0px; ! top: 0px; ! position: absolute; } ! #station{ ! left: 5px; ! top: 1px; ! position: absolute; } ! #songtitle{ ! left: 10px; ! top: 30px; ! position: absolute; } ! #songtitle{ ! width: 305px; ! left: 10px; ! top: 28px; ! position: absolute; } ! #bitrate{ ! left: 138px; ! top: 60px; ! position: absolute; } ! #contentType{ ! left: 138px; ! top: 80px; ! position: absolute; } ! #play{ ! left: 10px; ! top: 110px; ! position: absolute; } ! #stop{ ! left: 45px; ! top: 115px; ! position: absolute; } ! #select{ ! left: 220px; ! top: 110px; ! position: absolute; } ! #infoPlayer{ ! left: 8px; ! top: 60px; ! position: absolute; } ! #infoPlugin{ ! left: 8px; ! top: 79px; ! position: absolute; } ! #equalizer{ ! left: 214px; ! bottom: 39px; ! position: absolute; } ! #closeButton{ ! left: 305px; ! top: 2px; ! position: absolute; } ! --> ! </style> ! <script type="text/javascript"> ! <!-- ! loadimg = new Image(27,27); ! loadimg.src = "<?=$module_root_path;?>images/<?=SKIN;?>/play_h.jpg"; ! loadimg2 = new Image(19,19); ! loadimg2.src = "<?=$module_root_path;?>images/<?=SKIN;?>/stop_h.jpg"; ! window.onload = function(){ ! checkSong(); ! embedInfo(detectEmbed()); } + //--> </script> + <title>Radio Player :: <?=$station;?></title> + <?php require($module_root_path . "includes/detectScript.htm"); ?> + </head> <body> ! <div id="shell"> ! <div id="station">Radio Player :: <?=$station;?></div> ! ! <div id="songtitle"> ! <?php ! if($text[1] == 0) ! { ! echo "<b>Radio station currently Offline.</b>"; ! } ! else ! { ! echo "Checking for song title..."; ! } ! ?> </div> ! <div id="bitrate"><?=$text[5];?> kbps</div> ! <div id="contentType"><?=$mimetype;?></div> ! <div id="infoPlayer"></div> ! <div id="infoPlugin"></div> ! ! <div id="equalizer"><img src="<?=$module_root_path;?>images/<?=SKIN;?>/equalizer_stop.gif" id="eq"></div> ! <div id="closeButton"><a href="javascript:window.close()"><img src="<?=$module_root_path;?>images/<?=SKIN;?>/close.jpg" border="0"></a></div> + <div id="play"><img id="playB" src="<?=$module_root_path;?>images/<?=SKIN;?>/play.jpg" onclick="javascript:playR()" + onmouseover="javascript:document.getElementById('playB').src = '<?=$module_root_path;?>images/<?=SKIN;?>/play_h.jpg';" + onmouseout="javascript:document.getElementById('playB').src = '<?=$module_root_path;?>images/<?=SKIN;?>/play.jpg';"> + </div> + <div id="stop"><img id="stopB" src="<?=$module_root_path;?>images/<?=SKIN;?>/stop.jpg" onclick="javascript:stopR()" + onmouseover="document.getElementById('stopB').src = '<?=$module_root_path;?>images/<?=SKIN;?>/stop_h.jpg';" + onmouseout="document.getElementById('stopB').src = '<?=$module_root_path;?>images/<?=SKIN;?>/stop.jpg';"> </div> ! <div id="select"> ! Media Player:<br><select id="embedchoise" onchange="javascript:changeEmbed()"> ! <option value="auto">Auto detect</option> ! <option value="wmp">WMP</option> ! <?php ! if ($mimetype !== 'audio/aacp') ! { ! ?> ! <option value="real">RealPlayer</option> ! <? ! } ! ?> ! <script type="text/javascript"> ! <!-- // ! if(AXcompatible()){ ! document.write('<option value="winampX">WinampX</option>'); ! } else { ! <?php ! if ($mimetype !== 'audio/aacp') ! { ! ?> ! document.write('<option value="quicktime">QuickTime</option>'); ! <?php ! } ! ?> ! } ! // --> ! </script> ! </select> </div> + <br> ! </div> ! <div id="iframe"> ! <IFRAME src="#" name="embedFrame" ID="embedFrame" width="0" height="0" style="border: 0px;"></iframe> ! </div> </body> ! </html> \ No newline at end of file --- NEW FILE: play.php --- <?php if( !defined('IN_PORTAL') || !is_object($mx_block)) { define('IN_PORTAL', true); $mx_root_path = "../../"; $module_root_path = "./"; $phpEx = substr(strrchr(__FILE__, '.'), 1); include_once($mx_root_path . 'common.'.$phpEx); // // Start session management // $mx_user->init($user_ip, PAGE_INDEX); // // End session management // $title = 'Media Player Radio'; $block_size = ( isset($block_size) && !empty($block_size) ? $block_size : '315' ); $is_block = FALSE; } else { // // Read block Configuration // $title = $mx_block->block_info['block_title']; $block_size = ( isset($block_size) && !empty($block_size) ? $block_size : '100%' ); if( is_object($mx_block)) { $is_block = TRUE; } } define('IN_SHOTCAST', true); require($module_root_path .'includes/common.'.$phpEx); require($module_root_path . 'getinfo.'.$phpEx); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <script type="text/javascript"> <!-- window.onunload = function(){ stopWinampx(); } //--> </script> </head> <body> <?php require($module_root_path . "includes/detectScript.htm"); if(!isset($_GET['embed'])){ ?> <script type="text/javascript"> var embed = detectEmbed(); self.location = 'play.php?embed='+embed; </script> <?php } else { if($_GET['embed'] == "real") { ?> <OBJECT id="RVOCX" classid="CLSID:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"> <PARAM name="SRC" value="http://<?=$radio->host;?>:<?=$radio->port;?>"> <PARAM name="autostart" value="true"> <EMBED autostart="true" src="http://<?=$radio->host;?>:<?=$radio->port;?>" type="audio/x-pn-realaudio-plugin"> </EMBED> </OBJECT> <?php } else if($_GET['embed'] == "quicktime") { ?> <OBJECT id="QuickTime" classid="CLSID:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab"> <PARAM name="SRC" value="http://<?=$radio->host;?>:<?=$radio->port;?><?=$wmplist;?>"> <PARAM name="AUTOPLAY" value="true"> <EMBED id="QuickTime" src="http://<?=$radio->host;?>:<?=$radio->port;?><?=$wmplist;?>" type="audio/mpegurl" autoplay="true" pluginspace="http://www.apple.com/quicktime/download/"> </EMBED> </OBJECT> <?php } else if($_GET['embed'] == "winampX") { ?> <OBJECT id="IWinAmpActiveX" classid="CLSID:FE0BD779-44EE-4A4B-AA2E-743C63F2E5E6" codebase="http://pdl.stream.aol.com/downloads/aol/unagi/ampx_en_dl.cab" version="-1,-1,-1,-1"> </OBJECT> <script type="text/javascript"> winampx = document.getElementById('IWinAmpActiveX'); winampx.AppendFileToPlaylist('http://<?=$radio->host;?>:<?=$radio->port;?>'); winampx.Play(); </script> <?php } else if($_GET['embed'] == "wmp6") { ?> <OBJECT id="MediaPlayer" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/sv/nsmp2inf.cab#Version=6,4,5,715" type="application/x-oleobject"> <PARAM name="FileName" value="http://<?=$radio->host;?>:<?=$radio->port;?>"> <PARAM name="AutoStart" value="true"> </OBJECT> <?php } else if($_GET['embed'] == "wmp7") { ?> <OBJECT id="MediaPlayer" classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6"> <PARAM name="url" value="http://<?=$radio->host;?>:<?=$radio->port;?>"> <PARAM name="AutoStart" value="true"> <EMBED type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/" filename="http://<?=$radio->host;?>:<?=$radio->port;?>" src="http://<?=$radio->host;?>:<?=$radio->port;?>" autostart=1> </EMBED> </OBJECT> <?php } else if($_GET['embed'] == "aac_wmp") { ?> <SCRIPT LANGUAGE="JavaScript"> //IE Code document.write ('<OBJECT ID="MediaPlayer"'); document.write (' CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"'); document.write (' CODEBASE="<?=$wmp6pluginspace;?>"'); document.write (' standby="Loading Microsoft Windows Media Player components..."'); document.write (' TYPE="application/x-oleobject" width="250" height="62">'); document.write (' <PARAM NAME="FileName" VALUE="<?=$wmpmode;?><?=$scip;?>:<?=$scport;?><?=$wmplist;?>" valuetype="ref">'); document.write ('<PARAM NAME="url" VALUE="<?=$wmpmode;?><?=$scip;?>:<?=$scport;?><?=$wmplist;?>"> '); document.write ('<PARAM NAME="AutoStart" VALUE="true">'); document.write ('<PARAM NAME="ShowControls" VALUE="1">'); //Firefox code document.write (' <Embed type="application/x-ms-wmp"'); document.write (' pluginspage="<?=$ff2pluginspace;?>"'); document.write (' filename="<?=$wmpmode;?><?=$scip;?>:<?=$scport;?><?=$wmplist;?>"'); document.write (' src="<?=$wmpmode;?><?=$scip;?>:<?=$scport;?><?=$wmplist;?>"'); document.write (' Name=MediaPlayer'); document.write (' ShowControls=1'); document.write (' ShowDisplay=1'); document.write (' ShowStatusBar=1'); document.write (' AUTOSTART=1'); document.write (' width=290'); document.write (' height=320>'); document.write (' </embed>'); document.write ('</OBJECT>'); </SCRIPT> <?php } } ?> </body> </html> Index: getinfo.php =================================================================== RCS file: /cvsroot/mxbb/mx_shotcast/getinfo.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** getinfo.php 28 Feb 2008 06:26:38 -0000 1.5 --- getinfo.php 6 Mar 2008 03:09:28 -0000 1.6 *************** *** 18,22 **** //$accplugin = 'http://' . $_SERVER['SERVER_NAME'] . substr($_SERVER['PHP_SELF'], 0, -strlen(basename(__FILE__))) . 'install/setup_AAC_aacPlus_plugin.exe'; ! $accplugin = 'http://retro-radio.net/plugin/setup_AAC_aacPlus_plugin_1_0_36.exe'; $time = date("U"); --- 18,22 ---- //$accplugin = 'http://' . $_SERVER['SERVER_NAME'] . substr($_SERVER['PHP_SELF'], 0, -strlen(basename(__FILE__))) . 'install/setup_AAC_aacPlus_plugin.exe'; ! //$accplugin = 'http://retro-radio.net/plugin/setup_AAC_aacPlus_plugin_1_0_36.exe'; $time = date("U"); *************** *** 33,48 **** $station_name = "Shotcast Radio"; // Radio Station Name (for the no pass version) $force_no_playlist = true; ! $protocol_type = ($stream_type == 'mp3') ? 'http' : 'icyx'; ! $streamdest = $protocol_type . "://" . $scip . ":" . $scport . "/" . $playlist; $radio_skin = isset($_GET['skin']) ? $_GET['skin'] : $shotcast_config['skin']; @define('SKIN', $radio_skin); - $wmpmode = ($protocol_type !== 'icyx') ? 'http://' : 'icyx://'; // AAC VS MPEG - $wmplist = ( ($stream_type == 'mp3') || ($force_no_playlist) ) ? '' : '/' .$playlist; - $ff2pluginspace = ($stream_type == 'mp3') ? 'http://port25.technet.com/videos/downloads/wmpfirefoxplugin.exe' : $accplugin; - $wmp7pluginspace = ($stream_type == 'mp3') ? 'http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&' : $accplugin; - $wmp6pluginspace = ($stream_type == 'mp3') ? 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715' : 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715'; - $errno = 0; $errstr = ''; --- 33,41 ---- $station_name = "Shotcast Radio"; // Radio Station Name (for the no pass version) $force_no_playlist = true; ! $radio_skin = isset($_GET['skin']) ? $_GET['skin'] : $shotcast_config['skin']; @define('SKIN', $radio_skin); $errno = 0; $errstr = ''; *************** *** 146,150 **** $text[3] = !empty($text[3]) ? $text[3] : $maxlisteners; $text[5] = !empty($text[5]) ? $text[5] : $bitrate; - $text[6] = !empty($text[6]) ? $text[6] : $song[0]; } --- 139,142 ---- *************** *** 154,158 **** $currentlisteners = "Unknon"; $bitrate = "Unknon"; ! $song[0] = "Unknon Artist"; $maxlisteners = "Unknon"; $servergenre = $lang['Socket_functions_disabled']; --- 146,150 ---- $currentlisteners = "Unknon"; $bitrate = "Unknon"; ! $text[6] = $song[0] = "Unknon Artist"; $maxlisteners = "Unknon"; $servergenre = $lang['Socket_functions_disabled']; *************** *** 163,170 **** } // The "i" after the pattern delimiter indicates a case-insensitive search if (preg_match("/Unauthorized/", $station)) { ! $station = $shotcast_config['shotcast_name']; } --- 155,427 ---- } + /** + * radio.class is a stand-alone php class for ShoutCast Servers that obtains informations about the server. + * USAGE: + * $variable = new radio(HOST, PORT); - Construct the Object. ie. - new radio($SERVER_NAME, 8000); + * $variable->host - Get server host. (INT) + * $variable->port - Get server port. (INT) + * $variable->stat - Status if server is on/off (INT, 1=on, 0=off) + * $variable->bitrate - Bitrate of streaming audio. (INT) + * $variable->listners - Listners. (INT) + * $variable->station - Radiostation name (STRING) + * $variable->genre - Streamers selected genre. (STRING) + * $variable->song - Current song. (STRING) + * $variable->played - Last played songs (ARRAY[STRING]) + * + * @author Niklas Pull + * @created 2008-02-04, Sweden + * + * Keep the autor tag in order to use or distrubutate this php class, + */ + + + class radio + { + var $host; + var $port; + var $stat = 0; + + var $rawdata; + var $c = 0; + + var $errno; + var $errstr; + + /** + * Constructor for radio class. + * @param $host Server Host. + * @param $port Server Port + */ + function radio($host, $port) + { + $this->host = $host; + $this->port = $port; + $this->rawdata = $this->getServerData("index.html"); + $this->stat = $this->servStat(); + } + + /** + * Collecting raw data from ShoutCast server. + * @param $source From where to collect data. + * @return An array with each row. + */ + function getServerData($source) + { + $fp = @fsockopen($this->host, $this->port, $errno, $errstr, 10); + + if (!$fp) + { + return; + } + else + { + @fputs($fp, "GET /$source HTTP/1.1\r\n"); + @fputs($fp, "Host: $this->host\r\n"); + @fputs($fp, "User-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n"); + @fputs($fp, "Connection: close\r\n\r\n"); + while (!feof($fp)) + { + $buf .= fgets($fp,128); + } + @fclose($fp); + return explode("\t", strip_tags(str_replace(array("</td>", "</tr>", "Current Song"), array("\t", "\t", " Current Song"), $buf))); + } + } + + /** + * @return An integer, 1 if the server is streaming otherwise 0. + */ + function servStat() + { + $i = 0; + while ($i < count($this->rawdata)) + { + $this->rawdata[$i] = trim($this->rawdata[$i]); + if (strstr($this->rawdata[$i], "Server Status:")) + { + $tmp = explode(" ", $this->rawdata[$i+1]); + return ($tmp[3] == "up") ? "1" : "0"; + } + $i++; + } + return 0; + } + + /** + * @return An integer representing the bitrate of the streaming. + */ + function bitrate() + { + $i = 0; + if($this->stat != 1) + { + return 0; + } + while ($i < count($this->rawdata)) + { + $this->rawdata[$i] = trim($this->rawdata[$i]); + if (strstr($this->rawdata[$i], "Stream Status:")) + { + $bitr = explode(" ", $this->rawdata[$i+1]); + return $bitr[4]; + } + $i++; + } + } + + /** + * @return An integer of how many listners. + */ + function listners() + { + $i = 0; + if($this->stat != 1) + { + return 0; + } + while ($i < count($this->rawdata)) + { + $this->rawdata[$i] = trim($this->rawdata[$i]); + if (strstr($this->rawdata[$i], "Stream Status:")) + { + $listn = explode(" ", $this->rawdata[$i+1]); + return $listn[7]; + } + $i++; + } + } + + /** + * @return A string representing the Stream title. + */ + function station() + { + $i = 0; + if($this->stat != 1) + { + return; + } + while ($i < count($this->rawdata)) + { + $this->rawdata[$i] = trim($this->rawdata[$i]); + if (strstr($this->rawdata[$i], "Stream Title:")) + { + return $this->rawdata[$i+1]; + } + $i++; + } + } + + /** + * @return The mime-type of the stream + */ + function mimeType() + { + $i = 0; + if($this->stat != 1) + { + return; + } + while ($i < count($this->rawdata)) + { + $this->rawdata[$i] = trim($this->rawdata[$i]); + if (strstr($this->rawdata[$i], "Content Type:")) + { + return $this->rawdata[$i+1]; + } + $i++; + } + } + + /** + * @return The streaming genre. + */ + function genre() + { + $i = 0; + if($this->stat != 1){ + return; + } + while ($i < count($this->rawdata)) + { + $this->rawdata[$i] = trim($this->rawdata[$i]); + if (strstr($this->rawdata[$i], "Stream Genre:")) + { + return $this->rawdata[$i+1]; + } + $i++; + } + } + + /** + * @return A string with the current song playing on the stream. + */ + function song(){ + $i = 0; + if($this->stat != 1){ + return; + } + if($this->c != 0){ + return trim($this->rawdata[$this->c]); + } + while ($i < count($this->rawdata)) { + $this->rawdata[$i] = trim($this->rawdata[$i]); + if (strstr($this->rawdata[$i], "Current Song:")) { + $this->c = $i+1; + return $this->rawdata[$i+1]; + } + $i++; + } + } + + /** + * @return An array with Strings of every previous played song, the lenght is set inte the .ini file for the ShoutCast server. + */ + function played() + { + $played = array(); + $i = 0; + if($this->stat != 1) + { + return; + } + $raw_played = $this->getServerData("played.html"); + while ($i < count($raw_played)) + { + $raw_played[$i] = trim($raw_played[$i]); + if (strstr($raw_played[$i], "Current Song")) + { + $i=$i+3; + break; + } + $i++; + } + $j=0; + while ($raw_played[$i-1] != "") + { + $played[$j] = $raw_played[$i]; + $i=$i+2; + $j++; + } + return $played; + } + + } + + $radio = new radio($scip, $scport); + + if (($radio->stat == 1) && ($radio->mimeType())) + { + $mimetype = $radio->mimeType(); + } + else + { + $mimetype = ($stream_type == 'mp3') ? 'audio/mpeg' : 'audio/aacp'; + } + // The "i" after the pattern delimiter indicates a case-insensitive search if (preg_match("/Unauthorized/", $station)) { ! $station = $radio->station(); } *************** *** 176,180 **** if (preg_match("/Unauthorized/", $servergenre)) { ! $servergenre = $lang['require_password']; } --- 433,437 ---- if (preg_match("/Unauthorized/", $servergenre)) { ! $servergenre = $radio->genre(); } *************** *** 194,197 **** --- 451,479 ---- } + if (preg_match("/^[a-zA-Z\-\'\ ]+$/", $text[6])) + { + $song[0] = $text[6]; + } + else if ($song[0]) + { + $text[6] = $song[0]; + } + else + { + $song[0] = "Unknon Artist"; + } + + $wmpmode = ($mimetype !== 'audio/aacp') ? 'http://' : 'icyx://'; // AAC VS MPEG + $wmplist = ''; //($mimetype == 'audio/mpeg') ? '' : '/' . $playlist; + + $protocol_type = ($mimetype !== 'audio/aacp') ? 'http' : 'icyx'; + $streamdest = $protocol_type . "://" . $scip . ":" . $scport . "/" . $playlist; + + $accplugin = 'http://retro-radio.net/plugin/setup_AAC_aacPlus_plugin_1_0_36.exe'; + $ff2pluginspace = ($mimetype !== 'audio/aacp') ? 'http://port25.technet.com/videos/downloads/wmpfirefoxplugin.exe' : $accplugin; + $wmp7pluginspace = ($mimetype !== 'audio/aacp') ? 'http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&' : $accplugin; + $wmp6pluginspace = ($mimetype !== 'audio/aacp') ? 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715' : 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715'; + + $state = ($text[1] == 1) ? 'Up' : 'Down'; $shotcast_state_icon = ($text[1] == 1) ? 'online.gif' : 'offline.gif'; *************** *** 199,203 **** $text[3] = !empty($text[3]) ? $text[3] : $maxlisteners; $text[5] = !empty($text[5]) ? $text[5] : $bitrate; - $song[0] = !empty($song[0]) ? $song[0] : $text[6]; $status = isset($_GET['status']) ? $_GET['status'] : 'stop'; --- 481,484 ---- --- play_real.php DELETED --- --- play_wmp.php DELETED --- |