1
0
mirror of https://github.com/yt-dlp/yt-dlp synced 2025-07-01 11:32:52 -05: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:
pukkandan
2021-12-30 08:43:40 +05:30
parent 2c539d493a
commit abbeeebc4c
4 changed files with 12 additions and 6 deletions

View File

@ -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':