PyComicPackRouMan/utils/VerUtils.py
2022-12-20 21:00:37 +08:00

35 lines
1.2 KiB
Python

from utils.Ntfy import ntfy
from utils.CBZUtils import CBZUtils
from utils.comic.ComicInfo import comicInfo
import json,os
class verUtils:
@classmethod
def verCBZ(cls,data=None):
len_zip = len(CBZUtils.zip_info()) - 1
info_data = None
if data == None:
info_path = comicInfo.nextSavePath("done_")
try:
with open(info_path,"r",encoding="utf-8") as fs:
info_data = json.loads(fs.read())
fs.close()
except:
ntfy.sendMsg("校验失败")
else:
info_data = data
if info_data != None:
if len(info_data) == len_zip:
ntfy.sendMsg("数据完成")
return True
else:
ntfy.sendMsg("数据不完整,删除配置文件中")
try:
os.remove(comicInfo.nextSavePath("done_"))
ntfy.sendMsg("配置文件删除成功")
except:
ntfy.sendMsg("配置文件删除失败")
return False
else:
ntfy.sendMsg("info_data 为空")
return False