mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-07-09 06:48:30 +00:00
Rename 'notrim' option to 'none' to be consistent with other options
This commit is contained in:
parent
5c1f6e7329
commit
d482cee11d
@ -715,7 +715,7 @@ def test_add_extra_info(self):
|
|||||||
def test_prepare_outtmpl_and_filename(self):
|
def test_prepare_outtmpl_and_filename(self):
|
||||||
def test(tmpl, expected, *, info=None, **params):
|
def test(tmpl, expected, *, info=None, **params):
|
||||||
if 'trim_file_name' not in params:
|
if 'trim_file_name' not in params:
|
||||||
params['trim_file_name'] = 'notrim' # disable trimming
|
params['trim_file_name'] = 'none' # disable trimming
|
||||||
params['outtmpl'] = tmpl
|
params['outtmpl'] = tmpl
|
||||||
ydl = FakeYDL(params)
|
ydl = FakeYDL(params)
|
||||||
ydl._num_downloads = 1
|
ydl._num_downloads = 1
|
||||||
|
@ -1439,9 +1439,9 @@ def evaluate_outtmpl(self, outtmpl, info_dict, *args, trim_filename=False, **kwa
|
|||||||
filename = outtmpl % info_dict
|
filename = outtmpl % info_dict
|
||||||
|
|
||||||
def parse_trim_file_name(trim_file_name):
|
def parse_trim_file_name(trim_file_name):
|
||||||
if trim_file_name is None or trim_file_name == 'notrim':
|
if trim_file_name is None or trim_file_name == 'none':
|
||||||
return 0, None
|
return 0, None
|
||||||
mobj = re.match(r'(?:(?P<length>\d+)(?P<mode>b|c)?|notrim)', trim_file_name)
|
mobj = re.match(r'(?:(?P<length>\d+)(?P<mode>b|c)?|none)', trim_file_name)
|
||||||
return int(mobj.group('length')), mobj.group('mode') or 'c'
|
return int(mobj.group('length')), mobj.group('mode') or 'c'
|
||||||
|
|
||||||
max_file_name, mode = parse_trim_file_name(self.params.get('trim_file_name'))
|
max_file_name, mode = parse_trim_file_name(self.params.get('trim_file_name'))
|
||||||
|
@ -429,7 +429,7 @@ def metadataparser_actions(f):
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Other options
|
# Other options
|
||||||
validate_regex('trim filenames', opts.trim_file_name, r'(?:\d+[bc]?|notrim)')
|
validate_regex('trim filenames', opts.trim_file_name, r'(?:\d+[bc]?|none)')
|
||||||
|
|
||||||
if opts.playlist_items is not None:
|
if opts.playlist_items is not None:
|
||||||
try:
|
try:
|
||||||
|
@ -1378,7 +1378,7 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
|
|||||||
help='Sanitize filenames only minimally')
|
help='Sanitize filenames only minimally')
|
||||||
filesystem.add_option(
|
filesystem.add_option(
|
||||||
'--trim-filenames', '--trim-file-names', metavar='LENGTH',
|
'--trim-filenames', '--trim-file-names', metavar='LENGTH',
|
||||||
dest='trim_file_name', default='notrim',
|
dest='trim_file_name', default='none',
|
||||||
help='Limit the filename length (excluding extension) to the specified number of characters or bytes')
|
help='Limit the filename length (excluding extension) to the specified number of characters or bytes')
|
||||||
filesystem.add_option(
|
filesystem.add_option(
|
||||||
'-w', '--no-overwrites',
|
'-w', '--no-overwrites',
|
||||||
|
Loading…
Reference in New Issue
Block a user