]> code.delx.au - youtube-cgi/commitdiff
show decimal places in copy progress
authorJames Bunton <jamesbunton@delx.net.au>
Wed, 19 Sep 2012 07:51:08 +0000 (17:51 +1000)
committerJames Bunton <jamesbunton@delx.net.au>
Wed, 19 Sep 2012 07:51:08 +0000 (17:51 +1000)
youtube.cgi

index f75d511cc2e1f6ef720201e00cafba1cd9dd8b7a..87f8db9f0b3219c47a7a043b34afbcfa1337a7c7 100755 (executable)
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 
+from __future__ import division
+
 import cookielib
 import cgi
 import itertools
@@ -220,7 +222,7 @@ def copy_with_progress(total_size, infile, outfile):
                        if size < 1024:
                                break
                        size /= 1024
-               return "%d %s" % (size, suffix)
+               return "%.2f %s" % (size, suffix)
 
        start_ts = time.time()
        last_ts = 0