mirror of
https://github.com/Cp0204/quark-auto-save.git
synced 2026-01-17 09:50:42 +08:00
在全局的剧集编号提取函数中增加移除分辨率标识的预处理
This commit is contained in:
parent
732b184ab4
commit
ecf4a26a53
@ -302,6 +302,16 @@ def extract_episode_number(filename, episode_patterns=None, config_data=None):
|
||||
if month and day and 1 <= month <= 12 and 1 <= day <= 31:
|
||||
filename_without_dates = filename_without_dates.replace(date_str, " ")
|
||||
|
||||
# 预处理:移除分辨率标识(如 720p, 1080P, 2160p 等)
|
||||
resolution_patterns = [
|
||||
r'\b\d+[pP]\b', # 匹配 720p, 1080P, 2160p 等
|
||||
r'\b\d+x\d+\b', # 匹配 1920x1080 等
|
||||
# 注意:不移除4K/8K,因为剧集匹配规则中有 (\d+)[-_\s]*4[Kk] 模式
|
||||
]
|
||||
|
||||
for pattern in resolution_patterns:
|
||||
filename_without_dates = re.sub(pattern, ' ', filename_without_dates)
|
||||
|
||||
# 优先匹配SxxExx格式
|
||||
match_s_e = re.search(r'[Ss](\d+)[Ee](\d+)', filename_without_dates)
|
||||
if match_s_e:
|
||||
@ -390,6 +400,9 @@ def extract_episode_number(filename, episode_patterns=None, config_data=None):
|
||||
episode_num = int(num_match.group(1))
|
||||
# 检查提取的数字是否可能是日期
|
||||
if not is_date_format(str(episode_num)):
|
||||
# 检查是否是过大的数字(可能是时间戳、文件大小等)
|
||||
if episode_num > 9999:
|
||||
return None # 跳过过大的数字
|
||||
return episode_num
|
||||
|
||||
return None
|
||||
|
||||
Loading…
Reference in New Issue
Block a user