mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-22 06:00:00 +00:00
Bugfix for ebe1b4e34f
This commit is contained in:
parent
84078a8b38
commit
1619ab3e67
2 changed files with 8 additions and 4 deletions
|
@ -630,6 +630,7 @@ def test_add_extra_info(self):
|
||||||
self.assertEqual(test_dict['playlist'], 'funny videos')
|
self.assertEqual(test_dict['playlist'], 'funny videos')
|
||||||
|
|
||||||
outtmpl_info = {
|
outtmpl_info = {
|
||||||
|
'id': '1234',
|
||||||
'id': '1234',
|
'id': '1234',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'width': None,
|
'width': None,
|
||||||
|
@ -754,6 +755,7 @@ def expect_same_infodict(out):
|
||||||
test('%(ext)c', 'm')
|
test('%(ext)c', 'm')
|
||||||
test('%(id)d %(id)r', "1234 '1234'")
|
test('%(id)d %(id)r', "1234 '1234'")
|
||||||
test('%(id)r %(height)r', "'1234' 1080")
|
test('%(id)r %(height)r', "'1234' 1080")
|
||||||
|
test('%(title5)a %(height)a', (R"'\xe1\xe9\xed \U0001d400' 1080", None))
|
||||||
test('%(ext)s-%(ext|def)d', 'mp4-def')
|
test('%(ext)s-%(ext|def)d', 'mp4-def')
|
||||||
test('%(width|0)04d', '0')
|
test('%(width|0)04d', '0')
|
||||||
test('a%(width|b)d', 'ab', outtmpl_na_placeholder='none')
|
test('a%(width|b)d', 'ab', outtmpl_na_placeholder='none')
|
||||||
|
|
|
@ -1328,17 +1328,19 @@ def create_key(outer_mobj):
|
||||||
value = str(value)[0]
|
value = str(value)[0]
|
||||||
else:
|
else:
|
||||||
fmt = str_fmt
|
fmt = str_fmt
|
||||||
elif fmt[-1] not in 'rs': # numeric
|
elif fmt[-1] not in 'rsa': # numeric
|
||||||
value = float_or_none(value)
|
value = float_or_none(value)
|
||||||
if value is None:
|
if value is None:
|
||||||
value, fmt = default, 's'
|
value, fmt = default, 's'
|
||||||
|
|
||||||
if sanitize:
|
if sanitize:
|
||||||
if fmt[-1] == 'r':
|
|
||||||
# If value is an object, sanitize might convert it to a string
|
# If value is an object, sanitize might convert it to a string
|
||||||
# So we convert it to repr first
|
# So we convert it to repr first
|
||||||
|
if fmt[-1] == 'r':
|
||||||
value, fmt = repr(value), str_fmt
|
value, fmt = repr(value), str_fmt
|
||||||
if fmt[-1] in 'csr':
|
elif fmt[-1] == 'a':
|
||||||
|
value, fmt = ascii(value), str_fmt
|
||||||
|
if fmt[-1] in 'csra':
|
||||||
value = sanitizer(initial_field, value)
|
value = sanitizer(initial_field, value)
|
||||||
|
|
||||||
key = '%s\0%s' % (key.replace('%', '%\0'), outer_mobj.group('format'))
|
key = '%s\0%s' % (key.replace('%', '%\0'), outer_mobj.group('format'))
|
||||||
|
|
Loading…
Reference in a new issue