Revert some code styles to adapt to Python 3.7
This commit is contained in:
8
core.py
8
core.py
@@ -344,11 +344,11 @@ def add_to_pic(pic_path, img_pic, size, count, mode):
|
||||
print('[-]Error: watermark image param mode invalid!')
|
||||
return
|
||||
# 先找pyinstaller打包的图片
|
||||
if hasattr(sys, '_MEIPASS') and os.path.isfile(_p := os.path.join(getattr(sys, '_MEIPASS'), pngpath)):
|
||||
mark_pic_path = _p
|
||||
if hasattr(sys, '_MEIPASS') and os.path.isfile(os.path.join(getattr(sys, '_MEIPASS'), pngpath)):
|
||||
mark_pic_path = os.path.join(getattr(sys, '_MEIPASS'), pngpath)
|
||||
# 再找py脚本所在路径的图片
|
||||
elif os.path.isfile(_p := os.path.join(os.path.dirname(os.path.realpath(__file__)), pngpath)):
|
||||
mark_pic_path = _p
|
||||
elif os.path.isfile(os.path.join(os.path.dirname(os.path.realpath(__file__)), pngpath)):
|
||||
mark_pic_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), pngpath)
|
||||
# 如果没有本地图片才通过网络下载
|
||||
else:
|
||||
mark_pic_path = BytesIO(
|
||||
|
||||
@@ -43,7 +43,8 @@ def get_number(debug,filepath: str) -> str:
|
||||
lower_check = filename.lower()
|
||||
if 'fc2' in lower_check:
|
||||
filename = lower_check.replace('ppv', '').replace('--', '-').replace('_', '-').upper()
|
||||
if file_number := get_number_by_dict(lower_check):
|
||||
file_number = get_number_by_dict(lower_check)
|
||||
if file_number:
|
||||
return file_number
|
||||
return str(re.search(r'\w+(-|_)\w+', filename, re.A).group())
|
||||
else: # 提取不含减号-的番号,FANZA CID
|
||||
@@ -70,7 +71,8 @@ def get_number(debug,filepath: str) -> str:
|
||||
lower_check = filename.lower()
|
||||
if 'fc2' in lower_check:
|
||||
filename = lower_check.replace('ppv', '').replace('--', '-').replace('_', '-').upper()
|
||||
if file_number := get_number_by_dict(lower_check):
|
||||
file_number = get_number_by_dict(lower_check)
|
||||
if file_number:
|
||||
return file_number
|
||||
return str(re.search(r'\w+(-|_)\w+', filename, re.A).group())
|
||||
else: # 提取不含减号-的番号,FANZA CID
|
||||
|
||||
Reference in New Issue
Block a user