add SEARCH_MULTIPLE_NAME

This commit is contained in:
jxxghp 2024-03-24 08:26:59 +08:00
parent e4bb182668
commit 72b6556c62
5 changed files with 22 additions and 2 deletions

View File

@ -132,6 +132,8 @@ MoviePilot需要配套下载器和媒体服务器配合使用。
--- ---
- **DOWNLOAD_SUBTITLE** 下载站点字幕,`true`/`false`,默认`true` - **DOWNLOAD_SUBTITLE** 下载站点字幕,`true`/`false`,默认`true`
--- ---
- **SEARCH_MULTIPLE_NAME** 搜索时是否使用多个名称搜索,`true`/`false`,默认`true`,开启后会使用多个名称进行搜索,搜索结果会更全面,但会增加搜索时间;关闭时只要其中一个名称搜索到结果或全部名称搜索完毕即停止
---
- **MOVIE_RENAME_FORMAT** 电影重命名格式基于jinjia2语法 - **MOVIE_RENAME_FORMAT** 电影重命名格式基于jinjia2语法
`MOVIE_RENAME_FORMAT`支持的配置项: `MOVIE_RENAME_FORMAT`支持的配置项:

View File

@ -49,6 +49,12 @@ class SiteChain(ChainBase):
"m-team.cc": self.__mteam_test, "m-team.cc": self.__mteam_test,
} }
def is_special_site(self, domain: str) -> bool:
"""
判断是否特殊站点
"""
return domain in self.special_site_test
@staticmethod @staticmethod
def __zhuque_test(site: Site) -> Tuple[bool, str]: def __zhuque_test(site: Site) -> Tuple[bool, str]:
""" """

View File

@ -236,6 +236,8 @@ class Settings(BaseSettings):
META_CACHE_EXPIRE: int = 0 META_CACHE_EXPIRE: int = 0
# 是否启用DOH解析域名 # 是否启用DOH解析域名
DOH_ENABLE: bool = True DOH_ENABLE: bool = True
# 搜索多个名称
SEARCH_MULTIPLE_NAME: bool = True
@validator("SUBSCRIBE_RSS_INTERVAL", @validator("SUBSCRIBE_RSS_INTERVAL",
"COOKIECLOUD_INTERVAL", "COOKIECLOUD_INTERVAL",

View File

@ -3,6 +3,7 @@ from typing import List, Optional, Tuple, Union
from ruamel.yaml import CommentedMap from ruamel.yaml import CommentedMap
from app.core.config import settings
from app.core.context import TorrentInfo from app.core.context import TorrentInfo
from app.helper.sites import SitesHelper from app.helper.sites import SitesHelper
from app.log import logger from app.log import logger
@ -57,6 +58,8 @@ class IndexerModule(_ModuleBase):
:param _torrents: 种子列表 :param _torrents: 种子列表
:return: 去重后的种子列表 :return: 去重后的种子列表
""" """
if not settings.SEARCH_MULTIPLE_NAME:
return _torrents
# 通过encosure去重 # 通过encosure去重
return list({t.enclosure: t for t in _torrents}.values()) return list({t.enclosure: t for t in _torrents}.values())
@ -109,9 +112,14 @@ class IndexerModule(_ModuleBase):
page=page page=page
) )
if not result: if not result:
break continue
# 合并结果 if settings.SEARCH_MULTIPLE_NAME:
# 合并多个结果
result_array.extend(result) result_array.extend(result)
else:
# 有结果就停止
result_array = result
break
except Exception as err: except Exception as err:
logger.error(f"{site.get('name')} 搜索出错:{str(err)}") logger.error(f"{site.get('name')} 搜索出错:{str(err)}")

View File

@ -45,3 +45,5 @@ DOWNLOAD_SUBTITLE=true
OCR_HOST=https://movie-pilot.org OCR_HOST=https://movie-pilot.org
# 插件市场仓库地址,多个地址使用`,`分隔,保留最后的/ # 插件市场仓库地址,多个地址使用`,`分隔,保留最后的/
PLUGIN_MARKET=https://github.com/jxxghp/MoviePilot-Plugins PLUGIN_MARKET=https://github.com/jxxghp/MoviePilot-Plugins
# 搜索多个名称true/false为true时搜索时会同时搜索中英文及原始名称搜索结果会更全面但会增加搜索时间为false时其中一个名称搜索到结果或全部名称搜索完毕即停止
SEARCH_MULTIPLE_NAME=true