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
done
}
-pagecount="$(( $(selectionlist | wc -l) / $pagesize + 1 ))"
+pagecount() {
+ printf "$(( $(selectionlist | wc -l) / $pagesize + 1 ))"
+}
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
}
<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>
<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"
+++ /dev/null
-# 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"><<<</button>
- <button type="submit" name="seek" value="-10"><<</button>
- <button type="submit" name="ctl" value="stop">■</button>
- <button type="submit" name="ctl" value="pause">|| / ▶</button>
- <button type="submit" name="seek" value="+10">>></button>
- <button type="submit" name="seek" value="+60">>>></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"> </button>' "$([ "$volume" = "$n" ] && printf selected)" "$n"
- done)
- <br>
- <button type="submit" name="osd" value="progression">Progress</button>
- </form>
- </div>
-EOF
-
-# vi:set filetype=html:
<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)
<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)