summaryrefslogtreecommitdiffstats
path: root/noise/modules/stream
diff options
context:
space:
mode:
authortv <tv@also>2011-05-29 15:47:21 +0200
committertv <tv@also>2011-05-29 15:47:21 +0200
commit12c77cdbfa4ec48d935af3ae7cf1118e38bec6e1 (patch)
tree2fdf8b557d2a2a1edaba2be569c2110c3822559f /noise/modules/stream
parentedaa1d7f7a0ed33c019fce185b8aff7563498b6e (diff)
lowered filesystem hierarchy--everything are modules
Diffstat (limited to 'noise/modules/stream')
-rwxr-xr-xnoise/modules/stream64
1 files changed, 64 insertions, 0 deletions
diff --git a/noise/modules/stream b/noise/modules/stream
new file mode 100755
index 00000000..1e6fd0c5
--- /dev/null
+++ b/noise/modules/stream
@@ -0,0 +1,64 @@
+#! /bin/sh
+inputdir=$HOME/noise/streams
+basename="`basename "$0"`"
+case "$1" in
+ (--help)
+ if echo "$0 $*" | grep -q '[[:space:]]--verbose\>'; then
+ echo -e "\x1B[35mtype \x1B[32m/$basename off \x1B[35mto turn stream off\x1B[m"
+ for i in `ls $inputdir` ; do
+ filename="$inputdir/$i"
+ shortcut=`xmlstarlet sel -t -v /station/@shortcut "$inputdir/$i"`
+ title=`xmlstarlet sel -t -v /station/@title "$inputdir/$i"`
+ topic=`xmlstarlet sel -t -v /station/@topic "$inputdir/$i"`
+ stream=`xmlstarlet sel -t -v /station/@stream "$inputdir/$i"`
+ echo -e "\x1B[35mtype \x1B[32m/$basename $shortcut \x1B[35mfor $topic\x1B[m"
+ done
+ else
+ echo "play an audio stream"
+ fi
+ ;;
+ (*)
+ exec 2>&1
+ ffs='xml'
+
+ if test -z "$*" ; then
+ echo -e "\x1B[32m/stream off \x1B[33m- turn stream off\x1B[m"
+ for i in `ls $inputdir` ; do
+ filename="$inputdir/$i"
+ shortcut=`xmlstarlet sel -t -v /station/@shortcut "$inputdir/$i"`
+ title=`xmlstarlet sel -t -v /station/@title "$inputdir/$i"`
+ topic=`xmlstarlet sel -t -v /station/@topic "$inputdir/$i"`
+ stream=`xmlstarlet sel -t -v /station/@stream "$inputdir/$i"`
+ echo -e "\x1B[32m/stream $shortcut \x1B[33m- $title \x1B[35m$topic\x1B[m"
+ done
+ else if [ "$1" = "off" ]; then
+ [ ! -d /tmp/noise ] || ( echo "no directory /tmp/noise; aborting" ; exit 1 )
+ [ -f /tmp/noise/stream.pid ] && ( kill ` cat /tmp/noise/stream.pid ` )
+ [ -e /tmp/noise/stream.pid ] && rm /tmp/noise/stream.pid || ( echo "can't remove /tmp/noise/stream.pid; aborting" ; exit 1 )
+ else
+ for i in `ls $inputdir` ; do
+ filename="$inputdir/$i"
+ shortcut=`xmlstarlet sel -t -v /station/@shortcut "$inputdir/$i"`
+ stream=`xmlstarlet sel -t -v /station/@stream "$inputdir/$i"`
+ if [ "$shortcut" == "$1" ]; then
+ [ ! -d /tmp/noise ] || ( umask 077 ; mkdir /tmp/noise ) || ( echo "can't create /tmp/noise; aborting" ; exit 1 )
+ [ -f /tmp/noise/stream.pid ] && ( kill ` cat /tmp/noise/stream.pid ` )
+ [ -e /tmp/noise/stream.pid ] && rm /tmp/noise/stream.pid || ( echo "can't remove /tmp/noise/stream.pid; aborting" ; exit 1 )
+ mplayer -cache 2048 -quiet "$stream" &
+ ( umask 077 ; echo $! > /tmp/noise/stream.pid )
+ break
+ fi
+ done || cat<<EOF
+\
+Keine Audiostreambeschreibung mit dem Namen
+
+ $1.EXT
+
+gefunden... am besten gleich anlegen:
+
+ ssh shack@shack.shack:noise/streams/
+
+folgende Dateiendungen werden erkannt: $ffs
+EOF
+ fi fi
+esac