This commit is contained in:
caiwx86 2023-02-14 04:22:01 +08:00
parent ff8ee7a1d6
commit 0e7f1f2945

View File

@ -61,10 +61,15 @@ class CBZUtils:
zf.close()
ntfy.sendMsg(f"打包完成:{target_file}")
else:
with ZipFile(target_file, "r") as zfile:
filenames = zfile.namelist()
zfile.close()
print("文件已存在:", target_file)
len_chapter_imgs = len(comicInfo.getChapterImgs())
if len_chapter_imgs != 0 and len_chapter_imgs != cls.zip_info(target_file):
try:
os.remove(target_file)
comicInfo.setProgress(comicInfo.PROGRESS_NONE)
print("文件已删除:", target_file)
except Exception as e:
print(e)
if remove:
filenames.remove(comicInfo.COMIC_ICON_NAME+".jpg")
filenames.remove(comicInfo.COMIC_INFO_XML)
@ -125,11 +130,11 @@ class CBZUtils:
return False
@classmethod
def zip_info(cls,path,filter=False):
def zip_info(cls,path,filter=True):
result = None
try:
zip_file = ZipFile(path)
result = zip_file.namelist()
with ZipFile(path, "r") as zip_file:
result = zip_file.namelist()
if filter:
result.remove(comicInfo.COMIC_ICON_NAME+".jpg")
result.remove(comicInfo.COMIC_INFO_XML)