From d482cee11dfd76329b5bfead7d5b92142c18ec0a Mon Sep 17 00:00:00 2001 From: 7x11x13 Date: Mon, 17 Feb 2025 10:22:49 -0500 Subject: [PATCH] Rename 'notrim' option to 'none' to be consistent with other options --- test/test_YoutubeDL.py | 2 +- yt_dlp/YoutubeDL.py | 4 ++-- yt_dlp/__init__.py | 2 +- yt_dlp/options.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py index bb7d81484b..c2325d2709 100644 --- a/test/test_YoutubeDL.py +++ b/test/test_YoutubeDL.py @@ -715,7 +715,7 @@ def test_add_extra_info(self): 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 diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index 2c8d54d86a..c47ad84c72 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -1439,9 +1439,9 @@ def evaluate_outtmpl(self, outtmpl, info_dict, *args, trim_filename=False, **kwa 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\d+)(?Pb|c)?|notrim)', trim_file_name) + mobj = re.match(r'(?:(?P\d+)(?Pb|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')) diff --git a/yt_dlp/__init__.py b/yt_dlp/__init__.py index e49e73fef9..3f63a6b548 100644 --- a/yt_dlp/__init__.py +++ b/yt_dlp/__init__.py @@ -429,7 +429,7 @@ def metadataparser_actions(f): } # 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: diff --git a/yt_dlp/options.py b/yt_dlp/options.py index fa6ceb873e..5820bc7a10 100644 --- a/yt_dlp/options.py +++ b/yt_dlp/options.py @@ -1378,7 +1378,7 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs): 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',