From cffce0f8b7243f1d08341f8949aa397a60a9ef59 Mon Sep 17 00:00:00 2001 From: caiwx86 Date: Mon, 16 Jan 2023 04:02:00 +0800 Subject: [PATCH] fix --- utils/comic/ComicInfo.py | 7 +++++-- utils/entity/BaseComicEntity.py | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/utils/comic/ComicInfo.py b/utils/comic/ComicInfo.py index a094a8d..d3ac751 100644 --- a/utils/comic/ComicInfo.py +++ b/utils/comic/ComicInfo.py @@ -448,9 +448,12 @@ class comicInfo(): cls.nextSavePath("done_",data) @classmethod - def nextExistsGetPath(cls,msg): + def nextExistsGetPath(cls,msg,remove=False): path = cls.nextSavePath(msg) - return os.path.exists(path) + is_exists = os.path.exists(path) + if remove and is_exists: + os.remove(path) + return is_exists @classmethod def saveConfComicData(cls,fileName,data,comicName=None): diff --git a/utils/entity/BaseComicEntity.py b/utils/entity/BaseComicEntity.py index d1a268b..faaf5df 100644 --- a/utils/entity/BaseComicEntity.py +++ b/utils/entity/BaseComicEntity.py @@ -40,6 +40,8 @@ class baseComic: cbz_path = comicInfo.getNewCBZComicChapter("file") comicInfo.getNewIconComicChapter() CBZUtils.replaceZip(cbz_path) + if comicInfo.nextExistsGetPath("done_") and not os.path.exists(cbz_path): + comicInfo.nextExistsGetPath("done_",remove=True) chapter_index = chapter_index + 1 return None @@ -69,6 +71,8 @@ class baseComic: chapter = chapters[cls.count_chapter] comicInfo.setChapterIndex(cls.count_chapter+1) comicInfo.setChapterName(chapter) + if comicInfo.nextExistsGetPath("done_") and not os.path.exists(comicInfo.getNewCBZComicChapter("file")): + comicInfo.nextExistsGetPath("done_",remove=True) if not comicInfo.nextExistsGetPath("done_"): cls.comicChapter(href,scramble=True,sleep=random.randint(5,15)) #存在就校验CBZ包是否完整