Merge pull request #479 from lededev/10mu-1

case insensitive strip, add 10musume and pacopacomama detect
This commit is contained in:
Yoshiko2
2021-05-08 00:42:30 +08:00
committed by GitHub

12
number_parser.py Normal file → Executable file
View File

@@ -3,6 +3,10 @@ import re
from core import *
G_spat = re.compile(
"(^22-sht\.me|-fhd|_fhd|^fhd_|^fhd-|-hd|_hd|^hd_|^hd-|-sd|_sd|-1080p|_1080p|-720p|_720p)",
re.IGNORECASE)
def get_number(debug,filepath: str) -> str:
# """
@@ -34,7 +38,7 @@ def get_number(debug,filepath: str) -> str:
try:
if '-' in filepath or '_' in filepath: # 普通提取番号 主要处理包含减号-和_的番号
#filepath = filepath.replace("_", "-")
filepath.strip('22-sht.me').strip('-HD').strip('-hd')
filepath = G_spat.sub("", filepath)
filename = str(re.sub("\[\d{4}-\d{1,2}-\d{1,2}\] - ", "", filepath)) # 去除文件名中时间
lower_check = filename.lower()
if 'fc2' in lower_check:
@@ -44,7 +48,7 @@ def get_number(debug,filepath: str) -> str:
file_number = re.search(r'(cz|k|n|red-|se)\d{3,4}', lower_check, re.A).group()
elif "carib" in lower_check:
file_number = str(re.search(r'\d{6}(-|_)\d{3}', lower_check, re.A).group()).replace('_', '-')
elif "1pon" in lower_check:
elif "1pon" in lower_check or "paco" in lower_check:
file_number = str(re.search(r'\d{6}(-|_)\d{3}', lower_check, re.A).group()).replace('-', '_')
return file_number
else: # 提取不含减号-的番号FANZA CID
@@ -66,7 +70,7 @@ def get_number(debug,filepath: str) -> str:
elif debug == True:
if '-' in filepath or '_' in filepath: # 普通提取番号 主要处理包含减号-和_的番号
#filepath = filepath.replace("_", "-")
filepath.strip('22-sht.me').strip('-HD').strip('-hd')
filepath = G_spat.sub("", filepath)
filename = str(re.sub("\[\d{4}-\d{1,2}-\d{1,2}\] - ", "", filepath)) # 去除文件名中时间
lower_check = filename.lower()
if 'fc2' in lower_check:
@@ -76,7 +80,7 @@ def get_number(debug,filepath: str) -> str:
file_number = re.search(r'(cz|k|n|red-|se)\d{3,4}', lower_check, re.A).group()
elif "carib" in lower_check:
file_number = str(re.search(r'\d{6}(-|_)\d{3}', lower_check, re.A).group()).replace('_', '-')
elif "1pon" in lower_check:
elif "1pon" in lower_check or "paco" in lower_check:
file_number = str(re.search(r'\d{6}(-|_)\d{3}', lower_check, re.A).group()).replace('-', '_')
return file_number
else: # 提取不含减号-的番号FANZA CID