case insensitive strip, poco detect
This commit is contained in:
10
number_parser.py
Normal file → Executable file
10
number_parser.py
Normal file → Executable file
@@ -3,6 +3,8 @@ import re
|
|||||||
from core import *
|
from core import *
|
||||||
|
|
||||||
|
|
||||||
|
G_spat = re.compile("(22-sht\.me|bbs2048@|-fhd|_fhd|fhd_|fhd-|-hd|_hd|hd_|hd-|-sd|_sd|-1080p|_1080p)", re.IGNORECASE)
|
||||||
|
|
||||||
|
|
||||||
def get_number(debug,filepath: str) -> str:
|
def get_number(debug,filepath: str) -> str:
|
||||||
# """
|
# """
|
||||||
@@ -34,7 +36,7 @@ def get_number(debug,filepath: str) -> str:
|
|||||||
try:
|
try:
|
||||||
if '-' in filepath or '_' in filepath: # 普通提取番号 主要处理包含减号-和_的番号
|
if '-' in filepath or '_' in filepath: # 普通提取番号 主要处理包含减号-和_的番号
|
||||||
#filepath = filepath.replace("_", "-")
|
#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)) # 去除文件名中时间
|
filename = str(re.sub("\[\d{4}-\d{1,2}-\d{1,2}\] - ", "", filepath)) # 去除文件名中时间
|
||||||
lower_check = filename.lower()
|
lower_check = filename.lower()
|
||||||
if 'fc2' in lower_check:
|
if 'fc2' in lower_check:
|
||||||
@@ -44,7 +46,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()
|
file_number = re.search(r'(cz|k|n|red-|se)\d{3,4}', lower_check, re.A).group()
|
||||||
elif "carib" in lower_check:
|
elif "carib" in lower_check:
|
||||||
file_number = str(re.search(r'\d{6}(-|_)\d{3}', lower_check, re.A).group()).replace('_', '-')
|
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('-', '_')
|
file_number = str(re.search(r'\d{6}(-|_)\d{3}', lower_check, re.A).group()).replace('-', '_')
|
||||||
elif "10mu" in lower_check:
|
elif "10mu" in lower_check:
|
||||||
file_number = str(re.search(r'\d{6}(-|_)\d{2}', lower_check, re.A).group()).replace('-', '_')
|
file_number = str(re.search(r'\d{6}(-|_)\d{2}', lower_check, re.A).group()).replace('-', '_')
|
||||||
@@ -68,7 +70,7 @@ def get_number(debug,filepath: str) -> str:
|
|||||||
elif debug == True:
|
elif debug == True:
|
||||||
if '-' in filepath or '_' in filepath: # 普通提取番号 主要处理包含减号-和_的番号
|
if '-' in filepath or '_' in filepath: # 普通提取番号 主要处理包含减号-和_的番号
|
||||||
#filepath = filepath.replace("_", "-")
|
#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)) # 去除文件名中时间
|
filename = str(re.sub("\[\d{4}-\d{1,2}-\d{1,2}\] - ", "", filepath)) # 去除文件名中时间
|
||||||
lower_check = filename.lower()
|
lower_check = filename.lower()
|
||||||
if 'fc2' in lower_check:
|
if 'fc2' in lower_check:
|
||||||
@@ -78,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()
|
file_number = re.search(r'(cz|k|n|red-|se)\d{3,4}', lower_check, re.A).group()
|
||||||
elif "carib" in lower_check:
|
elif "carib" in lower_check:
|
||||||
file_number = str(re.search(r'\d{6}(-|_)\d{3}', lower_check, re.A).group()).replace('_', '-')
|
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('-', '_')
|
file_number = str(re.search(r'\d{6}(-|_)\d{3}', lower_check, re.A).group()).replace('-', '_')
|
||||||
elif "10mu" in lower_check:
|
elif "10mu" in lower_check:
|
||||||
file_number = str(re.search(r'\d{6}(-|_)\d{2}', lower_check, re.A).group()).replace('-', '_')
|
file_number = str(re.search(r'\d{6}(-|_)\d{2}', lower_check, re.A).group()).replace('-', '_')
|
||||||
|
|||||||
Reference in New Issue
Block a user