X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=actions%2Fwatch.sh;h=b7fad863753d47f28bc40b94c5c9cd81e1a80d4d;hb=5667597778145b23dc04aa65e1e9ea3ac0b7fd97;hp=cfa543723f289e1d1f6fe0a1ef29c36a0e10fbe8;hpb=ac2be5f4d78b67253b5b412b73f92d6a64405b32;p=serve0 diff --git a/actions/watch.sh b/actions/watch.sh index cfa5437..b7fad86 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" @@ -73,24 +73,26 @@ case "$_COOKIE[watch]" in cp "$metafile" "$playmeta" else rm "$playmeta" - "${_EXEC}"/helpers/genmeta.sh "$playuri" "$playmeta" >/dev/null + "${_EXEC}"/helpers/genmeta.sh "$playuri" "$playmeta" >&- fi 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 >&- # helps enable all screens + xvkbd -text '\x+10000\y+10000' || true >&- + + if mplayer |grep -q MPlayer2; then + nohup /usr/bin/mplayer \ + --slave --input=file="$fifofile" \ + --volume="$volume" \ + "$playuri" 2>"$statusfile" >&- & + else + nohup /usr/bin/mplayer \ + -slave -input file="$fifofile" \ + -volume "$volume" \ + "$playuri" >"$statusfile" & + fi chmod 600 "$statusfile"