From 8658942385a01e3d8288685d782b2991bb77c810 Mon Sep 17 00:00:00 2001 From: Attente <19653207+wikrin@users.noreply.github.com> Date: Sun, 25 Jan 2026 01:06:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(filter):=20=E6=B7=BB=E5=8A=A0=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=9B=91=E5=90=AC=E5=92=8C=E6=94=B9=E8=BF=9B=E4=B8=AD?= =?UTF-8?q?=E5=AD=97=E8=BF=87=E6=BB=A4=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/meta/metabase.py | 2 +- app/db/models/downloadhistory.py | 2 +- app/helper/message.py | 2 +- app/modules/filter/__init__.py | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/core/meta/metabase.py b/app/core/meta/metabase.py index ef18fa2e..9f260c87 100644 --- a/app/core/meta/metabase.py +++ b/app/core/meta/metabase.py @@ -535,7 +535,7 @@ class MetaBase(object): def merge(self, meta: Self): """ - 全并Meta信息 + 合并Meta信息 """ # 类型 if self.type == MediaType.UNKNOWN \ diff --git a/app/db/models/downloadhistory.py b/app/db/models/downloadhistory.py index 371eae17..8b39ea9a 100644 --- a/app/db/models/downloadhistory.py +++ b/app/db/models/downloadhistory.py @@ -209,7 +209,7 @@ class DownloadFiles(Base): @classmethod @db_query 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, cls.state == state).all() else: diff --git a/app/helper/message.py b/app/helper/message.py index 5e3422d0..52de08c8 100644 --- a/app/helper/message.py +++ b/app/helper/message.py @@ -539,7 +539,7 @@ class MessageTemplateHelper: 获取消息模板 """ 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): diff --git a/app/modules/filter/__init__.py b/app/modules/filter/__init__.py index 406aefc3..71d07930 100644 --- a/app/modules/filter/__init__.py +++ b/app/modules/filter/__init__.py @@ -7,11 +7,12 @@ from app.helper.rule import RuleHelper from app.log import logger from app.modules import _ModuleBase 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 class FilterModule(_ModuleBase): + CONFIG_WATCH = {SystemConfigKey.CustomFilterRules.value} # 规则解析器 parser: RuleParser = None # 媒体信息 @@ -44,7 +45,8 @@ class FilterModule(_ModuleBase): "include": [ r'[中国國繁简](/|\s|\\|\|)?[繁简英粤]|[英简繁](/|\s|\\|\|)?[中繁简]' r'|繁體|简体|[中国國][字配]|国语|國語|中文|中字|简日|繁日|简繁|繁体' - r'|([\s,.-\[])(CHT|CHS|cht|chs)(|[\s,.-\]])'], + r'|([\s,.-\[])(chs|cht)(|[\s,.-\]])' + r'|(?