]> git.plutz.net Git - serve0/commitdiff
increased response times
authorpaul <paul@plutz.net>
Wed, 11 May 2016 13:07:01 +0000 (13:07 +0000)
committerpaul <paul@plutz.net>
Wed, 11 May 2016 13:07:01 +0000 (13:07 +0000)
svn path=/trunk/; revision=130

actions/playctl.sh
pages/list.sh
pages/playctl.sh
templates/list.html.sh
templates/playpanel.html.sh [deleted file]
templates/quicklinks.html.sh
templates/tree.html.sh

index c4aff61200e75fae13f7ef730586f7027e2043e5..183bee6fe0cb2ff6d1acc12ce41cdfd564801a6a 100755 (executable)
@@ -20,6 +20,8 @@ fifofile="${_DATA}/mplayer.fifo"
 statusfile="${_DATA}/mplayer.status"
 volfile="${_DATA}/mplayer.volume"
 
+printf '\rBREAK\r' >> "$statusfile"
+
 if   [ -n "${_POST[amp]+x}" ]; then
   amp $(validate "${_POST[amp]}" '(on|off)' off)
 elif [ -n "${_POST[vol]+x}" ]; then
index 284b9185740897cde272e5cc4776dbc3c9c7d15e..0ee2282bb32eece0369c3ad68e681c85c4c92702 100755 (executable)
@@ -140,4 +140,6 @@ thumblist() {
   done
 }
 
-pagecount="$(( $(selectionlist | wc -l) / $pagesize + 1 ))"
+pagecount() {
+  printf "$(( $(selectionlist | wc -l) / $pagesize + 1 ))"
+}
index c01b8007c61996acd02f8ace1935804cc4f32fed..79122fd00d9f4f5ea370abdc33ec4b3883b471b3 100755 (executable)
@@ -36,18 +36,19 @@ volume=$(validate "$(cat "$_DATA/mplayer.volume")" '[1-9]?[0-9]|100' 20)
 
 debug VIDEO: $video
 
+printf 'Refresh: 1\r\n'
+
 progress(){
-  discard="$(tail -n2 "$statusfile" |sed 's;[^\r];;g' |wc -c)"
+  cr="$(printf \\r)"
 
-  tail --pid=$$ -f "$statusfile" \
-  | tr '\r' '\n' \
-  | tail -n+$discard \
-  | sed -urn '1~10s;^.* V: +([0-9]+)(\.[0-9]+) A-V:.*$;\1;p' \
-  | while read m; do
-    printf "%d %d\n" "$(($m * 100 / $length))" "$m"
+  tail --pid=$$ -c0 -f "$statusfile" \
+  | while read -d "$cr" line; do
+    [ $line = "BREAK" ] && exit 0
+    printf '%s\n' "$line"
   done \
-  | while read n; do
-    [ "$n" != "$previous" ] && printf "%s\n" "$n"
-    previous="$n"
+  | sed -urn '1~12s;^.* V: *+([0-9]+)(\.[0-9]+) A-V:.*$;\1;p' \
+  | while read m; do
+    [ "$m" != "$previous" ] && printf "%d %d\n" "$(($m * 100 / $length))" "$m"
+    previous="$m"
   done
 }
index 2e49dd507fd01189b3fe99df7609cd0271a4067a..859878d7c8bb9b45be681ec2fbc690494777bf2b 100755 (executable)
@@ -29,24 +29,29 @@ cat <<EOF
 
     <a class="panel clearsearch" href="?">Clear All</a>
     <a class="panel toggle" href="#advfilter">Advanced</a>
-    <a class="panel toggle" href="#playctl">Player</a>
+    <a class="panel" href="?p=playctl">Player</a>
 
     <div class="pagination_nav">
       <label>Page:</label>
-      $(seq 1 $pagecount \
-        | while read pn; do
-          plink="$(($pn * $pagesize - $pagesize + 1))"
-          printf '<a %s href="?%spn=%s">%s</a>\n' "$([ $plink = $page ] && printf class=current)" "$page_link" "$plink" "$pn"
-        done
-       )
+EOF
+
+  seq 1 $(pagecount) \
+  | while read pn; do
+    plink="$(($pn * $pagesize - $pagesize + 1))"
+    printf '<a %s href="?%spn=%s">%s</a>\n' "$([ $plink = $page ] && printf class=current)" "$page_link" "$plink" "$pn"
+  done
+      
+cat <<EOF
     </div>
   </form>
 
-  $(. $_EXEC/templates/playpanel.html.sh)
-
   <form action="?action=multitag&${page_this}" method="post" accept-charset="UTF-8">
     <ul id="thumblist">
-      $(thumblist)
+EOF
+
+  thumblist
+
+cat <<EOF
     </ul>
     $(. $_EXEC/templates/tagger.html.sh)
   </form>
@@ -58,7 +63,7 @@ cat <<EOF
 
     <div class="pagination_nav">
       <label>Page:</label>
-      $(seq 1 $pagecount \
+      $(seq 1 $(pagecount) \
         | while read pn; do
           plink="$(($pn * $pagesize - $pagesize + 1))"
           printf '<a %s href="?%spn=%s">%s</a>\n' "$([ $plink = $page ] && printf class=current)" "$page_link" "$plink" "$pn"
diff --git a/templates/playpanel.html.sh b/templates/playpanel.html.sh
deleted file mode 100755 (executable)
index f3a9f15..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright 2016 Paul Hänsch
-#
-# This file is part of Serve0
-# 
-# Serve0 is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# Serve0 is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Affero General Public License for more details.
-# 
-# You should have received a copy of the GNU Affero General Public License
-# along with Serve0  If not, see <http://www.gnu.org/licenses/>. 
-
-cat <<EOF
-  <div class="panel" id="playctl">
-     <a class="panel toggle" href="#">Hide</a>
-     <form action="?action=playctl" method="post">
-       <button type="submit" name="seek" value="-60">&lt;&lt;&lt;</button>
-       <button type="submit" name="seek" value="-10">&lt;&lt;</button>
-       <button type="submit" name="ctl" value="stop">&#x25a0;</button>
-       <button type="submit" name="ctl" value="pause">|| / &#x25b6;</button>
-       <button type="submit" name="seek" value="+10">&gt;&gt;</button>
-       <button type="submit" name="seek" value="+60">&gt;&gt;&gt;</button>
-       <br>
-       <button type="submit" name="amp" value="off">Amp Off</button>
-       <button type="submit" name="amp" value="on">Amp On</button>
-       <br>
-       $(for n in $(seq 0 5 100); do
-         printf '<button class="%s" type="submit" name="vol" value="%s">&nbsp;</button>' "$([ "$volume" = "$n" ] && printf selected)" "$n"
-       done)
-       <br>
-       <button type="submit" name="osd" value="progression">Progress</button>
-     </form>
-  </div>
-EOF
-
-# vi:set filetype=html:
index 345049b73cb0531f93e91d33a5b9b0054ed3ffc3..d85b59512ed475e01b337f6a0c262ff009dec9bf 100755 (executable)
@@ -29,11 +29,9 @@ cat <<EOF
 
     <a class="panel clearsearch" href="?">Clear All</a>
     <a class="panel toggle" href="#advfilter">Advanced</a>
-    <a class="panel toggle" href="#playctl">Player</a>
+    <a class="panel" href="?p=playctl">Player</a>
   </form>
 
-  $(. $_EXEC/templates/playpanel.html.sh)
-
   <p class="quicklinks">
     <label class="quicklinks">Most recent</label>
     $(quicklinks)
index 1b2a38a18cc4a9ad841225f76119dc91b0985044..43820e697f67ac61f65f0932b6292d33272fb5b1 100755 (executable)
@@ -21,11 +21,9 @@ cat <<EOF
     <input type="submit" name="submit" value="Find">
 
     <a class="panel clearsearch" href="?p=tree">Clear All</a>
-    <a class="panel toggle" href="#playctl">Player</a>
+    <a class="panel" href="?p=playctl">Player</a>
   </form>
 
-  $(. $_EXEC/templates/playpanel.html.sh)
-
   <form action="?action=multitag&${page_this}" method="post" accept-charset="UTF-8">
     <ul id="thumblist">
       $(filelist)