From 95360acea8bdff63a825fc5aa6d1e65e9f799739 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sat, 5 Aug 2023 07:21:20 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E4=B8=AD=E8=8B=B1=E6=96=87=E5=90=8D?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/chain/search.py | 23 +++++++++++++++++------ app/modules/indexer/__init__.py | 1 + 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/chain/search.py b/app/chain/search.py index 1d578b7e..a3bdde3d 100644 --- a/app/chain/search.py +++ b/app/chain/search.py @@ -105,19 +105,30 @@ class SearchChain(ChainBase): if not mediainfo: logger.error(f'媒体信息识别失败!') return [] - # 缺失的媒体信息 + # 缺失的季集 if no_exists and no_exists.get(mediainfo.tmdb_id): # 过滤剧集 season_episodes = {sea: info.episodes for sea, info in no_exists[mediainfo.tmdb_id].items()} else: season_episodes = None + # 搜索关键词 + if keyword: + keywords = [keyword] + elif mediainfo.title != mediainfo.original_title: + keywords = [mediainfo.title, mediainfo.original_title] + else: + keywords = [mediainfo.title] # 执行搜索 - torrents: List[TorrentInfo] = self.__search_all_sites( - mediainfo=mediainfo, - keyword=keyword, - sites=sites - ) + torrents: List[TorrentInfo] = [] + for keyword in keywords: + torrents = self.__search_all_sites( + mediainfo=mediainfo, + keyword=keyword, + sites=sites + ) + if torrents: + break if not torrents: logger.warn(f'{keyword or mediainfo.title} 未搜索到资源') return [] diff --git a/app/modules/indexer/__init__.py b/app/modules/indexer/__init__.py index 309ef09b..45022f90 100644 --- a/app/modules/indexer/__init__.py +++ b/app/modules/indexer/__init__.py @@ -48,6 +48,7 @@ class IndexerModule(_ModuleBase): and site.get('language') == "en" \ and StringUtils.is_chinese(search_word): # 不支持中文 + logger.warn(f"{site.get('name')} 不支持中文搜索") return [] # 开始索引