mirror of
https://github.com/LucBerge/yt-dlp.git
synced 2025-03-17 19:57:52 +03:00
[outtmpl] Alternate form for D
and fix suffix's case
Fixes: https://github.com/yt-dlp/yt-dlp/issues/2085#issuecomment-1002247689, https://github.com/yt-dlp/yt-dlp/pull/2132/files#r775729811
This commit is contained in:
parent
2c539d493a
commit
abbeeebc4c
4 changed files with 12 additions and 6 deletions
|
@ -2116,9 +2116,11 @@ def format_decimal_suffix(num, fmt='%d%s', *, factor=1000):
|
|||
if num is None:
|
||||
return None
|
||||
exponent = 0 if num == 0 else int(math.log(num, factor))
|
||||
suffix = ['', *'KMGTPEZY'][exponent]
|
||||
suffix = ['', *'kMGTPEZY'][exponent]
|
||||
if factor == 1024:
|
||||
suffix = {'k': 'Ki', '': ''}.get(suffix, f'{suffix}i')
|
||||
converted = num / (factor ** exponent)
|
||||
return fmt % (converted, f'{suffix}i' if suffix and factor == 1024 else suffix)
|
||||
return fmt % (converted, suffix)
|
||||
|
||||
|
||||
def format_bytes(bytes):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue