I wrote a little shell script to listen to radio streams which are listed by radio-browser.info.
#!/bin/bash
VERSION=0.02
CLIENT="?client=radio-browser.sh-$VERSION"
unset DRYRUN SEARCH VERBOSE
version (){
echo "radio-browser.sh $VERSION (C) by Jens Korte"
}
copyright (){
echo
version
echo
echo You may use and redistribute the shell script under the terms of the AGPL3
echo See https://www.gnu.org/licenses/agpl-3.0.html for details
echo
}
help(){
echo
echo ' radio-browser.sh [options] "keyword(s)"'
echo
echo radio-browser.sh plays radio stations from the radio wiki database http://www.radio-browser.info/ . The script fetches a playlist with station names filtered by "keywords" and feeds the playlist to mplayer. Usually the keys "< and >" are used to switch to other elements of the playlist.
echo
echo --copyright shows copyright and exits
echo "--dryrun don't start mplayer; use -v for showing the keyword(s)"
echo -h, --help shows help and exits
echo -v, --verbose be verbose
echo -V, --version shows version and exits
echo
echo If your favourite radio station is missing please add it to radio-browser.info. It is an easy to use web site.
echo
}
test -z "$1" && help && exit 0
while test -n "$1";do \
#Befehle
case $1 in
--copyright) copyright ; exit 0 ;;
--dryrun) DRYRUN=1 ;;
-h|--help) help ; exit 0 ;;
-v|--verbose) VERBOSE=1 ;;
-V|--version) version; exit 0 ;;
*) SEARCH="$SEARCH"" $1" ;; # all unrecognized params go into SEARCH
esac
shift
done
SEARCH="$SEARCH""?client=$CLIENT"
test -n "$VERBOSE" && echo Search for: $SEARCH
test -z "$DRYRUN" && mplayer --playlist="http://www.radio-browser.info/webservice/pls/stations/byname/$SEARCH"