This commit is contained in:
cwx
2023-04-01 13:23:34 +08:00
parent a756a1d1b8
commit 8deb799280
5 changed files with 12 additions and 21 deletions
+1
View File
@@ -157,4 +157,5 @@ class CBZUtils:
@classmethod
def nextCBZ(cls,list_img=None):
if list_img == None: list_img = comicInfo.getChapterImgs()
return not cls.verCBZComic(list_img=list_img)
+5 -14
View File
@@ -108,30 +108,21 @@ class baseComic:
if comic_main == None: print("comic_main为空,退出中...") & exit()
(list_img,files_name,chapter_name,book_name) = [ci.getChapterListImg(),ci.getChapterFilesName(),ci.getChapter(),ci.getComicName()]
ci.setChapterImgs(list_img)
#保存信息
ci.nextSaveInfoChapter(chapter_name, list_img)
ci.nextSaveInfoChapter(chapter_name,list_img)
#验证数据是已存在且是否完整
#cbz_path = ci.getDirCBZComicChapter()+".CBZ"
cbz_file = ci.getNewFileCBZComicChapter()
#更新Icon
ci.getNewIconComicChapter()
#检验CBZ文件
CBZUtils.verCBZComic(cbz_file)
if is_next and fu.notExists(ci.getPathComicInfoXML()):
#print("不存在ComicInfo.xml 生成中...")
ci.setPages(files_name)
ci.writeComicInfoXML(chapter_name)
is_next = CBZUtils.nextCBZ(list_img)
#不存在ComicInfo.xml则生成
if is_next and fu.notExists(ci.getPathComicInfoXML()): ci.writeComicInfoXML(chapter_name)
repeat = 1
while is_next and repeat <= 10 and not CBZUtils.updateOldCBZ(files_name):
while CBZUtils.nextCBZ() and repeat <= 10 and not CBZUtils.updateOldCBZ(files_name):
ntfy.sendMsg(f"{book_name} {chapter_name} 下载中")
download_images(list_img,ci.getDirComicChapter(), files_name=files_name,concurrency=None,timeout=8)
equ_next = len(",".join(os.listdir(ci.getDirComicChapter())).split(".jpg"))-1 == len(list_img)
if not equ_next:
sleep_time = int(repeat)*2
time.sleep(sleep_time)
ntfy.sendMsg(f"下载数据(不完整,{sleep_time}秒钟后尝试第{repeat}")
if not equ_next: ntfy.sendMsg(msg=f"下载数据(不完整,{int(repeat*2)}秒钟后尝试第{repeat}",sleep=int(repeat*2))
repeat += 1
return is_next
+4 -1
View File
@@ -414,7 +414,8 @@ class comicInfo():
return save_path
@classmethod
def nextSaveInfoChapter(cls,chapter,data):
def nextSaveInfoChapter(cls,chapter,data=None):
if data == None: data = cls.getChapterImgs()
if cls.str_chapter != chapter:
print(f"chapter {cls.str_chapter}{chapter} 不一致,已自动跳过")
cls.setProgress(cls.PROGRESS_INFO)
@@ -468,7 +469,9 @@ class comicInfo():
@classmethod
def comicChapterDownload(cls,imgs,names):
cls.setChapterImgs(imgs)
cls.setChapterListImg(imgs)
cls.setPages(names)
cls.setChapterFilesName(names)
@classmethod