Use standard unit symbols in format_bytes
authorAlexander van Gessel <AI0867@gmail.com>
Sat, 20 Apr 2013 23:38:37 +0000 (02:38 +0300)
committerAlexander van Gessel <AI0867@gmail.com>
Sat, 20 Apr 2013 23:38:37 +0000 (02:38 +0300)
youtube_dl/FileDownloader.py

index 9c0c42f8d44ab5a85df6fd68f272869ca546f940..19766153c477dd7a90bb3282ec51c9ea1001274e 100644 (file)
@@ -121,7 +121,7 @@ class FileDownloader(object):
             exponent = 0
         else:
             exponent = int(math.log(bytes, 1024.0))
-        suffix = 'bkMGTPEZY'[exponent]
+        suffix = ['B','KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB'][exponent]
         converted = float(bytes) / float(1024 ** exponent)
         return '%.2f%s' % (converted, suffix)