]> code.delx.au - youtube-cgi/blobdiff - youtube.cgi
print a newline at the end
[youtube-cgi] / youtube.cgi
index f75d511cc2e1f6ef720201e00cafba1cd9dd8b7a..409b025838ea87b59fa018774a2cd9a4f8655b7b 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
@@ -243,6 +245,9 @@ def copy_with_progress(total_size, infile, outfile):
                outfile.write(buf)
                bytes_read += len(buf)
 
+       # Newline at the end
+       print
+
 def main():
        try:
                url = sys.argv[1]