diff options
author | makefu <github@syntax-fehler.de> | 2011-08-04 19:52:04 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2011-08-04 19:52:04 +0200 |
commit | 082a2ed2761ea1dd3bd0a30d2109962ef29377f4 (patch) | |
tree | 70c1a0d04467d929bc24dad2201e024e6359fa57 | |
parent | fba4d3c738a73d8f3ea05fbec7ee0b51da1ef854 (diff) | |
parent | bb394845aa08007d3c947ff0ef50e84badefd903 (diff) |
Merge branch 'master' of github.com:krebscode/painload
-rwxr-xr-x | cholerab/ttycnser | 27 | ||||
-rwxr-xr-x | host/dist/arch/getsize | 17 | ||||
-rwxr-xr-x | noise/modules/stream | 66 | ||||
-rw-r--r-- | streams/stream.db | 2 | ||||
-rwxr-xr-x | streams/streams | 28 |
5 files changed, 74 insertions, 66 deletions
diff --git a/cholerab/ttycnser b/cholerab/ttycnser new file mode 100755 index 00000000..0972dbbb --- /dev/null +++ b/cholerab/ttycnser @@ -0,0 +1,27 @@ +#! /bin/sh +set -euf + +tty="${TMPDIR-/tmp}/ttycnser.$LOGNAME.tty" + +case "${mode-server}" in + (server) + host=0.0.0.0 + port=8080 + export mode=client + echo "ttycnser @ $host $port" >&2 + exec tcpserver $host $port "$0" + ;; + (client) + line="`read line && echo "$line"`" + echo -n '7[2;1H[2K[33;1m>>>> '"$line"'8' > "$tty" + ;; + (install) + # TODO tell the user to do something like + # PROMPT_COMMAND="`mode=install ~/p/krebscode/painload/cholerab/ttycnser`" + echo "ln -snf '`tty`' '$tty'" + ;; + (*) + echo 'Error 1: You are made of stupid!' >&2 + exit 23 + ;; +esac diff --git a/host/dist/arch/getsize b/host/dist/arch/getsize new file mode 100755 index 00000000..d099c9e2 --- /dev/null +++ b/host/dist/arch/getsize @@ -0,0 +1,17 @@ +#! /bin/sh +set -euf +sed -rn ' + /^Name/{ + s/^Name *: *(.*)$/\1/ + T + h + } + /^Installed Size/{ + s/^Installed Size *: *(.*)$/ \1/ + T + H + x + s/\n//g + p + } +' | awk '{print$2$3" "$1}' | sort -n diff --git a/noise/modules/stream b/noise/modules/stream index 1e6fd0c5..476ffff9 100755 --- a/noise/modules/stream +++ b/noise/modules/stream @@ -1,64 +1,2 @@ -#! /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 -[33m\ -Keine Audiostreambeschreibung mit dem Namen - - [4m$1[;33m.EXT - -gefunden... am besten gleich anlegen: - - ssh shack@shack.shack:noise/streams/ - -folgende Dateiendungen werden erkannt: $ffs[m -EOF - fi fi -esac +#!/bin/sh +sudo -u krebs /krebs/streams/streams "$@" diff --git a/streams/stream.db b/streams/stream.db index 168cc68d..6ca9a627 100644 --- a/streams/stream.db +++ b/streams/stream.db @@ -1,3 +1,5 @@ http://somafm.com/groovesalad.pls groove http://deepmix.ru/deepmix128.pls deepmix http://streams.xenim.de/radiotux.ogg radiotux +http://bassdrive.com/v2/streams/BassDrive.pls bassdrive +http://somafm.com/illstreet.pls illstreet diff --git a/streams/streams b/streams/streams index 034d68a1..c5e9e471 100755 --- a/streams/streams +++ b/streams/streams @@ -6,6 +6,11 @@ if [ ! `id -u` -eq "0" ]; then exec sudo "$0" "$@" fi +#if [ ! `id -u` -eq "0" ]; then +# echo "we are going sudo..." +# exec sudo "$0" "$@" +#fi + function start() { # start the given stream von $1 REQ=$1 @@ -71,7 +76,23 @@ function list() } - +function shorthelp() +{ + echo "start|stop|restart|status|list [audio stream]" +} +function longhelp() +{ + B=`basename $0` + echo -n "Usage: $B " + shorthelp + echo "[32;1m get all available streams with [31;1;4m'/$B list'[m +Examples: + $B list + $B start groove + $B restart deepmix + $B status + $B stop" +} case "$1" in @@ -92,7 +113,10 @@ case "$1" in list) list ;; + (--help) + shorthelp + ;; *) - echo "aidsballs" + longhelp ;; esac |