X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;ds=sidebyside;f=actions%2Fwatch.sh;h=8d8ac3318e5aa0217f7f0dd5b4aecdef625d4324;hb=50ca23e58b678c818c2a8bb3a345136c1366047a;hp=cfa543723f289e1d1f6fe0a1ef29c36a0e10fbe8;hpb=ac2be5f4d78b67253b5b412b73f92d6a64405b32;p=serve0 diff --git a/actions/watch.sh b/actions/watch.sh index cfa5437..8d8ac33 100755 --- a/actions/watch.sh +++ b/actions/watch.sh @@ -64,7 +64,7 @@ case "$_COOKIE[watch]" in fifofile="${_DATA}/mplayer.fifo" statusfile="${_DATA}/mplayer.status" statusfile="/tmp/mplayer.status" - volume="$(validate "$(cat "${_DATA}/mplayer.volume")" '[1-9]?[0-9]|100' 20)" + volume="$(validate "$(cat "${_DATA}/mplayer.volume" || true)" '[1-9]?[0-9]|100' 20)" [ \! -p "$fifofile" ] && rm -f "$fifofile" && mkfifo -m 600 "$fifofile" debug PLAYURI "$playuri" @@ -79,18 +79,19 @@ case "$_COOKIE[watch]" in export DISPLAY=":0" uid="$(id |sed -rn '1s;.*uid=([0-9]+)[^0-9].*;\1;p')" export XDG_RUNTIME_DIR="/run/user/$uid" # required for Pulseaudio - xrandr >/dev/null # helps enable all screens - - # nohup /usr/bin/mplayer \ - # -slave -input file="$fifofile" \ - # -volume "$volume" \ - # "$playuri" >"$statusfile" 2>/dev/null & - - # MPlayer2: (statusline on stderr) - nohup /usr/bin/mplayer \ - --slave --input=file="$fifofile" \ - --volume="$volume" \ - "$playuri" 2>"$statusfile" >/dev/null & + xrandr || true >/dev/null # helps enable all screens + + if mplayer |grep -q MPlayer2; then + nohup /usr/bin/mplayer \ + --slave --input=file="$fifofile" \ + --volume="$volume" \ + "$playuri" 2>"$statusfile" >/dev/null & + else + nohup /usr/bin/mplayer \ + -slave -input file="$fifofile" \ + -volume "$volume" \ + "$playuri" >"$statusfile" 2>/dev/null & + fi chmod 600 "$statusfile"