From 5b605112fb4ef89b0d08bca86147aa35d4568517 Mon Sep 17 00:00:00 2001 From: sqzw-x Date: Mon, 11 Mar 2024 19:34:37 +0800 Subject: [PATCH] chore --- src/models/base/number.py | 44 +++++++++++++++++++++++++----- src/models/config/config_manual.py | 2 +- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/models/base/number.py b/src/models/base/number.py index 406eb60..7fa69fb 100644 --- a/src/models/base/number.py +++ b/src/models/base/number.py @@ -120,45 +120,57 @@ def get_file_number(filepath): file_name = remove_escape_string(real_name) + '.' # 替换cd_part、EP、-C - filename = file_name.replace('-C.', '.').replace('.PART', '-CD').replace('-PART', '-CD').replace(' EP.', - '.EP').replace( - '-CD-', '') + filename = (file_name. + replace('-C.', '.'). + replace('.PART', '-CD'). + replace('-PART', '-CD'). + replace(' EP.', '.EP'). + replace('-CD-', '')) # 去除分集 filename = re.sub(r'[-_ .]CD\d{1,2}', '', filename) # xxx-CD1.mp4 - filename = re.sub(r'[-_ .][A-Z0-9]{1}\.$', '', filename) # xxx_1.mp4, xxx.1.mp4, xxx.A.mp4, xxx A.mp4 + filename = re.sub(r'[-_ .][A-Z0-9]\.$', '', filename) # xxx_1.mp4, xxx.1.mp4, xxx.A.mp4, xxx A.mp4 filename = filename.replace(' ', '-').strip('-_. ') oumei_filename = filename # 去除时间 filename = re.sub(r"\d{4}[-_.]\d{1,2}[-_.]\d{1,2}", "", filename) # 去除文件名中时间 - filename = re.sub(r"[-\[]\d{2}[-_.]\d{2}[-_.]\d{2}\]?", "", filename) # 去除文件名中时间 + filename = re.sub(r"[-\[]\d{2}[-_.]\d{2}[-_.]\d{2}]?", "", filename) # 去除文件名中时间 # 转换番号 - filename = filename.replace('FC2-PPV', 'FC2-').replace('FC2PPV', 'FC2-').replace('--', '-').replace('GACHIPPV', - 'GACHI') + filename = (filename.replace('FC2-PPV', 'FC2-'). + replace('FC2PPV', 'FC2-'). + replace('--', '-'). + replace('GACHIPPV', 'GACHI')) # 提取番号 if 'MYWIFE' in filename and re.search(r'NO\.\d*', filename): # 提取 mywife No.1111 temp_num = re.findall(r'NO\.(\d*)', filename)[0] return f'Mywife No.{temp_num}' + elif re.search(r'CW3D2D?BD-?\d{2,}', filename): # 提取番号 CW3D2DBD-11 file_number = re.search(r'CW3D2D?BD-?\d{2,}', filename).group() return file_number + elif re.search(r'MMR-?[A-Z]{2,}-?\d+[A-Z]*', filename): # 提取番号 mmr-ak089sp file_number = re.search(r'MMR-?[A-Z]{2,}-?\d+[A-Z]*', filename).group() return file_number.replace('MMR-', 'MMR') + elif re.search(r'([^A-Z]|^)(MD[A-Z-]*\d{4,}(-\d{1})?)', file_name) and 'MDVR' not in file_name: # 提取番号 md-0165-1 file_number = re.search(r'([^A-Z]|^)(MD[A-Z-]*\d{4,}(-\d{1})?)', file_name).group(2) return file_number + elif re.findall(r'([A-Z0-9_]{2,})[-\.]{1}2?0?(\d{2}[-\.]\d{2}[-\.]\d{2})', oumei_filename): # 提取欧美番号 sexart.11.11.11 result = re.findall(r'([A-Z0-9-]{2,})[-_\.]{1}2?0?(\d{2}[-\.]\d{2}[-\.]\d{2})', oumei_filename) return (long_name(result[0][0].strip('-')) + '.' + result[0][1].replace('-', '.')).capitalize() + elif re.search(r'XXX-AV-\d{4,}', filename): # 提取xxx-av-11111 file_number = re.search(r'XXX-AV-\d{4,}', filename).group() + elif re.search(r'MKY-[A-Z]+-\d{3,}', filename): # MKY-A-11111 file_number = re.search(r'MKY-[A-Z]+-\d{3,}', filename).group() + elif 'FC2' in filename: filename = filename.replace('PPV', '').replace('_', '-').replace('--', '-') if re.search(r'FC2-\d{5,}', filename): # 提取类似fc2-111111番号 @@ -167,6 +179,7 @@ def get_file_number(filepath): file_number = re.search(r'FC2\d{5,}', filename).group().replace('FC2', 'FC2-') else: file_number = filename + elif 'HEYZO' in filename: filename = filename.replace('_', '-').replace('--', '-') if re.search(r'HEYZO-\d{3,}', filename): # HEYZO-1111番号 @@ -175,46 +188,63 @@ def get_file_number(filepath): file_number = re.search(r'HEYZO\d{3,}', filename).group().replace('HEYZO', 'HEYZO-') else: file_number = filename + elif re.search(r'(H4610|C0930|H0930)-[A-Z]+\d{4,}', filename): # 提取H4610-ki111111 c0930-ki221218 h0930-ori1665 file_number = re.search(r'(H4610|C0930|H0930)-[A-Z]+\d{4,}', filename).group() + elif re.search(r'KIN8(TENGOKU)?-?\d{3,}', filename): # 提取S2MBD-002 或S2MBD-006 file_number = re.search(r'KIN8(TENGOKU)?-?\d{3,}', filename).group().replace('TENGOKU', '-').replace('--', '-') + elif re.search(r'S2M[BD]*-\d{3,}', filename): # 提取S2MBD-002 或S2MBD-006 file_number = re.search(r'S2M[BD]*-\d{3,}', filename).group() + elif re.search(r'MCB3D[BD]*-\d{2,}', filename): # MCB3DBD-33 file_number = re.search(r'MCB3D[BD]*-\d{2,}', filename).group() + elif re.search(r'T28-?\d{3,}', filename): # 提取T28-223 file_number = re.search(r'T28-?\d{3,}', filename).group().replace('T2800', 'T28-') + elif re.search(r'TH101-\d{3,}-\d{5,}', filename): # 提取th101-140-112594 file_number = re.search(r'TH101-\d{3,}-\d{5,}', filename).group().lower() + elif re.search(r'([A-Z]{2,})00(\d{3})', filename): # 提取ssni00644为ssni-644 a = re.search(r'([A-Z]{2,})00(\d{3})', filename) file_number = a[1] + '-' + a[2] + elif re.search(r'\d{2,}[A-Z]{2,}-\d{2,}[A-Z]?', filename): # 提取类似259luxu-1456番号 file_number = re.search(r'\d{2,}[A-Z]{2,}-\d{2,}[A-Z]?', filename).group() + elif re.search(r'[A-Z]{2,}-\d{2,}', filename): # 提取类似mkbd-120番号 file_number = re.search(r'[A-Z]{2,}-\d{2,}[Z]?', filename).group() for key, value in config.suren_dic.items(): if key in file_number: file_number = value + file_number break + elif re.search(r'[A-Z]+-[A-Z]\d+', filename): # 提取类似mkbd-s120番号 file_number = re.search(r'[A-Z]+-[A-Z]\d+', filename).group() + elif re.search(r'\d{2,}[-_]\d{2,}', filename): # 提取类似 111111-000 111111_000 番号 file_number = re.search(r'\d{2,}[-_]\d{2,}', filename).group() + elif re.search(r'\d{3,}-[A-Z]{3,}', filename): # 提取类似 111111-MMMM 番号 file_number = re.search(r'\d+-[A-Z]+', filename).group() + elif re.search(r'([^A-Z]|^)(N\d{4})(\D|$)', filename): # 提取n1111 file_number = re.search(r'([^A-Z]|^)(N\d{4})(\D|$)', filename).group(2).lower() + elif re.search(r'H_\d{3,}([A-Z]{2,})(\d{2,})', filename): # 提取类似h_173mega05番号 a, b = re.search(r'H_\d{3,}([A-Z]{2,})(\d{2,})', filename).groups() file_number = a + '-' + b + elif re.findall(r'([A-Z]{3,}).*?(\d{2,})', filename): # 3个及以上字母,2个及以上数字 temp = re.findall(r'([A-Z]{3,}).*?(\d{2,})', filename)[0] file_number = temp[0] + '-' + temp[1] + elif re.findall(r'([A-Z]{2,}).*?(\d{3,})', filename): # 2个及以上字母,3个及以上数字 temp = re.findall(r'([A-Z]{2,}).*?(\d{3,})', filename)[0] file_number = temp[0] + '-' + temp[1] + else: temp_name = re.sub(r'[【((\[].+?[\]))】]', '', file_name).strip('@. ') # 去除[] temp_name = unicodedata.normalize('NFC', temp_name) # Mac 把会拆成两个字符,即 NFD,而网页请求使用的是 NFC diff --git a/src/models/config/config_manual.py b/src/models/config/config_manual.py index 8b48b3d..2bd49e0 100644 --- a/src/models/config/config_manual.py +++ b/src/models/config/config_manual.py @@ -490,7 +490,7 @@ class ManualConfig: '1280×720', '960×720', '640×480', - '90fps' + '90fps', '60fps', '30fps', '.cht',