fix
This commit is contained in:
parent
9ec3dc5a72
commit
f5b883f736
1
main.py
1
main.py
@ -1,6 +1,5 @@
|
||||
import os,skip
|
||||
from utils.comic.PathStr import pathStr
|
||||
from utils.comic.ComicInfo import comicInfo
|
||||
from entity.BaoZi import comicEntity as baoziEntity
|
||||
from entity.RouMan import comicEntity as roumanEntity
|
||||
|
||||
|
||||
@ -167,62 +167,4 @@ class CBZUtils:
|
||||
|
||||
@classmethod
|
||||
def nextCBZ(cls,list_img=None):
|
||||
return not cls.verCBZComic(list_img=list_img)
|
||||
|
||||
|
||||
class verUtils:
|
||||
@classmethod
|
||||
def depverNextCBZ(cls,list_img=None):
|
||||
#验证数据是已存在且是否完整
|
||||
if list_img == None:
|
||||
comicInfo.getChapterImgs()
|
||||
cbz_path = CBZUtils.getCBZ_Path()
|
||||
is_next = False
|
||||
if os.path.exists(cbz_path):
|
||||
try:
|
||||
cbz_size = len(CBZUtils.zip_info(cbz_path))
|
||||
except:
|
||||
cbz_size = 0
|
||||
if len(list_img) == cbz_size:
|
||||
ntfy.sendMsg(f"{comicInfo.getComicName()} {comicInfo.getChapter()} 数据完整")
|
||||
is_next = True
|
||||
else:
|
||||
ntfy.sendMsg(f"{comicInfo.getComicName()} {comicInfo.getChapter()} 数据不完整,尝试删除配置CBZ文件后重试")
|
||||
try:
|
||||
if cbz_size > len(list_img) or os.path.getsize(cbz_path) < 300000:
|
||||
ntfy.sendMsg(f"删除 {cbz_path}")
|
||||
os.remove(cbz_path)
|
||||
comicInfo.setProgress(comicInfo.PROGRESS_NONE)
|
||||
else:
|
||||
is_next = True
|
||||
except:
|
||||
ntfy(f"删除失败 {cbz_path}")
|
||||
return is_next
|
||||
|
||||
@classmethod
|
||||
def existsUnzipCBZ(cls,filesname):
|
||||
result = False
|
||||
unzip_base_path = pathStr.base_unzip_path
|
||||
zipfile_path = os.path.join(unzip_base_path,comicInfo.str_comic_name,comicInfo.str_chapter+".CBZ")
|
||||
#判断是否存在已下载CBZ文件
|
||||
if os.path.exists(zipfile_path) and not os.path.exists(CBZUtils.getCBZ_Path()):
|
||||
print(f"存在CBZ文件{zipfile_path},解压中")
|
||||
zip_file = ZipFile(zipfile_path)
|
||||
#CBZ中文件数量,剔除ComicInfo.xml
|
||||
if len(filesname) == len(zip_file.namelist())-1:
|
||||
unzip_path = comicInfo.getDirComicChapter()
|
||||
zip_file.extractall(unzip_path)
|
||||
zip_file.close()
|
||||
print(f"解压完成: CBZ文件{zipfile_path}")
|
||||
print(f"文件校验中")
|
||||
for file in os.listdir(unzip_path):
|
||||
if file.endswith(".jpg") and not fileUtils.ver_file(os.path.join(unzip_path,file),type="image"):
|
||||
#清空文件
|
||||
try:
|
||||
shutil.rmtree(unzip_path)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return False
|
||||
comicInfo.writeComicInfoXML(overlay=True)
|
||||
result = True
|
||||
return result
|
||||
return not cls.verCBZComic(list_img=list_img)
|
||||
@ -3,7 +3,6 @@ from utils.HtmlUtils import htmlUtils
|
||||
from utils.FileUtils import imageUtils
|
||||
from utils.comic.ComicInfo import comicInfo as ci
|
||||
from utils.CBZUtils import CBZUtils
|
||||
from utils.CBZUtils import verUtils
|
||||
from utils.downloader import download_images
|
||||
from utils.downloader import download_comic_icon
|
||||
from utils.Ntfy import ntfy
|
||||
|
||||
Loading…
Reference in New Issue
Block a user