strip file size tags from TMDb search query
This commit is contained in:
@@ -741,14 +741,19 @@ JUNK_TOKENS = {
|
|||||||
"complete", "collection", "series",
|
"complete", "collection", "series",
|
||||||
"se", "ce", "remastered", "anniversary", "edition",
|
"se", "ce", "remastered", "anniversary", "edition",
|
||||||
"amzn", "nf", "dsnp", "hmax", "atvp", "pcok", "hulu",
|
"amzn", "nf", "dsnp", "hmax", "atvp", "pcok", "hulu",
|
||||||
|
"mb", "gb",
|
||||||
}
|
}
|
||||||
|
|
||||||
SEASON_RANGE_PATTERN = re.compile(r'\bSeasons?\b(?:\s+\d{1,2})+', re.IGNORECASE)
|
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)
|
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):
|
def strip_junk_tokens(text):
|
||||||
text = re.sub(r'\b\d{3,4}p\b', ' ', text, flags=re.IGNORECASE)
|
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 = SEASON_RANGE_PATTERN.sub(' ', text)
|
||||||
text = IN_FORMAT_PATTERN.sub(' ', text)
|
text = IN_FORMAT_PATTERN.sub(' ', text)
|
||||||
words = text.split()
|
words = text.split()
|
||||||
|
|||||||
Reference in New Issue
Block a user