#!/bin/sh # Chumby Internet Radio v1.2 # Rolan Yang rolan@omnistep.com # Nov 23, 2007 # v1.2 added "--output=alsa:plug:dmixer" to de-chickmunk some streams eval $(echo "$QUERY_STRING"|awk -F'&' '{for(i=1;i<=NF;i++){print $i}}') # import the GET variables read QUERY_STRING eval $(echo "$QUERY_STRING"|awk -F'&' '{for(i=1;i<=NF;i++){print $i}}') # import the POST variables song=`ps w | grep btplay | grep -v grep | head -1 | cut -c60-`; if [ $f = "Stop" ] || ([ $f = "Play" ] && [ $song ]) then killall -9 btplay sleep 1 fi if [ "$f" == 'Play' ] then song=`httpd -d $s` isStream=`echo $song | cut -f3 -d:` # check to see if a port is specified.Otherwise, fetch and parse pls file if [ $isStream ] then btplay --output=alsa:plug:dmixer $song 1> /dev/null 2> /dev/null & else wget -q -O /tmp/stream $song btplay --output=alsa:plug:dmixer `grep File /tmp/stream | head -1 | cut -f2 -d=` 1> /dev/null 2> /dev/null & fi fi if [ -z $v ] then vol=`chumby_set_volume` else vol=$((`echo $v | cut -c2- | cut -f1 -d","`/2)) chumby_set_volume $vol fi volume=$(($vol*2-201)) cat < Chumby Radio
Chumby Radio
Stream:
Volume:
EOF