summaryrefslogtreecommitdiffstats
path: root/streams
diff options
context:
space:
mode:
authorroot <root@krebs>2011-09-09 19:20:28 +0200
committerroot <root@krebs>2011-09-09 19:20:28 +0200
commit9dcad72bd0b39a3d8dab2b128fe2383b11e49d04 (patch)
tree8ef656dcc10bd83753168ac0f2fbba955df6ec16 /streams
parent176c9ac08ad9c2ddc430b2d1a194f6be41115f5b (diff)
//streams: start w/o args uses the last stream
Diffstat (limited to 'streams')
-rwxr-xr-xstreams/streams13
1 files changed, 11 insertions, 2 deletions
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