1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-12-15 12:45:27 +00:00

restore previous join_nonempty()

This commit is contained in:
ds
2023-08-25 23:20:46 +03:00
parent fcafc42927
commit 46cebee490
2 changed files with 5 additions and 3 deletions

View File

@@ -1379,11 +1379,13 @@ class YoutubeDL:
if not filename:
return None
trim_file_name = self.params.get('trim_file_name', False)
trim_file_name = self.params.get('trim_file_name')
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='.')
# cut filename and remove trailing spaces and extra dots
name = no_ext[:trim_file_name].strip().rstrip('.')
filename = join_nonempty(name, *ext, delim='.')
if tmpl_type in ('', 'temp'):
final_ext, ext = self.params.get('final_ext'), info_dict.get('ext')