X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=actions%2Fwatch.sh;h=c198f4a000f851ebb5a1c48c97133ee3747e2340;hb=623e13703a176cf67053c5e21a6d2c71f5a96c55;hp=b79de8758d5497a50c305f585ca166cb0cba6ba3;hpb=c99ab651783572b0a4e6dc76e93f60418cdf683b;p=serve0 diff --git a/actions/watch.sh b/actions/watch.sh index b79de87..c198f4a 100755 --- a/actions/watch.sh +++ b/actions/watch.sh @@ -51,12 +51,20 @@ case "${_COOKIE[watch]}" in redirect "$videourl" ;; server) - if [ -n "$info" ]; then - DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/1006 nohup /usr/bin/mplayer -ao pulse --quiet "${_DATA}/videos/$info" >/dev/null 2>/dev/null & - elif [ -n "$location" ]; then - DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/1006 nohup /usr/bin/mplayer -ao pulse --quiet "${treeroot%/}/${location#/}" >/dev/null 2>/dev/null & - fi - redirect "$HTTP_REFERER#$linkinfo" + [ -n "$location" ] && playuri="${treeroot%/}/${location#/}" + [ -n "$info" ] && playuri="${_DATA}/videos/$info" + + fifofile="${_DATA}/mplayer.fifo" + volume="$(validate "$(cat "${_DATA}/mplayer.volume")" '[1-9]?[0-9]|100' 20)" + [ \! -p "$fifofile" ] && rm -f "$fifofile" && mkfifo -m 600 "$fifofile" + + DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/1006 \ + nohup /usr/bin/mplayer -ao pulse --quiet \ + --slave --input=file="$fifofile" \ + --volume="$volume" \ + "$playuri" >/dev/null 2>/dev/null & + + redirect "?p=playctl&${watch_link}" ;; *) redirect "?p=view&${watch_link}" ;;