Hey, I thought I'd let you know I modifed your script to run in PHP so I could stream music through my home server (or my laptop).
Keep in mind that the user running the server has to have rights to play audio. For apache on Ubuntu, I had to add www-data to the audio group.
I'm still working on the look and feel, but here it is.
stream.php
<html>
<head>
<title>
Choose your radio station
</title>
</head>
<body>
<form type="GET" action="playstream.php">
<?php
function selection($name, $description)
{
printf("<tr><td><input type=button value='X' onclick=\"location.href='playstream.php?selection=%s'\"/>
%s</td><td> %s </td></tr>\n", $name, $name, $description);
}
echo ("<h1>Select your radio station\n</h1>");
echo "<table>";
selection("Stop radio", "Kill the radio player");
selection("KWGS", "University of Tulsa NPR");
selection("La Première", "");
selection("Classic 21", "");
selection("Pure FM", "");
selection("Vivacité Arlon", "");
selection("Vivacité Liège", "");
selection("Radio Nostalgie", "");
selection("Radio Contact", "");
selection("48FM", "ULg");
selection("BFM", "La radio de l'économie");
selection("Divergence FM", "");
selection("PunkRadioCast", "Punk rock broadcast with live DJs");
selection("Groove Salad", "A tasty plate of ambient beats and grooves.");
selection("Secret Agent", "The soundtrack for your stylish, mysterious, dangerous life. For Spies and P.I.'s too! ");
selection("Drone Zone", "Served best chilled, safe with most medications. Atmospheric textures with minimal beats.");
selection("Tag's Trance Trip", "Progressive house / trance. Tip top tunes.");
selection("indie pop rocks", "New and your favorite classic indie pop tracks");
selection("cliqhop idm", "Blips'n'beeps backed mostly w/beats. Intelligent Dance Music.");
selection("Beat Blender", "A late night blend of deep-house and downtempo chill.");
selection("BBC Radio 1", "");
selection("BBC Radio 2", "");
selection("BBC Radio 3", "");
selection("BBC Radio 4", "");
selection("BBC7", "");
selection("BBC World Service", "");
selection("Science in Action", "BBC show (30 min). Broadcast on World Service on Fridays at 10:00.");
selection("The Material World", "BBC show (30 min). Broadcast on Radio 4 on Thursdays at 16:30.");
selection("Discovery", "BBC show (30 min). Broadcast on World Service on Wednesdays at 10:00.");
selection("Go Digital", "BBC show (30 min). Broadcast on World Service on Tuesdays at 10:00.");
selection("Just a Minute", "BBC show (30 min). Broadcast on Radio 4 on Mondays at 18:30.");
selection("DW-RADIO", "Actualités du monde vue par une radio allemande");
selection("Galway Bay FM", "Galway (Ireland) local radio station");
selection("RTE Radio 1", "Dublin (Ireland) local radio station");
echo "</table>";
?>
</form>
</body>
</html>
playstream.php
<html>
<head>
<title>
</title>
</head>
<body>
<?php
# Player
$player="mplayer -quiet -cache 32";
$killPlayer="killall -9 mplayer";
$returnValue=$_GET["selection"];
$url = "";
switch($returnValue)
{
case "Stop radio":
$killPlayer;
break;
case "KWGS":
$url="-playlist http://www.publicbroadcasting.net/kwgs/ppr/kwgs.pls";
break;
case "La Première":
$url="-playlist http://www.rtbf.be/rtbf_2000/radios/prem128.m3u";
break;
case "Classic 21":
$url="-playlist http://www.classic21.be/rtbf_2000/radios/21128.m3u";
break;
case "Pure FM":
$url="-playlist http://www.rtbf.be/rtbf_2000/radios/pure128.m3u";
break;
case "Vivacité Arlon":
$url="-playlist http://www.rtbf.be/rtbf_2000/radios/vivalux.m3u";
break;
case "Vivacité Liège":
$url="-playlist http://www.rtbf.be/rtbf_2000/radios/vivaliege.m3u";
break;
case "Radio Nostalgie":
$url="-playlist http://www.nostalgie.be/player/nostalgie.m3u";
break;
case "Radio Contact":
$url="-playlist http://fr.radiocontact.be/LiveStreaming.asx";
break;
case "48FM":
$url="http://stream1.visio.ulg.ac.be:8000/48fm";
break;
case "BFM":
$url="-playlist http://cache.yacast.fr/V4/bfm/bfm.m3u";
break;
case "Divergence FM":
$url="-playlist http://o6.fr:8000/dfm128.ogg.m3u";
break;
case "PunkRadioCast":
$url="-playlist http://www.punkradiocast.com/high.pls";
break;
case "Groove Salad":
$url="-playlist http://www.somafm.com/groovesalad.pls";
break;
case "Secret Agent":
$url="-playlist http://www.somafm.com/secretagent.pls";
break;
case "Drone Zone":
$url="-playlist http://www.somafm.com/dronezone.pls";
break;
case "Tag's Trance Trip":
$url="-playlist http://www.somafm.com/tagstrance.pls";
break;
case "indie pop rocks":
$url="-playlist http://www.somafm.com/indiepop.pls";
break;
case "cliqhop idm":
$url="-playlist http://www.somafm.com/cliqhop.pls";
break;
case "Beat Blender":
$url="-playlist http://www.somafm.com/beatblender.pls";
break;
case "BBC Radio 1":
$url="-playlist http://www.bbc.co.uk/radio1/realaudio/media/r1live.ram";
break;
case "BBC Radio 2":
$url="-playlist http://www.bbc.co.uk/radio2/realmedia/fmg2.ram";
break;
case "BBC Radio 3":
$url="-playlist http://www.bbc.co.uk/radio3/ram/r3g2.ram";
break;
case "BBC Radio 4":
$url="-playlist http://www.bbc.co.uk/radio4/realplayer/media/fmg2.ram";
break;
case "BBC7":
$url="-playlist http://www.bbc.co.uk/bbc7/realplayer/dsatg2.ram";
break;
case "BBC World Service":
$url="-playlist http://www.bbc.co.uk/worldservice/ram/live_infent.ram";
break;
case "Science in Action":
$url="-playlist http://www.bbc.co.uk/radio/aod/shows/rpms/wservice/sia.ram";
break;
case "The Material World":
$url="-playlist http://www.bbc.co.uk/radio/aod/shows/rpms/radio4/materialworld.ram";
break;
case "Discovery":
$url="-playlist http://www.bbc.co.uk/radio/aod/shows/rpms/wservice/discovery.ram";
break;
case "Go Digital":
$url="rtsp://rmv8.bbc.net.uk/worldservice/scienceview.ra";
break;
case "Just a Minute":
$url="-playlist http://www.bbc.co.uk/radio/aod/shows/rpms/radio4/just.ram";
break;
case "DW-RADIO":
$url="http://metafiles.gl-systemhaus.de/dw/radio_en_64.pls";
break;
case "Galway Bay FM":
$url="-playlist http://www.radiofeeds.co.uk/galwaybay.asx";
break;
case "RTE Radio 1":
$url="-playlist http://www.rte.ie/smiltest/radio1.smil";
break;
default:
$url="invalid.php";
break;
}
echo ("Now playing: ".$returnValue."<br/>");
//echo($killPlayer."<br/>");
//echo($player." ".$url."<br/>");
exec($killPlayer);
exec($player." ".$url." >/dev/null&");
//system($player." ".$url);
?>
<form type="GET" action="playstream.php?selection=Stop+radio">
<input type=submit value="Stop radio" />
</form>
<form type="GET" action="stream.php">
<input type=submit value="Choose another station" />
</form>
</body>
</html>