mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-07-31 12:00:45 -07:00
Merge ffd4b5970d
into c052a16f72
This commit is contained in:
commit
d35a70d8e9
2 changed files with 20 additions and 16 deletions
|
@ -3586,10 +3586,12 @@ def format_bytes(bytes):
|
|||
if bytes == 0.0:
|
||||
exponent = 0
|
||||
else:
|
||||
exponent = int(math.log(bytes, 1024.0))
|
||||
# Display user-friendly values, e.g. "1001.45 KiB" is much less
|
||||
# user-friendly than "1.00 MiB"
|
||||
exponent = int(math.log(bytes, 1000.0))
|
||||
suffix = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'][exponent]
|
||||
converted = float(bytes) / float(1024 ** exponent)
|
||||
return '%.2f%s' % (converted, suffix)
|
||||
return '%.2f %s' % (converted, suffix)
|
||||
|
||||
|
||||
def lookup_unit_table(unit_table, s):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue