This commit is contained in:
caiwx86 2022-12-20 19:04:36 +08:00
parent e65a1cd79d
commit 025c58fd3b
3 changed files with 24 additions and 4 deletions

View File

@ -20,7 +20,6 @@ class CBZUtils:
@classmethod @classmethod
def zip_compression(cls,source_dir, target_file): def zip_compression(cls,source_dir, target_file):
msg = {}
target_dir = os.path.dirname(target_file) target_dir = os.path.dirname(target_file)
if not os.path.exists(target_dir): if not os.path.exists(target_dir):
os.makedirs(target_dir) os.makedirs(target_dir)
@ -40,7 +39,7 @@ class CBZUtils:
#md5_file = md5(target_file) #md5_file = md5(target_file)
#print("md5:", md5_file) #print("md5:", md5_file)
#msg[target_file] = md5_file #msg[target_file] = md5_file
return msg return len(filenames)
else: else:
print("文件已存在:", target_file) print("文件已存在:", target_file)
@ -56,5 +55,17 @@ class CBZUtils:
os.remove(file) os.remove(file)
except: except:
print(f"删除 {file} 发生错误,已跳过") print(f"删除 {file} 发生错误,已跳过")
cls.zip_compression(chapter_path,packCBZ_path+".CBZ") cbz_size = cls.zip_compression(chapter_path,packCBZ_path+".CBZ")
comicInfo.nextCBZToDoneChapter() 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}")

View File

@ -24,6 +24,7 @@ class comicInfo():
str_icon = None str_icon = None
str_homePage = None str_homePage = None
str_listChapter = None str_listChapter = None
str_chapter_imgs = None
chapter_node = None chapter_node = None
comicName_node = None comicName_node = None
@ -57,6 +58,13 @@ class comicInfo():
def setListChapter(cls, value): def setListChapter(cls, value):
cls.str_listChapter = 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 @classmethod
def getLenChapters(cls): def getLenChapters(cls):

View File

@ -198,4 +198,5 @@ class comicEntity:
count+=1 count+=1
print("count_all_img=", count) print("count_all_img=", count)
#netUtils.downloadComicChapterImages(list_img,scrambles=list_scramble) #netUtils.downloadComicChapterImages(list_img,scrambles=list_scramble)
comicInfo.setChapterImgs(list_img)
return download_images(list_img,comicInfo.getDirComicChapter(), filesName=list_fileName) return download_images(list_img,comicInfo.getDirComicChapter(), filesName=list_fileName)