This commit is contained in:
thsrite
2024-10-28 11:36:18 +08:00
parent 9686a20c2f
commit 7ba2d60925
2 changed files with 6 additions and 25 deletions
+3 -23
View File
@@ -11,7 +11,6 @@ from app.core.context import Context
from app.core.context import MediaInfo, TorrentInfo from app.core.context import MediaInfo, TorrentInfo
from app.core.event import eventmanager, Event from app.core.event import eventmanager, Event
from app.core.metainfo import MetaInfo from app.core.metainfo import MetaInfo
from app.db.models import Subscribe
from app.db.systemconfig_oper import SystemConfigOper from app.db.systemconfig_oper import SystemConfigOper
from app.helper.progress import ProgressHelper from app.helper.progress import ProgressHelper
from app.helper.sites import SitesHelper from app.helper.sites import SitesHelper
@@ -107,7 +106,7 @@ class SearchChain(ChainBase):
rule_groups: List[str] = None, rule_groups: List[str] = None,
area: str = "title", area: str = "title",
custom_words: List[str] = None, custom_words: List[str] = None,
subscribe: Subscribe = None) -> List[Context]: filter_params: Dict[str, str] = None) -> List[Context]:
""" """
根据媒体信息搜索种子资源,精确匹配,应用过滤规则,同时根据no_exists过滤本地已存在的资源 根据媒体信息搜索种子资源,精确匹配,应用过滤规则,同时根据no_exists过滤本地已存在的资源
:param mediainfo: 媒体信息 :param mediainfo: 媒体信息
@@ -235,9 +234,8 @@ class SearchChain(ChainBase):
continue continue
# 匹配订阅附加参数 # 匹配订阅附加参数
if subscribe and not self.torrenthelper.filter_torrent(torrent_info=torrent, if filter_params and not self.torrenthelper.filter_torrent(torrent_info=torrent,
filter_params=self.__get_subscribe_params( filter_params=filter_params):
subscribe)):
continue continue
# 比对种子 # 比对种子
@@ -279,24 +277,6 @@ class SearchChain(ChainBase):
# 返回 # 返回
return contexts return contexts
def __get_subscribe_params(self, subscribe: Subscribe):
"""
获取订阅默认参数
"""
# 默认过滤规则
default_rule = self.systemconfig.get(SystemConfigKey.SubscribeDefaultParams) or {}
return {
"include": subscribe.include or default_rule.get("include"),
"exclude": subscribe.exclude or default_rule.get("exclude"),
"quality": subscribe.quality or default_rule.get("quality"),
"resolution": subscribe.resolution or default_rule.get("resolution"),
"effect": subscribe.effect or default_rule.get("effect"),
"tv_size": default_rule.get("tv_size"),
"movie_size": default_rule.get("movie_size"),
"min_seeders": default_rule.get("min_seeders"),
"min_seeders_time": default_rule.get("min_seeders_time"),
}
def __search_all_sites(self, keywords: List[str], def __search_all_sites(self, keywords: List[str],
mediainfo: Optional[MediaInfo] = None, mediainfo: Optional[MediaInfo] = None,
sites: List[int] = None, sites: List[int] = None,
+3 -2
View File
@@ -349,7 +349,7 @@ class SubscribeChain(ChainBase):
rule_groups=rule_groups, rule_groups=rule_groups,
area="imdbid" if subscribe.search_imdbid else "title", area="imdbid" if subscribe.search_imdbid else "title",
custom_words=custom_word_list, custom_words=custom_word_list,
subscribe=subscribe) filter_params=self.get_params(subscribe))
if not contexts: if not contexts:
logger.warn(f'订阅 {subscribe.keyword or subscribe.name} 未搜索到资源') logger.warn(f'订阅 {subscribe.keyword or subscribe.name} 未搜索到资源')
self.finish_subscribe_or_not(subscribe=subscribe, meta=meta, self.finish_subscribe_or_not(subscribe=subscribe, meta=meta,
@@ -638,7 +638,8 @@ class SubscribeChain(ChainBase):
_, apply_words = WordsMatcher().prepare(torrent_info.title, _, apply_words = WordsMatcher().prepare(torrent_info.title,
custom_words=subscribe.custom_words.split("\n")) custom_words=subscribe.custom_words.split("\n"))
if apply_words: if apply_words:
logger.info(f'{torrent_info.site_name} - {torrent_info.title} 因订阅存在自定义识别词,重新识别元数据...') logger.info(
f'{torrent_info.site_name} - {torrent_info.title} 因订阅存在自定义识别词,重新识别元数据...')
# 重新识别元数据 # 重新识别元数据
torrent_meta = MetaInfo(title=torrent_info.title, subtitle=torrent_info.description, torrent_meta = MetaInfo(title=torrent_info.title, subtitle=torrent_info.description,
custom_words=subscribe.custom_word) custom_words=subscribe.custom_word)