]> git.plutz.net Git - serve0/commitdiff
slave remote player to local interface, so that tags can be processed
authorpaul <paul@plutz.net>
Fri, 17 Mar 2017 14:44:34 +0000 (14:44 +0000)
committerpaul <paul@plutz.net>
Fri, 17 Mar 2017 14:44:34 +0000 (14:44 +0000)
svn path=/trunk/; revision=179

actions/watch.sh
pages/playctl.sh
templates/playctl.html.sh

index 5aff94559b1c65d7e32759572d8a7110e711dbda..f79600984ad4dc89a4afd57161f3969a88d96431 100755 (executable)
@@ -36,8 +36,14 @@ fi
 
 case "$_COOKIE[watch]" in
   raspi)
-    rpiaddr="http://atoemchen.helmchyn.no-ip.biz/?action=watch"
-    redirect "${rpiaddr}&url=$(urlsafe "http://${HTTP_HOST}/${videourl}")&return=$(urlsafe "http://${HTTP_HOST}/${_POST[page]}")"
+    #rpiaddr="http://atoemchen.helmchyn.no-ip.biz/?action=watch"
+    #redirect "${rpiaddr}&url=$(urlsafe "http://${HTTP_HOST}/${videourl}")&return=$(urlsafe "http://${HTTP_HOST}/${_POST[page]}")"
+    ncat atoemchen 80 >&- <<-EOF
+       GET /?action=watch&url=$(urlsafe "http://${HTTP_HOST}/${videourl}") HTTP/1.1$(printf \\r)
+       Host: atoemchen$(printf \\r)
+       $(printf \\r)
+       EOF
+    redirect "?p=playctl&${watch_link}w=$(urlsafe "${_POST[page]}#${_GET[i]}")"
   ;;
   480p)
     [ $height -gt 480 ] && redirect "?action=transcode&i=${linkinfo}&t=480" \
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"
index 1d439e53ac93b72b2eb0f3aba26f1261f07b2b58..5d0159791e04095245ae9eaad0fbfe5d0b584dab 100755 (executable)
@@ -62,8 +62,8 @@ cat <<EOF
 <div id="playctl">
   <h1>$info</h1>
 
-  <form action="?action=playctl" method="post" class="playctl">
-    <input type="hidden" name="referrer" value="$(attribsafe "${REQUEST_URI}")">
+  <form action="${actionuri}" method="post" class="playctl">
+    <input type="hidden" name="referrer" value="$(attribsafe "//${HTTP_HOST}${REQUEST_URI}")">
     <fieldset class="playback">
       <button type="submit" name="seek" value="-60">&lt;&lt;&lt;</button>
       <button type="submit" name="seek" value="-10">&lt;&lt;</button>