summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@also>2011-08-04 01:22:35 +0200
committertv <tv@also>2011-08-04 01:22:35 +0200
commit5dd97fe976c29a45fd0fabd9599b11b16efc57ec (patch)
tree30d344e3e6d56b94db8494e751512adb0d3ea13c
parent212540303532a37ed24d79b13bce44ec763e4e44 (diff)
parent92c131a9af262c500de1b131399bbd96887e8ed2 (diff)
Merge branch 'master' of github.com:krebscode/painload
-rw-r--r--streams/Makefile13
-rwxr-xr-xstreams/deepmix26
-rwxr-xr-xstreams/radiotux29
-rwxr-xr-xstreams/stream-starter (renamed from streams/groove)9
-rw-r--r--streams/stream.db3
-rwxr-xr-xstreams/streams9
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 "** put groove daemon in DAEMONS in /etc/rc.conf"
$(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
}