From: paul Date: Fri, 29 Apr 2016 12:53:09 +0000 (+0000) Subject: fix status bar, correct reading of mplayer output X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=1be65d11fc6ac0693f72ca442fcc4ccb24fd746a;p=serve0 fix status bar, correct reading of mplayer output svn path=/trunk/; revision=123 --- diff --git a/pages/playctl.sh b/pages/playctl.sh index c5d6c09..c4ece2c 100755 --- a/pages/playctl.sh +++ b/pages/playctl.sh @@ -45,9 +45,12 @@ debug VIDEO: $video progress(){ tail --pid=$$ -f "$statusfile" \ | tr '\r' '\n' \ - | sed -urn 's;^.* ([0-9]{1,3})(,[0-9]+)?% *$;\1;p' \ + | sed -urn '1~5s;^.* V: +([0-9]+)(\.[0-9]+) A-V:.*$;\1;p' \ + | while read m; do + printf "%s\n" "$(($m * 100 / $length))" + done \ | while read n; do - [ "$n" != "$previous" ] && printf "%s\n" "$((100 - $n))" + [ "$n" != "$previous" ] && printf "%s\n" "$n" previous=$n done } diff --git a/templates/playctl.html.sh b/templates/playctl.html.sh index 1725f7f..6f435e7 100755 --- a/templates/playctl.html.sh +++ b/templates/playctl.html.sh @@ -107,7 +107,4 @@ progress \ printf '%s\n' $n $n done - - - # vi:set filetype=html: