mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-07-09 21:37:47 +08:00
fix: recognize HDR Vivid resources (#6007)
This commit is contained in:
@@ -49,7 +49,7 @@ class MetaVideo(MetaBase):
|
||||
_part_re = r"(^PART[0-9ABI]{0,2}$|^CD[0-9]{0,2}$|^DVD[0-9]{0,2}$|^DISK[0-9]{0,2}$|^DISC[0-9]{0,2}$)"
|
||||
_roman_numerals = r"^(?=[MDCLXVI])M*(C[MD]|D?C{0,3})(X[CL]|L?X{0,3})(I[XV]|V?I{0,3})$"
|
||||
_source_re = r"^BLURAY$|^HDTV$|^UHDTV$|^HDDVD$|^WEBRIP$|^DVDRIP$|^BDRIP$|^BLU$|^WEB$|^BD$|^HDRip$|^REMUX$|^UHD$"
|
||||
_effect_re = r"^SDR$|^HDR\d*$|^DOLBY$|^DOVI$|^DV$|^3D$|^REPACK$|^HLG$|^HDR10(\+|Plus)$|^HDR10P$|^VIVID$|^EDR$|^HQ$"
|
||||
_effect_re = r"^SDR$|^HDR\d*$|^HDRVIVID$|^DOLBY$|^DOVI$|^DV$|^3D$|^REPACK$|^HLG$|^HDR10(\+|Plus)$|^HDR10P$|^VIVID$|^EDR$|^HQ$"
|
||||
_resources_type_re = r"%s|%s" % (_source_re, _effect_re)
|
||||
_name_no_begin_re = r"^[\[【].+?[\]】]"
|
||||
_name_no_chinese_re = r".*版|.*字幕"
|
||||
|
||||
@@ -83,7 +83,7 @@ BUILTIN_RULE_SET: Dict[str, dict] = {
|
||||
},
|
||||
# HDR
|
||||
"HDR": {
|
||||
"include": [r"[\s.]+HDR[\s.]+|HDR10|HDR10\+"],
|
||||
"include": [r"[\s.]+HDR[\s.]+|HDR10|HDR10\+|HDRVivid"],
|
||||
"exclude": [],
|
||||
},
|
||||
# SDR
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
moviepilot-rust~=0.1.12
|
||||
moviepilot-rust~=0.1.13
|
||||
pydantic>=2.13.4,<3.0.0
|
||||
pydantic-settings>=2.14.1,<3.0.0
|
||||
SQLAlchemy~=2.0.50
|
||||
|
||||
@@ -211,6 +211,19 @@ def test_video_bit_extracted_for_video_title():
|
||||
assert meta.video_bit == "10bit"
|
||||
|
||||
|
||||
def test_hdr_vivid_effect_extracted_for_video_title():
|
||||
"""测试合并写法 HDRVivid 可识别为资源效果。"""
|
||||
with patch("app.core.metainfo.rust_accel.parse_metainfo", return_value=None):
|
||||
meta = MetaInfo(
|
||||
title="Never-Ending Summer 2026 S01E18-S01E19 2160p WEB-DL 50Fps "
|
||||
"HDRVivid H265 10bit AAC-XXWEB"
|
||||
)
|
||||
|
||||
assert meta.resource_type == "WEB-DL"
|
||||
assert meta.resource_effect == "HDRVivid"
|
||||
assert meta.fps == 50
|
||||
|
||||
|
||||
def test_video_bit_extracted_for_anime_title():
|
||||
"""测试动漫标题中的视频位深可单独识别。"""
|
||||
meta = MetaInfo(
|
||||
|
||||
@@ -5,6 +5,7 @@ from unittest.mock import patch
|
||||
from app.core.context import MediaInfo, TorrentInfo
|
||||
from app.helper.torrent import TorrentHelper
|
||||
from app.modules.filter import FilterModule
|
||||
from app.modules.filter.builtin_rules import BUILTIN_RULE_SET
|
||||
from app.utils import rust_accel
|
||||
|
||||
|
||||
@@ -65,6 +66,22 @@ def test_filter_torrents_keeps_priority_and_boolean_rule_semantics():
|
||||
assert filtered[1].pri_order == 99
|
||||
|
||||
|
||||
def test_builtin_hdr_rule_matches_hdr_vivid_release():
|
||||
"""
|
||||
内置 HDR 规则应覆盖 HDR Vivid 合并写法,保证订阅优先级规则可命中。
|
||||
"""
|
||||
module = _build_filter_module(
|
||||
rule_string="HDR",
|
||||
rule_set=BUILTIN_RULE_SET,
|
||||
)
|
||||
torrent = TorrentInfo(title="Movie 2026 2160p WEB-DL HDRVivid H265", description="")
|
||||
|
||||
filtered = module.filter_torrents(rule_groups=["test"], torrent_list=[torrent])
|
||||
|
||||
assert [torrent] == filtered
|
||||
assert torrent.pri_order == 100
|
||||
|
||||
|
||||
def test_filter_torrents_keeps_lazy_priority_level_parsing():
|
||||
"""
|
||||
命中高优先级规则后不应解析低优先级坏规则。
|
||||
|
||||
Reference in New Issue
Block a user