From d21296b72404fedc34ccab0fd2f30cf28fe5df02 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sun, 2 Jul 2023 07:55:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=87=E6=BB=A4=E8=A7=84=E5=88=99=E6=94=AF?= =?UTF-8?q?=E6=8C=81FREE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/modules/filter/__init__.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/modules/filter/__init__.py b/app/modules/filter/__init__.py index 961e53e6..6739a5ba 100644 --- a/app/modules/filter/__init__.py +++ b/app/modules/filter/__init__.py @@ -60,6 +60,10 @@ class FilterModule(_ModuleBase): "REMUX": { "include": [r'REMUX'], "exclude": [] + }, + # 免费 + "FREE": { + "downloadvolumefactor": 0 } } @@ -180,9 +184,11 @@ class FilterModule(_ModuleBase): # 规则不存在 return False # 包含规则项 - includes = self.rule_set[rule_name].get("include") + includes = self.rule_set[rule_name].get("include") or [] # 排除规则项 - excludes = self.rule_set[rule_name].get("exclude") + excludes = self.rule_set[rule_name].get("exclude") or [] + # FREE规则 + downloadvolumefactor = self.rule_set[rule_name].get("downloadvolumefactor") # 匹配项 content = f"{torrent.title} {torrent.description}" for include in includes: @@ -193,4 +199,8 @@ class FilterModule(_ModuleBase): if re.search(r"%s" % exclude, content, re.IGNORECASE): # 发现排除项 return False + if downloadvolumefactor is not None: + if torrent.downloadvolumefactor != downloadvolumefactor: + # FREE规则不匹配 + return False return True