]> git.plutz.net Git - serve0/commitdiff
fix status bar, correct reading of mplayer output
authorpaul <paul@plutz.net>
Fri, 29 Apr 2016 12:53:09 +0000 (12:53 +0000)
committerpaul <paul@plutz.net>
Fri, 29 Apr 2016 12:53:09 +0000 (12:53 +0000)
svn path=/trunk/; revision=123

pages/playctl.sh
templates/playctl.html.sh

index c5d6c09fb1e9f30d7d5751ae79e30843b5a5e542..c4ece2c85c97ac1f15ac501f405bc37f5c14af8d 100755 (executable)
@@ -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
 }
index 1725f7f784ce1b7c489ca04a2cbe4ff409e6a5ed..6f435e7f4f6e5b379b82dc43ccf54f1ce8a1e2ad 100755 (executable)
@@ -107,7 +107,4 @@ progress \
   printf '<span class="progress"><span style="width: %s%%;">%s</span></span>\n' $n $n
 done
 
-
-
-
 # vi:set filetype=html: