aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/YoutubeDL.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-12-30 08:43:40 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-12-30 08:44:18 +0530
commitabbeeebc4c20bc5c690d96c83e91e89effd04b81 (patch)
tree4e7d0e862180de6818efad0d4f438a36c3bf36ea /yt_dlp/YoutubeDL.py
parent2c539d493a4fa69ac89e77bacc7497e0b2d72426 (diff)
downloadhypervideo-pre-abbeeebc4c20bc5c690d96c83e91e89effd04b81.tar.lz
hypervideo-pre-abbeeebc4c20bc5c690d96c83e91e89effd04b81.tar.xz
hypervideo-pre-abbeeebc4c20bc5c690d96c83e91e89effd04b81.zip
[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
Diffstat (limited to 'yt_dlp/YoutubeDL.py')
-rw-r--r--yt_dlp/YoutubeDL.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index 1d1429b5f..9cec43680 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -1166,7 +1166,9 @@ class YoutubeDL(object):
'NF%s%s' % ('K' if '+' in flags else '', 'D' if '#' in flags else 'C'),
value), str_fmt
elif fmt[-1] == 'D': # decimal suffix
- value, fmt = format_decimal_suffix(value, f'%{fmt[:-1]}f%s' if fmt[:-1] else '%d%s'), 's'
+ num_fmt, fmt = fmt[:-1].replace('#', ''), 's'
+ value = format_decimal_suffix(value, f'%{num_fmt}f%s' if num_fmt else '%d%s',
+ factor=1024 if '#' in flags else 1000)
elif fmt[-1] == 'S': # filename sanitization
value, fmt = filename_sanitizer(initial_field, value, restricted='#' in flags), str_fmt
elif fmt[-1] == 'c':