|
|
@ -1379,6 +1379,12 @@ class YoutubeDL:
|
|
|
|
if not filename:
|
|
|
|
if not filename:
|
|
|
|
return None
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trim_file_name = self.params.get('trim_file_name', False)
|
|
|
|
|
|
|
|
if trim_file_name:
|
|
|
|
|
|
|
|
# https://github.com/yt-dlp/yt-dlp/issues/5526#issuecomment-1312783517
|
|
|
|
|
|
|
|
no_ext, *ext = filename.rsplit('.', info_dict.get('ext', '').count('.') + 1)
|
|
|
|
|
|
|
|
filename = join_nonempty(no_ext[:trim_file_name], *ext, delim='.')
|
|
|
|
|
|
|
|
|
|
|
|
if tmpl_type in ('', 'temp'):
|
|
|
|
if tmpl_type in ('', 'temp'):
|
|
|
|
final_ext, ext = self.params.get('final_ext'), info_dict.get('ext')
|
|
|
|
final_ext, ext = self.params.get('final_ext'), info_dict.get('ext')
|
|
|
|
if final_ext and ext and final_ext != ext and filename.endswith(f'.{final_ext}'):
|
|
|
|
if final_ext and ext and final_ext != ext and filename.endswith(f'.{final_ext}'):
|
|
|
@ -1388,12 +1394,6 @@ class YoutubeDL:
|
|
|
|
if force_ext:
|
|
|
|
if force_ext:
|
|
|
|
filename = replace_extension(filename, force_ext, info_dict.get('ext'))
|
|
|
|
filename = replace_extension(filename, force_ext, info_dict.get('ext'))
|
|
|
|
|
|
|
|
|
|
|
|
# https://github.com/blackjack4494/youtube-dlc/issues/85
|
|
|
|
|
|
|
|
trim_file_name = self.params.get('trim_file_name', False)
|
|
|
|
|
|
|
|
if trim_file_name:
|
|
|
|
|
|
|
|
no_ext, *ext = filename.rsplit('.', 2)
|
|
|
|
|
|
|
|
filename = join_nonempty(no_ext[:trim_file_name], *ext, delim='.')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return filename
|
|
|
|
return filename
|
|
|
|
except ValueError as err:
|
|
|
|
except ValueError as err:
|
|
|
|
self.report_error('Error in output template: ' + str(err) + ' (encoding: ' + repr(preferredencoding()) + ')')
|
|
|
|
self.report_error('Error in output template: ' + str(err) + ' (encoding: ' + repr(preferredencoding()) + ')')
|
|
|
|