mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-08-22 08:43:37 +08:00
fix(meta): 副标题识别 01-26Fin 等数字范围完结标记集数 (#6105)
This commit is contained in:
@@ -169,6 +169,64 @@ def test_python_metainfo_fallback_preserves_xxx_movie_title():
|
||||
assert meta.audio_encode == "DDP 5.1"
|
||||
|
||||
|
||||
def test_python_subtitle_episode_range_fin_with_chinese_season():
|
||||
"""Python 兜底解析应识别副标题中 [01-26Fin] 格式的集数范围(#6103)。"""
|
||||
with patch("app.core.metainfo.rust_accel.parse_metainfo", return_value=None):
|
||||
meta = MetaInfo(
|
||||
title="JoJos Bizarre Adventure S01 2012 1080i BluRay x264 FLAC 2.0-AnimeF@ADE",
|
||||
subtitle="JOJO的奇妙冒险 第一季 / JoJo's Bizarre Adventure [01-26Fin] [简繁字幕]",
|
||||
)
|
||||
|
||||
assert meta.type == MediaType.TV
|
||||
assert meta.begin_season == 1
|
||||
assert meta.begin_episode == 1
|
||||
assert meta.end_episode == 26
|
||||
assert meta.total_episode == 26
|
||||
|
||||
|
||||
def test_python_subtitle_episode_range_fin_without_chinese_marker():
|
||||
"""副标题无中文季集标记时也应识别 [01-38Fin] 集数范围。"""
|
||||
with patch("app.core.metainfo.rust_accel.parse_metainfo", return_value=None):
|
||||
meta = MetaInfo(
|
||||
title="Some Show S01 2022 1080p WEB-DL H264-GRP",
|
||||
subtitle="Some Show [01-38Fin]",
|
||||
)
|
||||
|
||||
assert meta.begin_episode == 1
|
||||
assert meta.end_episode == 38
|
||||
assert meta.total_episode == 38
|
||||
|
||||
|
||||
def test_python_subtitle_episode_range_end_variant():
|
||||
"""END/完结 等完结标记变体同样应识别为集数范围。"""
|
||||
with patch("app.core.metainfo.rust_accel.parse_metainfo", return_value=None):
|
||||
meta_end = MetaInfo(
|
||||
title="Some Show S01 2022 1080p WEB-DL H264-GRP",
|
||||
subtitle="Some Show 01-24 END",
|
||||
)
|
||||
meta_cn = MetaInfo(
|
||||
title="Some Show S01 2022 1080p WEB-DL H264-GRP",
|
||||
subtitle="某剧 01-12完结",
|
||||
)
|
||||
|
||||
assert meta_end.begin_episode == 1
|
||||
assert meta_end.end_episode == 24
|
||||
assert meta_cn.begin_episode == 1
|
||||
assert meta_cn.end_episode == 12
|
||||
|
||||
|
||||
def test_python_subtitle_year_range_not_treated_as_episodes():
|
||||
"""年份范围(如 2019-2020)不得误识别为集数。"""
|
||||
with patch("app.core.metainfo.rust_accel.parse_metainfo", return_value=None):
|
||||
meta = MetaInfo(
|
||||
title="Some Collection 2020 1080p WEB-DL H264-GRP",
|
||||
subtitle="A Collection [2019-2020Fin]",
|
||||
)
|
||||
|
||||
assert meta.begin_episode is None
|
||||
assert meta.total_episode == 0
|
||||
|
||||
|
||||
def test_custom_words_replace_then_episode_offset():
|
||||
"""测试复杂识别词仍按先替换、后集数偏移的顺序处理。"""
|
||||
custom_words = ["旧名 => 新名 && 第 <> 集 >> EP+1"]
|
||||
|
||||
Reference in New Issue
Block a user