mirror of
https://github.com/yt-dlp/yt-dlp
synced 2024-12-27 21:59:17 +01:00
parent
a047eeb6d2
commit
124bc071ee
1 changed files with 7 additions and 4 deletions
|
@ -2675,16 +2675,17 @@ class YoutubeDL(object):
|
|||
info_dict['ext'] = 'mkv'
|
||||
self.report_warning(
|
||||
'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 == '-':
|
||||
return filename
|
||||
filename_real_ext = os.path.splitext(filename)[1][1:]
|
||||
filename_wo_ext = (
|
||||
os.path.splitext(filename)[0]
|
||||
if filename_real_ext == old_ext
|
||||
if filename_real_ext in (old_ext, new_ext)
|
||||
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
|
||||
full_filename = correct_ext(full_filename)
|
||||
|
@ -2729,7 +2730,9 @@ class YoutubeDL(object):
|
|||
del new_info['requested_formats']
|
||||
new_info.update(f)
|
||||
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):
|
||||
return
|
||||
downloaded.append(fname)
|
||||
|
|
Loading…
Reference in a new issue