From 9b2fccee015f0acf333d5bb3790bea5216f6ca5b Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sat, 9 Nov 2024 18:01:50 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=89=A7=E9=9B=86=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=A7=E5=B0=8F=E8=BF=87=E6=BB=A4=E6=8C=89=E5=B9=B3?= =?UTF-8?q?=E5=9D=87=E6=AF=8F=E9=9B=86=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/modules/filter/__init__.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/modules/filter/__init__.py b/app/modules/filter/__init__.py index 579569f2..9f3fb514 100644 --- a/app/modules/filter/__init__.py +++ b/app/modules/filter/__init__.py @@ -432,26 +432,32 @@ class FilterModule(_ModuleBase): @staticmethod def __match_size(torrent: TorrentInfo, size_range: str) -> bool: """ - 判断种子是否匹配大小范围(MB) + 判断种子是否匹配大小范围(MB),剧集拆分为每集大小 """ if not size_range: return True + # 集数 + meta = MetaInfo(title=torrent.title, subtitle=torrent.description) + episode_count = meta.total_episode or 1 + # 每集大小 + torrent_size = torrent.size / episode_count + # 大小范围 size_range = size_range.strip() if size_range.find("-") != -1: # 区间 size_min, size_max = size_range.split("-") size_min = float(size_min.strip()) * 1024 * 1024 size_max = float(size_max.strip()) * 1024 * 1024 - if size_min <= torrent.size <= size_max: + if size_min <= torrent_size <= size_max: return True elif size_range.startswith(">"): # 大于 size_min = float(size_range[1:].strip()) * 1024 * 1024 - if torrent.size >= size_min: + if torrent_size >= size_min: return True elif size_range.startswith("<"): # 小于 size_max = float(size_range[1:].strip()) * 1024 * 1024 - if torrent.size <= size_max: + if torrent_size <= size_max: return True return False