fix
This commit is contained in:
parent
e6fe28b93f
commit
1f975c7c37
@ -1,5 +1,5 @@
|
||||
import os.path
|
||||
import re
|
||||
import os.path,logging
|
||||
import re,requests,time
|
||||
from Comics import settings
|
||||
from opencc import OpenCC
|
||||
class ComicPath:
|
||||
@ -73,4 +73,23 @@ class ComicPath:
|
||||
file = os.path.join(settings.CBZ_EXPORT_PATH, PROJECT, name, chapter+".CBZ")
|
||||
elif result_type == "images_dir":
|
||||
file = os.path.join(settings.IMAGES_STORE, PROJECT, "images", name, chapter)
|
||||
return file
|
||||
return file
|
||||
|
||||
class ntfy:
|
||||
@classmethod
|
||||
def sendMsg(cls, msg,alert=False,sleep=None,error=None):
|
||||
try:
|
||||
print(f"#ntfy: {msg}")
|
||||
if alert:
|
||||
requests.post("https://ntfy.caiwenxiu.cn/PyComic",
|
||||
data=msg.encode(encoding='utf-8'))
|
||||
except:
|
||||
print(f"#ntfy error: {msg}")
|
||||
if sleep != None:
|
||||
logging.info(f'等待{sleep}秒后进入下一阶段')
|
||||
time.sleep(int(sleep))
|
||||
if error != None:
|
||||
print(f"#ntfy Error: {error}")
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
@ -5,6 +5,7 @@ from Comics.utils.Constant import ComicPath
|
||||
from pathlib import Path
|
||||
from zipfile import ZipFile
|
||||
from Comics.settings import COMIC_INFO_XML_FILE,CBZ_EXPORT_PATH,IMAGES_STORE
|
||||
from Comics.utils.Constant import ntfy
|
||||
|
||||
class fileUtils:
|
||||
@classmethod
|
||||
@ -352,7 +353,8 @@ class CBZUtils:
|
||||
@classmethod
|
||||
def cbz_validate(cls, zip_path, comic_info_images):
|
||||
if len(cls.zip_info(zip_path)) == len(comic_info_images):
|
||||
logging.info(f"validating successfully === {zip_path}")
|
||||
# logging.info(f"validating successfully === {zip_path}")
|
||||
ntfy.sendMsg(f"validating successfully === {zip_path}", alert=True)
|
||||
return True
|
||||
else:
|
||||
os.remove(zip_path)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user