]> git.plutz.net Git - serve0/commitdiff
show time in progress bar
authorpaul <paul@plutz.net>
Wed, 4 May 2016 10:12:20 +0000 (10:12 +0000)
committerpaul <paul@plutz.net>
Wed, 4 May 2016 10:12:20 +0000 (10:12 +0000)
svn path=/trunk/; revision=125

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

index c4ece2c85c97ac1f15ac501f405bc37f5c14af8d..11507803019f8d916d1e500ce772bc5b91dade49 100755 (executable)
@@ -47,10 +47,10 @@ progress(){
   | tr '\r' '\n' \
   | sed -urn '1~5s;^.* V: +([0-9]+)(\.[0-9]+) A-V:.*$;\1;p' \
   | while read m; do
-    printf "%s\n" "$(($m * 100 / $length))"
+    printf "%d %d:%02d\n" "$(($m * 100 / $length))" "$(($m / 60))" "$(($m % 60))"
   done \
   | while read n; do
     [ "$n" != "$previous" ] && printf "%s\n" "$n"
-    previous=$n
+    previous="$n"
   done
 }
index 6f435e7f4f6e5b379b82dc43ccf54f1ce8a1e2ad..62fe1d262a1e48105968636462a56cc0e3a6a2cb 100755 (executable)
@@ -103,8 +103,8 @@ EOF
 
 cnt=0
 progress \
-| while read n; do
-  printf '<span class="progress"><span style="width: %s%%;">%s</span></span>\n' $n $n
+| while read p t; do
+  printf '<span class="progress"><span style="width: %d%%;">%s</span></span>\n' "${p}" "${t}"
 done
 
 # vi:set filetype=html: