mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-05 08:40:04 +01:00
parent
a047eeb6d2
commit
124bc071ee
@ -2675,16 +2675,17 @@ def compatible_formats(formats):
|
|||||||
info_dict['ext'] = 'mkv'
|
info_dict['ext'] = 'mkv'
|
||||||
self.report_warning(
|
self.report_warning(
|
||||||
'Requested formats are incompatible for merge and will be merged into mkv.')
|
'Requested formats are incompatible for merge and will be merged into mkv.')
|
||||||
|
new_ext = info_dict['ext']
|
||||||
|
|
||||||
def correct_ext(filename):
|
def correct_ext(filename, ext=new_ext):
|
||||||
if filename == '-':
|
if filename == '-':
|
||||||
return filename
|
return filename
|
||||||
filename_real_ext = os.path.splitext(filename)[1][1:]
|
filename_real_ext = os.path.splitext(filename)[1][1:]
|
||||||
filename_wo_ext = (
|
filename_wo_ext = (
|
||||||
os.path.splitext(filename)[0]
|
os.path.splitext(filename)[0]
|
||||||
if filename_real_ext == old_ext
|
if filename_real_ext in (old_ext, new_ext)
|
||||||
else filename)
|
else filename)
|
||||||
return '%s.%s' % (filename_wo_ext, info_dict['ext'])
|
return '%s.%s' % (filename_wo_ext, ext)
|
||||||
|
|
||||||
# Ensure filename always has a correct extension for successful merge
|
# Ensure filename always has a correct extension for successful merge
|
||||||
full_filename = correct_ext(full_filename)
|
full_filename = correct_ext(full_filename)
|
||||||
@ -2729,7 +2730,9 @@ def correct_ext(filename):
|
|||||||
del new_info['requested_formats']
|
del new_info['requested_formats']
|
||||||
new_info.update(f)
|
new_info.update(f)
|
||||||
if temp_filename != '-':
|
if temp_filename != '-':
|
||||||
fname = prepend_extension(temp_filename, 'f%s' % f['format_id'], new_info['ext'])
|
fname = prepend_extension(
|
||||||
|
correct_ext(temp_filename, new_info['ext']),
|
||||||
|
'f%s' % f['format_id'], new_info['ext'])
|
||||||
if not self._ensure_dir_exists(fname):
|
if not self._ensure_dir_exists(fname):
|
||||||
return
|
return
|
||||||
downloaded.append(fname)
|
downloaded.append(fname)
|
||||||
|
Loading…
Reference in New Issue
Block a user