diff --git a/README.md b/README.md index 3e0ff5cc..8b6753e1 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,8 @@ MoviePilot需要配套下载器和媒体服务器配合使用。 --- - **DOWNLOAD_SUBTITLE:** 下载站点字幕,`true`/`false`,默认`true` --- +- **SEARCH_MULTIPLE_NAME:** 搜索时是否使用多个名称搜索,`true`/`false`,默认`true`,开启后会使用多个名称进行搜索,搜索结果会更全面,但会增加搜索时间;关闭时只要其中一个名称搜索到结果或全部名称搜索完毕即停止 +--- - **MOVIE_RENAME_FORMAT:** 电影重命名格式,基于jinjia2语法 `MOVIE_RENAME_FORMAT`支持的配置项: diff --git a/app/chain/site.py b/app/chain/site.py index 9768d3cf..f26b3b94 100644 --- a/app/chain/site.py +++ b/app/chain/site.py @@ -49,6 +49,12 @@ class SiteChain(ChainBase): "m-team.cc": self.__mteam_test, } + def is_special_site(self, domain: str) -> bool: + """ + 判断是否特殊站点 + """ + return domain in self.special_site_test + @staticmethod def __zhuque_test(site: Site) -> Tuple[bool, str]: """ diff --git a/app/core/config.py b/app/core/config.py index 69eb340c..07f6d87b 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -236,6 +236,8 @@ class Settings(BaseSettings): META_CACHE_EXPIRE: int = 0 # 是否启用DOH解析域名 DOH_ENABLE: bool = True + # 搜索多个名称 + SEARCH_MULTIPLE_NAME: bool = True @validator("SUBSCRIBE_RSS_INTERVAL", "COOKIECLOUD_INTERVAL", diff --git a/app/modules/indexer/__init__.py b/app/modules/indexer/__init__.py index 48cb88f0..60e4dedc 100644 --- a/app/modules/indexer/__init__.py +++ b/app/modules/indexer/__init__.py @@ -3,6 +3,7 @@ from typing import List, Optional, Tuple, Union from ruamel.yaml import CommentedMap +from app.core.config import settings from app.core.context import TorrentInfo from app.helper.sites import SitesHelper from app.log import logger @@ -57,6 +58,8 @@ class IndexerModule(_ModuleBase): :param _torrents: 种子列表 :return: 去重后的种子列表 """ + if not settings.SEARCH_MULTIPLE_NAME: + return _torrents # 通过encosure去重 return list({t.enclosure: t for t in _torrents}.values()) @@ -109,9 +112,14 @@ class IndexerModule(_ModuleBase): page=page ) if not result: + continue + if settings.SEARCH_MULTIPLE_NAME: + # 合并多个结果 + result_array.extend(result) + else: + # 有结果就停止 + result_array = result break - # 合并结果 - result_array.extend(result) except Exception as err: logger.error(f"{site.get('name')} 搜索出错:{str(err)}") diff --git a/config/app.env b/config/app.env index ba4f15f5..3ad1f90a 100644 --- a/config/app.env +++ b/config/app.env @@ -45,3 +45,5 @@ DOWNLOAD_SUBTITLE=true OCR_HOST=https://movie-pilot.org # 插件市场仓库地址,多个地址使用`,`分隔,保留最后的/ PLUGIN_MARKET=https://github.com/jxxghp/MoviePilot-Plugins +# 搜索多个名称,true/false,为true时搜索时会同时搜索中英文及原始名称,搜索结果会更全面,但会增加搜索时间;为false时其中一个名称搜索到结果或全部名称搜索完毕即停止 +SEARCH_MULTIPLE_NAME=true