mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-02-02 18:22:39 +08:00
Merge remote-tracking branch 'origin/v2' into v2
This commit is contained in:
@@ -535,7 +535,7 @@ class MetaBase(object):
|
|||||||
|
|
||||||
def merge(self, meta: Self):
|
def merge(self, meta: Self):
|
||||||
"""
|
"""
|
||||||
全并Meta信息
|
合并Meta信息
|
||||||
"""
|
"""
|
||||||
# 类型
|
# 类型
|
||||||
if self.type == MediaType.UNKNOWN \
|
if self.type == MediaType.UNKNOWN \
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ class DownloadFiles(Base):
|
|||||||
@classmethod
|
@classmethod
|
||||||
@db_query
|
@db_query
|
||||||
def get_by_hash(cls, db: Session, download_hash: str, state: Optional[int] = None):
|
def get_by_hash(cls, db: Session, download_hash: str, state: Optional[int] = None):
|
||||||
if state:
|
if state is not None:
|
||||||
return db.query(cls).filter(cls.download_hash == download_hash,
|
return db.query(cls).filter(cls.download_hash == download_hash,
|
||||||
cls.state == state).all()
|
cls.state == state).all()
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -539,7 +539,7 @@ class MessageTemplateHelper:
|
|||||||
获取消息模板
|
获取消息模板
|
||||||
"""
|
"""
|
||||||
template_dict: dict[str, str] = SystemConfigOper().get(SystemConfigKey.NotificationTemplates)
|
template_dict: dict[str, str] = SystemConfigOper().get(SystemConfigKey.NotificationTemplates)
|
||||||
return template_dict.get(f"{message.ctype.value}")
|
return template_dict.get(message.ctype.value)
|
||||||
|
|
||||||
|
|
||||||
class MessageQueueManager(metaclass=SingletonClass):
|
class MessageQueueManager(metaclass=SingletonClass):
|
||||||
|
|||||||
@@ -7,11 +7,12 @@ from app.helper.rule import RuleHelper
|
|||||||
from app.log import logger
|
from app.log import logger
|
||||||
from app.modules import _ModuleBase
|
from app.modules import _ModuleBase
|
||||||
from app.modules.filter.RuleParser import RuleParser
|
from app.modules.filter.RuleParser import RuleParser
|
||||||
from app.schemas.types import ModuleType, OtherModulesType
|
from app.schemas.types import ModuleType, OtherModulesType, SystemConfigKey
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
|
|
||||||
|
|
||||||
class FilterModule(_ModuleBase):
|
class FilterModule(_ModuleBase):
|
||||||
|
CONFIG_WATCH = {SystemConfigKey.CustomFilterRules.value}
|
||||||
# 规则解析器
|
# 规则解析器
|
||||||
parser: RuleParser = None
|
parser: RuleParser = None
|
||||||
# 媒体信息
|
# 媒体信息
|
||||||
@@ -44,7 +45,8 @@ class FilterModule(_ModuleBase):
|
|||||||
"include": [
|
"include": [
|
||||||
r'[中国國繁简](/|\s|\\|\|)?[繁简英粤]|[英简繁](/|\s|\\|\|)?[中繁简]'
|
r'[中国國繁简](/|\s|\\|\|)?[繁简英粤]|[英简繁](/|\s|\\|\|)?[中繁简]'
|
||||||
r'|繁體|简体|[中国國][字配]|国语|國語|中文|中字|简日|繁日|简繁|繁体'
|
r'|繁體|简体|[中国國][字配]|国语|國語|中文|中字|简日|繁日|简繁|繁体'
|
||||||
r'|([\s,.-\[])(CHT|CHS|cht|chs)(|[\s,.-\]])'],
|
r'|([\s,.-\[])(chs|cht)(|[\s,.-\]])'
|
||||||
|
r'|(?<![a-z0-9])(gb|big5)(?![a-z0-9])'],
|
||||||
"exclude": [],
|
"exclude": [],
|
||||||
"tmdb": {
|
"tmdb": {
|
||||||
"original_language": "zh,cn"
|
"original_language": "zh,cn"
|
||||||
@@ -203,8 +205,6 @@ class FilterModule(_ModuleBase):
|
|||||||
if not rule_groups:
|
if not rule_groups:
|
||||||
return torrent_list
|
return torrent_list
|
||||||
self.media = mediainfo
|
self.media = mediainfo
|
||||||
# 重新加载自定义规则
|
|
||||||
self.__init_custom_rules()
|
|
||||||
# 查询规则表详情
|
# 查询规则表详情
|
||||||
groups = self.rulehelper.get_rule_group_by_media(media=mediainfo, group_names=rule_groups)
|
groups = self.rulehelper.get_rule_group_by_media(media=mediainfo, group_names=rule_groups)
|
||||||
if groups:
|
if groups:
|
||||||
@@ -227,7 +227,7 @@ class FilterModule(_ModuleBase):
|
|||||||
for torrent in torrent_list:
|
for torrent in torrent_list:
|
||||||
# 能命中优先级的才返回
|
# 能命中优先级的才返回
|
||||||
if not self.__get_order(torrent, rule_string):
|
if not self.__get_order(torrent, rule_string):
|
||||||
logger.debug(f"种子 {torrent.site_name} - {torrent.title} {torrent.description} "
|
logger.debug(f"种子 {torrent.site_name} - {torrent.title} {torrent.description or ''} "
|
||||||
f"不匹配 {rule_name} 过滤规则")
|
f"不匹配 {rule_name} 过滤规则")
|
||||||
continue
|
continue
|
||||||
ret_torrents.append(torrent)
|
ret_torrents.append(torrent)
|
||||||
|
|||||||
Reference in New Issue
Block a user