From 9dcad72bd0b39a3d8dab2b128fe2383b11e49d04 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 9 Sep 2011 19:20:28 +0200 Subject: //streams: start w/o args uses the last stream --- streams/streams | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'streams') diff --git a/streams/streams b/streams/streams index 60a4bfc2..80c654ad 100755 --- a/streams/streams +++ b/streams/streams @@ -1,4 +1,8 @@ #! /bin/bash +set -euf + +stream_file=/tmp/krebs.stream.current + HERE=$(dirname $(readlink -f $0)) URLS=`cat $HERE/stream.db` CURRENT_STREAM="no stream" #will be set when calling `status` @@ -22,7 +26,12 @@ function start() { if echo "$URLS" | while read URL NAME; do if [ "$NAME" = "$REQ" ];then - tmux new-session -s streams -n streams -d "while sleep 1;do mplayer $URL;done" + tmux new-session -s streams -n streams -d " + while sleep 1; do + echo $NAME > $stream_file + mplayer $URL + done + " echo "** $REQ started" exit 1 fi @@ -97,7 +106,7 @@ Examples: case "$1" in start) - start $2 + start ${2-"`test -f $stream_file && cat $stream_file`"} ;; stop) stop -- cgit v1.2.3