]> git.plutz.net Git - serve0/blobdiff - pages/playctl.sh
slave remote player to local interface, so that tags can be processed
[serve0] / pages / playctl.sh
index 591efd6695d89c792edcca1cde960fc3d4f73e82..5fd5411323301fa7960475bc62b7c900f8c1da4a 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/zsh
 
-# Copyright 2014, 2016 Paul Hänsch
+# Copyright 2014, 2016, 2017 Paul Hänsch
 #
 # This file is part of Serve0.
 # 
@@ -25,10 +25,16 @@ directory="${location%/*}"
 statusfile="$_DATA/mplayer.status"
 statusfile="/tmp/mplayer.status"
 
-[ -n "$info" ] && video="${_DATA}/videos/$info" \
-               || video="${treeroot%/}/${location#/}"
+if [ -n "$info" ]; then
+  video="${_DATA}/videos/$info"
+  meta="${_DATA}/meta/${info}.meta"
+else
+  video="${treeroot%/}/${location#/}"
+  meta="${treeroot%/}${location%/*}/.index/${location##*/}.meta"
+fi
+
+[ -r "$meta" ] || meta="${_DATA}/mplayer.meta"
 
-meta="${_DATA}/mplayer.meta"
 tags="$(sed -n '2p' "$meta")"
 description="$(sed -n '3,$p' "$meta")"
 head -n1 "$meta" |read length width height TITLE
@@ -37,6 +43,12 @@ volume=$(validate "$(cat "$_DATA/mplayer.volume")" '[1-9]?[0-9]|100' 20)
 
 debug VIDEO: $video
 
+if [ "$_COOKIE[watch]" = raspi ]; then
+  actionuri='//atoemchen/?action=playctl'
+else
+  actionuri='?action=playctl'
+fi
+
 pa_sinks(){
   if which pactl >/dev/null; then
     export DISPLAY=":0"