mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-05 02:19:36 +02:00
parent
ee8dd27a73
commit
5c22c63da3
@ -1186,12 +1186,8 @@ def _prepare_filename(self, info_dict, tmpl_type='default'):
|
|||||||
# https://github.com/blackjack4494/youtube-dlc/issues/85
|
# https://github.com/blackjack4494/youtube-dlc/issues/85
|
||||||
trim_file_name = self.params.get('trim_file_name', False)
|
trim_file_name = self.params.get('trim_file_name', False)
|
||||||
if trim_file_name:
|
if trim_file_name:
|
||||||
fn_groups = filename.rsplit('.')
|
no_ext, *ext = filename.rsplit('.', 2)
|
||||||
ext = fn_groups[-1]
|
filename = join_nonempty(no_ext[:trim_file_name], *ext, delim='.')
|
||||||
sub_ext = ''
|
|
||||||
if len(fn_groups) > 2:
|
|
||||||
sub_ext = fn_groups[-2]
|
|
||||||
filename = join_nonempty(fn_groups[0][:trim_file_name], sub_ext, ext, delim='.')
|
|
||||||
|
|
||||||
return filename
|
return filename
|
||||||
except ValueError as err:
|
except ValueError as err:
|
||||||
|
Loading…
Reference in New Issue
Block a user