diff --git a/backend/src/module/manager/torrent.py b/backend/src/module/manager/torrent.py index a2b5b09d..6ddfa9bc 100644 --- a/backend/src/module/manager/torrent.py +++ b/backend/src/module/manager/torrent.py @@ -89,6 +89,7 @@ class TorrentManager(Database): ) def enable_rule(self, _id: str | int): + # TODO: to fix search_id data = self.bangumi.search(int(_id)) if isinstance(data, Bangumi): data.deleted = False diff --git a/backend/src/module/parser/analyser/tmdb_parser.py b/backend/src/module/parser/analyser/tmdb_parser.py index 5ba90338..a156b941 100644 --- a/backend/src/module/parser/analyser/tmdb_parser.py +++ b/backend/src/module/parser/analyser/tmdb_parser.py @@ -79,7 +79,10 @@ def tmdb_parser(title, language) -> TMDBInfo | None: original_title = info_content.get("original_name") official_title = info_content.get("name") year_number = info_content.get("first_air_date").split("-")[0] - poster_link = "https://image.tmdb.org/t/p/w300" + poster_path + if poster_path: + poster_link = "https://image.tmdb.org/t/p/w300" + poster_path + else: + poster_link = None return TMDBInfo( id, official_title, diff --git a/backend/src/module/searcher/provider.py b/backend/src/module/searcher/provider.py index a08092a4..318a22ea 100644 --- a/backend/src/module/searcher/provider.py +++ b/backend/src/module/searcher/provider.py @@ -12,6 +12,7 @@ def search_url(site: str, keywords: list[str]) -> RSSItem: parser = "mikan" if site == "mikan" else "tmdb" rss_item = RSSItem( url=url, + aggregate=False, parser=parser, ) return rss_item diff --git a/backend/src/module/searcher/searcher.py b/backend/src/module/searcher/searcher.py index 78948efc..de5233e0 100644 --- a/backend/src/module/searcher/searcher.py +++ b/backend/src/module/searcher/searcher.py @@ -18,6 +18,7 @@ SEARCH_KEY = [ BangumiJSON: TypeAlias = str + class SearchTorrent(RequestContent, RSSAnalyser): def search_torrents( self, rss_item: RSSItem, limit: int = 5 @@ -29,9 +30,11 @@ class SearchTorrent(RequestContent, RSSAnalyser): rss_item = search_url(site, keywords) torrents = self.search_torrents(rss_item) # yield for EventSourceResponse (Server Send) + exist_list = [] for torrent in torrents: bangumi = self.torrent_to_data(torrent=torrent, rss=rss_item) - if bangumi: + if bangumi and bangumi not in exist_list: + exist_list.append(bangumi) yield json.dumps(bangumi.dict(), separators=(',', ':')) def search_season(self, data: Bangumi): diff --git a/webui/src/components/ab-bangumi-card.vue b/webui/src/components/ab-bangumi-card.vue index 787ad659..771ae10c 100644 --- a/webui/src/components/ab-bangumi-card.vue +++ b/webui/src/components/ab-bangumi-card.vue @@ -1,13 +1,11 @@