I received a list of shoutcast servers and thought: "it would come in handy if I have a webpage where I can choose which station I want to listen."
So I made another script some of you might be interested in.
Just put this file into your cgi-bin directory of your secondary webserver and browse to the name of this script.
There's still only one problem: if I start a stream, there won't be any page output.
Maybe someone has a solution for this.
Code:
#!/bin/sh
# WEBRADIO SCRIPT V1.1
echo "Content-type: text/html;"
echo
# SERVER FILE FORMAT:
#
SERVERFILE=stations
# EXTRACT PARAMETER, IF PRESENT
# THIS CAN BE script?param=value¶m2=value2...
# OR CAN BE script/param=value¶m2=value2...
ESC_SCRIPT_NAME=`echo $SCRIPT_NAME | sed -r 's/\//\\\\\//g'`
PARAM=`echo $REQUEST_URI | sed -e "s/$ESC_SCRIPT_NAME.//g"`
if [ "$SCRIPT_NAME" != "$REQUEST_URI" ]; then
# MAKE VARIABLES OUT OF THE PARAMETER
`echo -e export "$PARAM" | sed -e "s/&/\nexport /g"`
# NO HOST GIVEN, PROBABLY WANTS TO STOP THE STREAM
if [ -z "$host" ]; then
./stream stop
exit 0;
fi
# STARTING STREAM, USES THE STREAM SCRIPT
./stream stop > /dev/null
./stream start $host $port $urlpath
else
# DEFAULT: NO PARAMS GIVEN
# PRINT THE SERVER LIST
cat $SERVERFILE | sed -r "s/([^ ]*) ([^ ]*) ([^ ]+) (.*)/< a. h.r.å.f=\"$ESC_SCRIPT_NAME?host=\1\&port=\2\&urlpath=\3\">\1:\2\3 \"\4\"<\/a>
\n/g"
fi
Also, it is likely, you have to kill the
waveserver and
waveservermain processes, otherwise you can't access your soundblaster device
Update:
I improved the script a little to play streams which contain paths in their url (Like Digitally Imported does:
64.236.34.67 80 /stream/1017 DI DJ mixes 96k)
You have to use the updated stream script posted earlier.
To show an example
stations file:
Code:
radio.bmj.net 8000 / Bash.org radio (trance)
rs1.radiostreamer.com / 8370 70's
classical.music4free.no-ip.org 8000 / Classic
radioprank.com 8000 / Comic
www.media4fun.com 8004 / Music Hq
native.screaminghost.com 8010 / Mixed
64.236.34.67 80 /stream/1017 DI DJ mixes 96k
/ Stop stream