diff --git a/utils/CBZUtils.py b/utils/CBZUtils.py index 28812df..ab18aac 100644 --- a/utils/CBZUtils.py +++ b/utils/CBZUtils.py @@ -20,7 +20,6 @@ class CBZUtils: @classmethod def zip_compression(cls,source_dir, target_file): - msg = {} target_dir = os.path.dirname(target_file) if not os.path.exists(target_dir): os.makedirs(target_dir) @@ -40,7 +39,7 @@ class CBZUtils: #md5_file = md5(target_file) #print("md5:", md5_file) #msg[target_file] = md5_file - return msg + return len(filenames) else: print("文件已存在:", target_file) @@ -56,5 +55,17 @@ class CBZUtils: os.remove(file) except: print(f"删除 {file} 发生错误,已跳过") - cls.zip_compression(chapter_path,packCBZ_path+".CBZ") - comicInfo.nextCBZToDoneChapter() \ No newline at end of file + cbz_size = cls.zip_compression(chapter_path,packCBZ_path+".CBZ") + chapter_img_size = len(comicInfo.getChapterImgs()) + if cbz_size - 1 == chapter_img_size: + comicInfo.nextCBZToDoneChapter() + else: + cbz_path = comicInfo.nextSavePath("cbz_") + ntfy.sendMsg(f"{cbz_path} 数据不完整 删除配置文件中") + if os.path.exists(cbz_path): + try: + os.remove(cbz_path) + ntfy.sendMsg(f"删除成功 {cbz_path}") + except: + ntfy.sendMsg(f"删除失败 {cbz_path}") + diff --git a/utils/comic/ComicInfo.py b/utils/comic/ComicInfo.py index 737728a..f89ce3c 100644 --- a/utils/comic/ComicInfo.py +++ b/utils/comic/ComicInfo.py @@ -24,6 +24,7 @@ class comicInfo(): str_icon = None str_homePage = None str_listChapter = None + str_chapter_imgs = None chapter_node = None comicName_node = None @@ -57,6 +58,13 @@ class comicInfo(): def setListChapter(cls, value): cls.str_listChapter = value + @classmethod + def setChapterImgs(cls, value): + cls.str_chapter_imgs = value + + @classmethod + def getChapterImgs(cls): + return cls.str_chapter_imgs @classmethod def getLenChapters(cls): diff --git a/utils/entity/RouMan.py b/utils/entity/RouMan.py index 0b06024..2bfa41a 100644 --- a/utils/entity/RouMan.py +++ b/utils/entity/RouMan.py @@ -198,4 +198,5 @@ class comicEntity: count+=1 print("count_all_img=", count) #netUtils.downloadComicChapterImages(list_img,scrambles=list_scramble) + comicInfo.setChapterImgs(list_img) return download_images(list_img,comicInfo.getDirComicChapter(), filesName=list_fileName) \ No newline at end of file