Merge pull request #797 from AI0867/patch-1
authorPhilipp Hagemeister <phihag@phihag.de>
Mon, 22 Apr 2013 21:13:52 +0000 (14:13 -0700)
committerPhilipp Hagemeister <phihag@phihag.de>
Mon, 22 Apr 2013 21:13:52 +0000 (14:13 -0700)
Use standard unit symbols in format_bytes

youtube_dl/FileDownloader.py

index 7139adf6bb6490b31dc3661b0fc220df30b0dad2..100779756d956033ace52742d9be3ef13b821323 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)