fix(meta): 修复首括号被误删导致标题识别错误

首括号包含完整发布名(如 [Movie.Name.2023.1080p.BluRay-GROUP])时,
保留内容去掉括号而非整体移除;同时修复 _name_movie_words 和
_name_se_words 列表误用为正则表达式的问题

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
DDSRem
2026-04-03 04:44:07 +08:00
committed by jxxghp
parent ec0915e488
commit 388afa8d3c
2 changed files with 63 additions and 3 deletions

View File

@@ -85,7 +85,16 @@ class MetaVideo(MetaBase):
self.total_season = 1
return
# 去掉名称中第1个[]的内容
title = re.sub(r'%s' % self._name_no_begin_re, "", title, count=1)
_first_bracket = re.match(r'^[\[【](.+?)[\]】]', title)
if _first_bracket:
_bracket_content = _first_bracket.group(1)
# 如果第一个括号内为点分隔的英文发布名格式(含年份+资源类型),保留内容去掉括号
if re.search(r'[A-Za-z]+\..+(?:19|20)\d{2}', _bracket_content) \
and re.search(r'(?:2160|1080|720|480)[PIpi]|4K|UHD|Blu[\-.]?ray|REMUX|WEB[\-.]?DL|HDTV',
_bracket_content, re.IGNORECASE):
title = _bracket_content + title[_first_bracket.end():]
else:
title = title[_first_bracket.end():]
# 把xxxx-xxxx年份换成前一个年份常出现在季集上
title = re.sub(r'([\s.]+)(\d{4})-(\d{4})', r'\1\2', title)
# 把大小去掉
@@ -247,9 +256,9 @@ class MetaVideo(MetaBase):
if not self.cn_name:
self.cn_name = token
elif not self._stop_cnname_flag:
if re.search("%s" % self._name_movie_words, token, flags=re.IGNORECASE) \
if re.search("|".join(self._name_movie_words), token, flags=re.IGNORECASE) \
or (not re.search("%s" % self._name_no_chinese_re, token, flags=re.IGNORECASE)
and not re.search("%s" % self._name_se_words, token, flags=re.IGNORECASE)):
and not any(w in token for w in self._name_se_words)):
self.cn_name = "%s %s" % (self.cn_name, token)
self._stop_cnname_flag = True
else:

View File

@@ -1234,4 +1234,55 @@ meta_cases = [{
"video_codec": "x265 10bit",
"audio_codec": "2Audio"
}
}, {
# 第一个括号包含完整发布名称(含年份+分辨率),应提取标题而非丢弃
"title": "[Caligula.The.Ultimate.Cut.2023.2160p.UHD.Blu-ray.HEVC.DTS-HD.MA.5.1-BHYS@OurBits][DIY中字原盘] [罗马帝国艳情史:最终剪辑版][澳大利亚版UHD原盘 DIY 简体简英字幕][91.86GB].iso",
"subtitle": "",
"target": {
"type": "未知",
"cn_name": "",
"en_name": "Caligula The Ultimate Cut",
"year": "2023",
"part": "",
"season": "",
"episode": "",
"restype": "UHD",
"pix": "2160p",
"video_codec": "HEVC",
"audio_codec": "DTS-HD MA 5.1"
}
}, {
# 第一个括号包含完整发布名称(含年份+BluRay应提取标题
"title": "[The.Shawshank.Redemption.1994.1080p.BluRay.x264-GROUP][中文字幕]",
"subtitle": "",
"target": {
"type": "未知",
"cn_name": "",
"en_name": "The Shawshank Redemption",
"year": "1994",
"part": "",
"season": "",
"episode": "",
"restype": "BluRay",
"pix": "1080p",
"video_codec": "x264",
"audio_codec": ""
}
}, {
# 第一个括号为短标签(无年份无分辨率),应正常移除
"title": "[YTS.MX] The Shawshank Redemption 1994 1080p BluRay x264",
"subtitle": "",
"target": {
"type": "未知",
"cn_name": "",
"en_name": "The Shawshank Redemption",
"year": "1994",
"part": "",
"season": "",
"episode": "",
"restype": "BluRay",
"pix": "1080p",
"video_codec": "x264",
"audio_codec": ""
}
}]