]> code.delx.au - youtube-cgi/blobdiff - youtube.cgi
print a newline at the end
[youtube-cgi] / youtube.cgi
index 17fcf1697b517ec053abb2ff98a6dfd74202ea93..409b025838ea87b59fa018774a2cd9a4f8655b7b 100755 (executable)
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 
+from __future__ import division
+
 import cookielib
 import cgi
 import itertools
@@ -27,6 +29,8 @@ MIMETYPES = {
 }
 
 QUALITIES = {
+       "hd1080": 5,
+       "hd720": 4,
        "large": 3,
        "medium": 2,
        "small": 1,
@@ -218,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
@@ -241,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]