From ae511b015a59ba72086e6d232c74d5845b71cbb8 Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 11 May 2016 13:07:01 +0000 Subject: [PATCH] increased response times svn path=/trunk/; revision=130 --- actions/playctl.sh | 2 ++ pages/list.sh | 4 +++- pages/playctl.sh | 21 +++++++++--------- templates/list.html.sh | 27 ++++++++++++++---------- templates/playpanel.html.sh | 41 ------------------------------------ templates/quicklinks.html.sh | 4 +--- templates/tree.html.sh | 4 +--- 7 files changed, 34 insertions(+), 69 deletions(-) delete mode 100755 templates/playpanel.html.sh diff --git a/actions/playctl.sh b/actions/playctl.sh index c4aff61..183bee6 100755 --- a/actions/playctl.sh +++ b/actions/playctl.sh @@ -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 diff --git a/pages/list.sh b/pages/list.sh index 284b918..0ee2282 100755 --- a/pages/list.sh +++ b/pages/list.sh @@ -140,4 +140,6 @@ thumblist() { done } -pagecount="$(( $(selectionlist | wc -l) / $pagesize + 1 ))" +pagecount() { + printf "$(( $(selectionlist | wc -l) / $pagesize + 1 ))" +} diff --git a/pages/playctl.sh b/pages/playctl.sh index c01b800..79122fd 100755 --- a/pages/playctl.sh +++ b/pages/playctl.sh @@ -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 } diff --git a/templates/list.html.sh b/templates/list.html.sh index 2e49dd5..859878d 100755 --- a/templates/list.html.sh +++ b/templates/list.html.sh @@ -29,24 +29,29 @@ cat <Clear All Advanced - Player + Player
- $(seq 1 $pagecount \ - | while read pn; do - plink="$(($pn * $pagesize - $pagesize + 1))" - printf '%s\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 '%s\n' "$([ $plink = $page ] && printf class=current)" "$page_link" "$plink" "$pn" + done + +cat < - $(. $_EXEC/templates/playpanel.html.sh) -
    - $(thumblist) +EOF + + thumblist + +cat < $(. $_EXEC/templates/tagger.html.sh) @@ -58,7 +63,7 @@ cat < - $(seq 1 $pagecount \ + $(seq 1 $(pagecount) \ | while read pn; do plink="$(($pn * $pagesize - $pagesize + 1))" printf '%s\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 index f3a9f15..0000000 --- a/templates/playpanel.html.sh +++ /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 . - -cat < - Hide -
    - - - - - - -
    - - -
    - $(for n in $(seq 0 5 100); do - printf '' "$([ "$volume" = "$n" ] && printf selected)" "$n" - done) -
    - -
    -
-EOF - -# vi:set filetype=html: diff --git a/templates/quicklinks.html.sh b/templates/quicklinks.html.sh index 345049b..d85b595 100755 --- a/templates/quicklinks.html.sh +++ b/templates/quicklinks.html.sh @@ -29,11 +29,9 @@ cat <Clear All Advanced - Player + Player - $(. $_EXEC/templates/playpanel.html.sh) -
    $(filelist) -- 2.39.2