strip file size tags from TMDb search query
This commit is contained in:
1 parent
83f3ab72ed
commit
30c4c2e72f
1 file changed
+5
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user