X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=actions%2Fwatch.sh;h=e473ac4755d1479bb537272e2972090546effc8a;hb=c9a4356009019fd2ec4b6f38926fea236f4f2960;hp=b3463b9aac183627af0c1f04b700f6869e9661f7;hpb=aa4516d7090b7818127a1dd39a281059d3e042cc;p=serve0 diff --git a/actions/watch.sh b/actions/watch.sh index b3463b9..e473ac4 100755 --- a/actions/watch.sh +++ b/actions/watch.sh @@ -3,10 +3,10 @@ cgi_refdata info="${_GET[i]}" location="$(invalidate "${_GET[l]}" '(.*/)?\.\.(/.*)?|' /)" -order="${_REF[o]}" -search="${_REF[s]}" -filter="${_REF[f]}" -page="${_REF[pn]}" +order="${_POST[o]}" +search="${_POST[s]}" +filter="${_POST[f]}" +page="${_POST[pn]}" watch_link='' [ -n "$location" ] && watch_link="l=$(urlsafe "${location}")&" @@ -54,25 +54,40 @@ case "${_COOKIE[watch]}" in [ -n "$location" ] && playuri="${treeroot%/}/${location#/}" [ -n "$info" ] && playuri="${_DATA}/videos/$info" + metafile="${_DATA}/meta/${info}.meta" + + playmeta="${_DATA}/mplayer.meta" fifofile="${_DATA}/mplayer.fifo" statusfile="${_DATA}/mplayer.status" + statusfile="/tmp/mplayer.status" volume="$(validate "$(cat "${_DATA}/mplayer.volume")" '[1-9]?[0-9]|100' 20)" [ \! -p "$fifofile" ] && rm -f "$fifofile" && mkfifo -m 600 "$fifofile" - debug PLAYURI $playuri + debug PLAYURI "$playuri" + + if [ -f "$metafile" ]; then + cp "$metafile" "$playmeta" + else + rm "$playmeta" + "${_EXEC}"/helpers/genmeta.sh "$playuri" "$playmeta" >/dev/null + fi - DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/1006 \ - nohup /usr/bin/mplayer -ao pulse \ + 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 + + nohup /usr/bin/mplayer -ao pulse \ -slave -input file="$fifofile" \ -volume "$volume" \ "$playuri" >"$statusfile" 2>/dev/null & # # MPlayer2: - # DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/1006 \ - # nohup /usr/bin/mplayer -ao pulse --quiet \ + # nohup /usr/bin/mplayer -ao pulse \ # --slave --input=file="$fifofile" \ # --volume="$volume" \ - # "$playuri" >/dev/null 2>/dev/null & + # "$playuri" >"$statusfile" 2>/dev/null & + + chmod 600 "$statusfile" redirect "?p=playctl&${watch_link}" ;;