diff options
-rw-r--r-- | streams/Makefile | 13 | ||||
-rwxr-xr-x | streams/deepmix | 26 | ||||
-rwxr-xr-x | streams/radiotux | 29 | ||||
-rwxr-xr-x | streams/stream-starter (renamed from streams/groove) | 9 | ||||
-rw-r--r-- | streams/stream.db | 3 | ||||
-rwxr-xr-x | streams/streams | 9 |
6 files changed, 20 insertions, 69 deletions
diff --git a/streams/Makefile b/streams/Makefile index 9f3076c0..0922e38f 100644 --- a/streams/Makefile +++ b/streams/Makefile @@ -1,10 +1,11 @@ -INITD = /etc/init.d/ -streams = groove deepmix radiotux -.PHONY: all -.PHONY: $(streams) +INITD = $(shell test -e /etc/rc.d/ && echo /etc/rc.d/ || echo /etc/init.d/) +streams = $(shell cut -d\ -f2 stream.db) +CURRDIR = ${PWD} +.PHONY: all $(streams) all: $(streams) - update-rc.d groove defaults + @update-rc.d groove defaults 2>/dev/null || echo "[31;1m**[31;1;5m put groove daemon in DAEMONS in /etc/rc.conf[m" $(streams): - cp $@ $(INITD)$@ + @test -L $(INITD)$@ || test ! -e $(INITD)$@ && \ + ln -n -s -f $$PWD/stream-starter $(INITD)$@ && echo "writing $@ to $(INITD)" diff --git a/streams/deepmix b/streams/deepmix deleted file mode 100755 index b8f8fba8..00000000 --- a/streams/deepmix +++ /dev/null @@ -1,26 +0,0 @@ -#! /bin/bash -set -euf -CMD="mplayer http://deepmix.ru/deepmix128.pls" -function start() { - stop - tmux start-server - tmux new-session -d "$CMD" -} -function stop() { - pkill mplayer || : -} -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - *) - echo "aidsballs" - ;; -esac diff --git a/streams/radiotux b/streams/radiotux deleted file mode 100755 index 9d671493..00000000 --- a/streams/radiotux +++ /dev/null @@ -1,29 +0,0 @@ -#! /bin/bash -set -euf -function stop() -{ - pkill mplayer || true -} - -CMD="while true; do exec mplayer http://streams.xenim.de/radiotux.ogg; sleep 1;done" -case "$1" in - start) - stop - if tmux list-sessions; - then - tmux new-window "$CMD" & - else - tmux new-session "$CMD" & - fi - ;; - stop) - stop - ;; - restart) - stop - start - ;; - *) - echo "aidsballs" - ;; -esac diff --git a/streams/groove b/streams/stream-starter index 8c2faddd..4d3a406f 100755 --- a/streams/groove +++ b/streams/stream-starter @@ -1,14 +1,17 @@ #! /bin/bash set -euf -STR=$PWD/streams +HERE=$(dirname $(readlink -f $0)) +STR=$HERE/streams +NAME=`basename $0` case "$1" in start) - $STR start groove + $STR start $NAME + ;; stop) $STR stop ;; restart) - $STR restart groove + $STR restart $NAME ;; *) echo "aidsballs" diff --git a/streams/stream.db b/streams/stream.db new file mode 100644 index 00000000..168cc68d --- /dev/null +++ b/streams/stream.db @@ -0,0 +1,3 @@ +http://somafm.com/groovesalad.pls groove +http://deepmix.ru/deepmix128.pls deepmix +http://streams.xenim.de/radiotux.ogg radiotux diff --git a/streams/streams b/streams/streams index f3cbc300..a8408b4a 100755 --- a/streams/streams +++ b/streams/streams @@ -1,7 +1,6 @@ -#! /bin/sh -URLS="http://somafm.com/groovesalad.pls groove -http://deepmix.ru/deepmix128.pls deepmix -http://streams.xenim.de/radiotux.ogg radiotux" +#! /bin/bash +HERE=$(dirname $(readlink -f $0)) +URLS=`cat $HERE/stream.db` function start() { # start the given stream von $1 @@ -19,7 +18,7 @@ function start() { exit 1 fi done; then - echo "!! Stream not found!" + echo "!! Stream '$REQ' not found!" exit 1 fi } |