]> git.plutz.net Git - serve0/blobdiff - actions/watch.sh
generate fresh meta file when playing from directory
[serve0] / actions / watch.sh
index c198f4a000f851ebb5a1c48c97133ee3747e2340..796c654608ba654abf171f79d8a4a78bd6ea8274 100755 (executable)
@@ -54,15 +54,35 @@ 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"
     volume="$(validate "$(cat "${_DATA}/mplayer.volume")" '[1-9]?[0-9]|100' 20)"
     [ \! -p "$fifofile" ] && rm -f "$fifofile" && mkfifo -m 600 "$fifofile"
 
+    debug PLAYURI "$playuri"
+
+    if [ -f "$metafile" ]; done
+      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 --quiet \
-      --slave --input=file="$fifofile" \
-      --volume="$volume" \
-      "$playuri" >/dev/null 2>/dev/null &
+      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 \
+    #   --slave --input=file="$fifofile" \
+    #   --volume="$volume" \
+    #   "$playuri" >/dev/null 2>/dev/null &
 
     redirect "?p=playctl&${watch_link}"
   ;;