From 30c4c2e72f4b3d876063291950c938a20858d273 Mon Sep 17 00:00:00 2001 From: Justin Oro Date: Fri, 21 Aug 2026 01:54:58 -0700 Subject: [PATCH] strip file size tags from TMDb search query --- plex-library-tool.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plex-library-tool.py b/plex-library-tool.py index 066684a..7fdca3b 100755 --- a/plex-library-tool.py +++ b/plex-library-tool.py @@ -741,14 +741,19 @@ JUNK_TOKENS = { "complete", "collection", "series", "se", "ce", "remastered", "anniversary", "edition", "amzn", "nf", "dsnp", "hmax", "atvp", "pcok", "hulu", + "mb", "gb", } SEASON_RANGE_PATTERN = re.compile(r'\bSeasons?\b(?:\s+\d{1,2})+', re.IGNORECASE) IN_FORMAT_PATTERN = re.compile(r'\bin\s+(?:full\s+)?(?:hd|4k|uhd|sd)\b', re.IGNORECASE) +FILE_SIZE_PATTERN = re.compile(r'\b\d+(?:\.\d+)?\s?(?:MB|GB)\b', re.IGNORECASE) + + def strip_junk_tokens(text): text = re.sub(r'\b\d{3,4}p\b', ' ', text, flags=re.IGNORECASE) + text = FILE_SIZE_PATTERN.sub(' ', text) text = SEASON_RANGE_PATTERN.sub(' ', text) text = IN_FORMAT_PATTERN.sub(' ', text) words = text.split()