Skip to content

Commit

Permalink
Merge pull request mvdctop#479 from lededev/10mu-1
Browse files Browse the repository at this point in the history
case insensitive strip, add 10musume and pacopacomama detect
  • Loading branch information
mvdctop authored May 7, 2021
2 parents 4e40928 + d9b936b commit f02fe16
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions number_parser.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
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:
# """
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit f02fe16

Please sign in to comment.