summaryrefslogtreecommitdiffstats
path: root/streams
diff options
context:
space:
mode:
Diffstat (limited to 'streams')
-rw-r--r--streams/Makefile1
-rw-r--r--streams/stream.db5
-rwxr-xr-xstreams/streams53
3 files changed, 44 insertions, 15 deletions
diff --git a/streams/Makefile b/streams/Makefile
index 0922e38f..209eb656 100644
--- a/streams/Makefile
+++ b/streams/Makefile
@@ -9,3 +9,4 @@ all: $(streams)
$(streams):
@test -L $(INITD)$@ || test ! -e $(INITD)$@ && \
ln -n -s -f $$PWD/stream-starter $(INITD)$@ && echo "writing $@ to $(INITD)"
+ ln -sf $$PWD/streams ../bin/streams
diff --git a/streams/stream.db b/streams/stream.db
index 484abaad..47ccf7b5 100644
--- a/streams/stream.db
+++ b/streams/stream.db
@@ -2,3 +2,8 @@ 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
+http://localhost:8000/stream.ogg icecast
+http://stream2.jungletrain.net:8000 jungletrain
+http://playlist.tormentedradio.com/tormentedradio.pls tormented
+http://filebitch.shack:8000 mpd
diff --git a/streams/streams b/streams/streams
index eb1e6674..60a4bfc2 100755
--- a/streams/streams
+++ b/streams/streams
@@ -1,6 +1,10 @@
#! /bin/bash
HERE=$(dirname $(readlink -f $0))
URLS=`cat $HERE/stream.db`
+CURRENT_STREAM="no stream" #will be set when calling `status`
+if [ ! `id -u` -eq "0" ]; then
+ exec sudo "$0" "$@"
+fi
#if [ ! `id -u` -eq "0" ]; then
# echo "we are going sudo..."
@@ -11,14 +15,14 @@ function start() {
# start the given stream von $1
REQ=$1
tmux start-server
- if status; then
+ if status &>/dev/null ; then
echo "!! Stream already running!"
exit 1
fi
if echo "$URLS" | while read URL NAME; do
if [ "$NAME" = "$REQ" ];then
- tmux new-session -s streams -n streams -d "exec mplayer $URL"
+ tmux new-session -s streams -n streams -d "while sleep 1;do mplayer $URL;done"
echo "** $REQ started"
exit 1
fi
@@ -30,15 +34,39 @@ function start() {
function stop()
{
#stops every stream
- tmux kill-session -t streams || echo "!! killing session failed"
+ if status &>/dev/null; then
+ status | cut -d\ -f2 | xargs printf "** killing %s\n"
+ tmux kill-session -t streams 2>/dev/null || echo "!! killing session failed"
+ else
+ echo "** no stream running";
+ return 1
+ fi
}
function status()
{
- tmux has-session -t streams 2>/dev/null
- RET=$?
- tmux list-sessions 2>/dev/null
- return $RET
+ #tmux has-session -t streams 2>/dev/null
+ #RET=$?
+
+ #tmux list-sessions 2>/dev/null
+ #return $RET
+ EV="`ps -ef | grep mplayer`"
+ if echo "$URLS" | while read URL NAME; do
+ if [ "`echo "$EV" | grep \"$URL\"`" ] ;then
+ echo "** $NAME running ($URL)"
+ exit 1
+ fi
+ done; then
+ echo "** no stream running"
+ return 1
+ else
+ return 0
+ fi
+}
+function current()
+{
+
+ return 1
}
function list()
{
@@ -74,18 +102,13 @@ case "$1" in
stop)
stop
;;
- restart)
+ (switch|restart)
stop
start $2
;;
status)
- if status; then
- echo "** stream running"
- exit 0
- else
- echo "** Stream not running"
- exit 1
- fi
+ status
+ exit $?
;;
list)
list