From 3096702051eb048e526c016457eca4ac8eebbcfd Mon Sep 17 00:00:00 2001 From: x1ao4 Date: Tue, 23 Sep 2025 12:50:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=89=A7=E9=9B=86=E7=BC=96?= =?UTF-8?q?=E5=8F=B7=E6=8F=90=E5=8F=96=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=8A=80=E6=9C=AF=E8=A7=84=E6=A0=BC=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/js/sort_file_by_name.js | 57 +++++++++++++++++++-- quark_auto_save.py | 81 +++++++++++++++++++++++++----- 2 files changed, 122 insertions(+), 16 deletions(-) diff --git a/app/static/js/sort_file_by_name.js b/app/static/js/sort_file_by_name.js index 1aaf4bf..745d211 100644 --- a/app/static/js/sort_file_by_name.js +++ b/app/static/js/sort_file_by_name.js @@ -149,15 +149,64 @@ function sortFileByName(file) { if (/^\d+$/.test(file_name_without_ext)) { episode_value = parseInt(file_name_without_ext); } else { - // 预处理:移除分辨率标识(如 720p, 1080P, 2160p 等) + // 预处理:移除技术规格信息,避免误提取技术参数中的数字为集编号 let filename_without_resolution = filename; - const resolution_patterns = [ + const tech_spec_patterns = [ + // 分辨率相关 /\b\d+[pP]\b/g, // 匹配 720p, 1080P, 2160p 等 /\b\d+x\d+\b/g, // 匹配 1920x1080 等 - // 注意:不移除4K/8K,避免误删文件名中的4K标识 + /(? 0 else '' if prev_char in 'Ee': continue + # 保护 E 格式的集编号,如 E07, E14 等 + if re.match(r'^\d+$', date_str) and len(date_str) <= 3: + prev_char = filename_without_dates[match.start()-1] if match.start() > 0 else '' + if prev_char in 'Ee': + continue month = None day = None @@ -569,15 +574,65 @@ 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 = [ + # 预处理:移除技术规格信息,避免误提取技术参数中的数字为集编号 + tech_spec_patterns = [ + # 分辨率相关 r'\b\d+[pP]\b', # 匹配 720p, 1080P, 2160p 等 r'\b\d+x\d+\b', # 匹配 1920x1080 等 r'(?