From cc117e909bf92bad340365e94e2253f4205d0ca3 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Wed, 25 Oct 2023 15:57:57 +0100 Subject: [PATCH] Add ignore Plex extras. https://support.plex.tv/articles/local-files-for-tv-show-trailers-and-extras/ --- CHANGES.md | 1 + sickgear/helpers.py | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index a9fc46c6..718eca4e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,6 +13,7 @@ * Update thefuzz 0.19.0 (c2cd4f4) to 0.21.0 (0b49e4a) * Update urllib3 2.0.5 (d9f85a7) to 2.0.7 (56f01e0) * Add support for Brotli compression +* Add ignore Plex extras ### 3.30.4 (2023-10-12 11:50:00 UTC) diff --git a/sickgear/helpers.py b/sickgear/helpers.py index 1643a1db..69bc0d37 100644 --- a/sickgear/helpers.py +++ b/sickgear/helpers.py @@ -158,7 +158,9 @@ def has_media_ext(filename): return False sep_file = filename.rpartition('.') - return (None is re.search('extras?$', sep_file[0], re.I)) and (sep_file[2].lower() in mediaExtensions) + return (None is re.search( + '(?:extras|-Behind\sThe\sScenes|-Deleted\sScenes|-Featurettes|-Interviews|-Scenes|-Shorts|-Trailers|-Other)?$', + sep_file[0], re.I)) and (sep_file[2].lower() in mediaExtensions) def has_image_ext(filename): @@ -352,8 +354,11 @@ def list_media_files(path): if [direntry for direntry in scantree(path, include=[r'\.sickgearignore'], filter_kind=False, recurse=False)]: logger.debug('Skipping folder "%s" because it contains ".sickgearignore"' % path) else: - result = [direntry.path for direntry in scantree(path, exclude=['Extras'], filter_kind=False, - exclude_folders_with_files=['.sickgearignore']) + result = [direntry.path for direntry in scantree(path, exclude=[ + 'Extras', + 'Behind The Scenes', 'Deleted Scenes', 'Featurettes', + 'Interviews', 'Scenes', 'Shorts', 'Trailers', 'Other' + ], filter_kind=False, exclude_folders_with_files=['.sickgearignore']) if has_media_ext(direntry.name)] return result