Rename 'notrim' option to 'none' to be consistent with other options

pull/12023/head
7x11x13 5 months ago
parent 5c1f6e7329
commit d482cee11d

@ -715,7 +715,7 @@ class TestYoutubeDL(unittest.TestCase):
def test_prepare_outtmpl_and_filename(self):
def test(tmpl, expected, *, info=None, **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
ydl = FakeYDL(params)
ydl._num_downloads = 1

@ -1439,9 +1439,9 @@ class YoutubeDL:
filename = outtmpl % info_dict
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
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'
max_file_name, mode = parse_trim_file_name(self.params.get('trim_file_name'))

@ -429,7 +429,7 @@ def validate_options(opts):
}
# 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:
try:

@ -1378,7 +1378,7 @@ def create_parser():
help='Sanitize filenames only minimally')
filesystem.add_option(
'--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')
filesystem.add_option(
'-w', '--no-overwrites',

Loading…
Cancel
Save