fix 过滤规则Bug
This commit is contained in:
@ -185,7 +185,7 @@ docker pull jxxghp/moviepilot:latest
|
|||||||
|
|
||||||
在`设定`-`规则`中设定,规则说明:
|
在`设定`-`规则`中设定,规则说明:
|
||||||
|
|
||||||
- 仅支持使用内置规则进行排列组合,内置规则有:`BLU`、`4K`、`1080P`、`CNSUB`、`SPECSUB`、`H265`、`H264`、`DOLBY`、`HDR`、`REMUX`、`WEBDL`、`FREE`
|
- 仅支持使用内置规则进行排列组合,内置规则有:`蓝光原盘`、`4K`、`1080P`、`中文字幕`、`特效字幕`、`H265`、`H264`、`杜比`、`HDR`、`REMUX`、`WEB-DL`、`免费`、`国语配音` 等
|
||||||
- `&`表示与,`|`表示或,`!`表示非,`>`表示优先级层级
|
- `&`表示与,`|`表示或,`!`表示非,`>`表示优先级层级
|
||||||
- 符合任一层级规则的资源将被标识选中,匹配成功的层级做为该资源的优先级,排越前面优先级超高
|
- 符合任一层级规则的资源将被标识选中,匹配成功的层级做为该资源的优先级,排越前面优先级超高
|
||||||
- 不符合过滤规则所有层级规则的资源将不会被选中
|
- 不符合过滤规则所有层级规则的资源将不会被选中
|
||||||
|
@ -182,6 +182,7 @@ class TorrentHelper:
|
|||||||
"""
|
"""
|
||||||
_meta = _context.meta_info
|
_meta = _context.meta_info
|
||||||
_torrent = _context.torrent_info
|
_torrent = _context.torrent_info
|
||||||
|
_media = _context.media_info
|
||||||
# 站点优先级
|
# 站点优先级
|
||||||
_site_order = 999 - (_torrent.site_order or 0)
|
_site_order = 999 - (_torrent.site_order or 0)
|
||||||
# 季数
|
# 季数
|
||||||
@ -192,13 +193,13 @@ class TorrentHelper:
|
|||||||
priority = self.system_config.get(SystemConfigKey.TorrentsPriority)
|
priority = self.system_config.get(SystemConfigKey.TorrentsPriority)
|
||||||
if priority != "site":
|
if priority != "site":
|
||||||
# 排序:标题、资源类型、做种、季集
|
# 排序:标题、资源类型、做种、季集
|
||||||
return "%s%s%s%s" % (str(_torrent.title).ljust(100, ' '),
|
return "%s%s%s%s" % (str(_media.title).ljust(100, ' '),
|
||||||
str(_torrent.pri_order).rjust(3, '0'),
|
str(_torrent.pri_order).rjust(3, '0'),
|
||||||
str(_torrent.seeders).rjust(10, '0'),
|
str(_torrent.seeders).rjust(10, '0'),
|
||||||
"%s%s" % (_season_len, _episode_len))
|
"%s%s" % (_season_len, _episode_len))
|
||||||
else:
|
else:
|
||||||
# 排序:标题、资源类型、站点、做种、季集
|
# 排序:标题、资源类型、站点、做种、季集
|
||||||
return "%s%s%s%s%s" % (str(_torrent.title).ljust(100, ' '),
|
return "%s%s%s%s%s" % (str(_media.title).ljust(100, ' '),
|
||||||
str(_torrent.pri_order).rjust(3, '0'),
|
str(_torrent.pri_order).rjust(3, '0'),
|
||||||
str(_site_order).rjust(3, '0'),
|
str(_site_order).rjust(3, '0'),
|
||||||
str(_torrent.seeders).rjust(10, '0'),
|
str(_torrent.seeders).rjust(10, '0'),
|
||||||
|
@ -32,7 +32,7 @@ class FilterModule(_ModuleBase):
|
|||||||
},
|
},
|
||||||
# 中字
|
# 中字
|
||||||
"CNSUB": {
|
"CNSUB": {
|
||||||
"include": [r'[中国國繁简](/|\s|\\|\|)?[繁简英粤]|[英简繁](/|\s|\\|\|)?[中繁简]|繁體|简体|[中国國][字配]|国语|國語|中文'],
|
"include": [r'[中国國繁简](/|\s|\\|\|)?[繁简英粤]|[英简繁](/|\s|\\|\|)?[中繁简]|繁體|简体|[中国國][字配]|国语|國語|中文|中字'],
|
||||||
"exclude": []
|
"exclude": []
|
||||||
},
|
},
|
||||||
# 特效字幕
|
# 特效字幕
|
||||||
@ -52,12 +52,12 @@ class FilterModule(_ModuleBase):
|
|||||||
},
|
},
|
||||||
# 杜比
|
# 杜比
|
||||||
"DOLBY": {
|
"DOLBY": {
|
||||||
"include": [r"DOLBY|DOVI|\s+DV$|\s+DV\s+"],
|
"include": [r"DOLBY|DOVI|[\s.]+DV[\s.]+|杜比"],
|
||||||
"exclude": []
|
"exclude": []
|
||||||
},
|
},
|
||||||
# HDR
|
# HDR
|
||||||
"HDR": {
|
"HDR": {
|
||||||
"include": [r"\s+HDR\s+|HDR10|HDR10\+"],
|
"include": [r"[\s.]+HDR[\s.]+|HDR10|HDR10\+"],
|
||||||
"exclude": []
|
"exclude": []
|
||||||
},
|
},
|
||||||
# 重编码
|
# 重编码
|
||||||
@ -73,6 +73,11 @@ class FilterModule(_ModuleBase):
|
|||||||
# 免费
|
# 免费
|
||||||
"FREE": {
|
"FREE": {
|
||||||
"downloadvolumefactor": 0
|
"downloadvolumefactor": 0
|
||||||
|
},
|
||||||
|
# 国语配音
|
||||||
|
"CNVOI": {
|
||||||
|
"include": [r'国语配音|国配'],
|
||||||
|
"exclude": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +181,7 @@ class FilterModule(_ModuleBase):
|
|||||||
return self.__match_rule(torrent, rule_group)
|
return self.__match_rule(torrent, rule_group)
|
||||||
elif isinstance(rule_group, list) and len(rule_group) == 1:
|
elif isinstance(rule_group, list) and len(rule_group) == 1:
|
||||||
# 只有一个规则项
|
# 只有一个规则项
|
||||||
return self.__match_rule(torrent, rule_group[0])
|
return self.__match_group(torrent, rule_group[0])
|
||||||
elif rule_group[0] == "not":
|
elif rule_group[0] == "not":
|
||||||
# 非操作
|
# 非操作
|
||||||
return not self.__match_group(torrent, rule_group[1:])
|
return not self.__match_group(torrent, rule_group[1:])
|
||||||
@ -201,7 +206,7 @@ class FilterModule(_ModuleBase):
|
|||||||
# FREE规则
|
# FREE规则
|
||||||
downloadvolumefactor = self.rule_set[rule_name].get("downloadvolumefactor")
|
downloadvolumefactor = self.rule_set[rule_name].get("downloadvolumefactor")
|
||||||
# 匹配项
|
# 匹配项
|
||||||
content = f"{torrent.title} {torrent.description}"
|
content = f"{torrent.title} {torrent.description} {' '.join(torrent.labels or [])}"
|
||||||
for include in includes:
|
for include in includes:
|
||||||
if not re.search(r"%s" % include, content, re.IGNORECASE):
|
if not re.search(r"%s" % include, content, re.IGNORECASE):
|
||||||
# 未发现包含项
|
# 未发现包含项
|
||||||
|
Reference in New Issue
Block a user