From ac9b48ef92bb645e1366fa17bd08de16451d9786 Mon Sep 17 00:00:00 2001 From: Dariush Date: Fri, 15 Nov 2024 17:45:04 +0100 Subject: [PATCH] improve title filtering and tv shows results --- comet/api/stream.py | 2 ++ comet/utils/general.py | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/comet/api/stream.py b/comet/api/stream.py index edeb31c..29c7ef9 100644 --- a/comet/api/stream.py +++ b/comet/api/stream.py @@ -264,8 +264,10 @@ async def stream(request: Request, b64config: str, type: str, id: str): search_terms = [name] if type == "series": + search_terms = [] if not kitsu: search_terms.append(f"{name} S0{season}E0{episode}") + search_terms.append(f"{name} s0{season}e0{episode}") else: search_terms.append(f"{name} {episode}") tasks.extend( diff --git a/comet/utils/general.py b/comet/utils/general.py index c4c02d8..1269385 100644 --- a/comet/utils/general.py +++ b/comet/utils/general.py @@ -477,7 +477,12 @@ async def filter(torrents: list, name: str, year: int): parsed = parse(title) - if parsed.parsed_title and not title_match(name, parsed.parsed_title): + def title_sub_match(correct_title: str, torrent_title: str): + correct_title = correct_title.lower() + torrent_title = torrent_title.lower() + return correct_title in torrent_title or torrent_title in correct_title + + if parsed.parsed_title and not (title_match(name, parsed.parsed_title) or title_sub_match(name, parsed.parsed_title)): results.append((index, False)) continue