fix
This commit is contained in:
+27
-4
@@ -6,6 +6,7 @@ from utils.comic.ComicInfo import comicInfo
|
||||
from utils.CBZUtils import CBZUtils
|
||||
from utils.downloader import download_images
|
||||
from utils.Ntfy import ntfy
|
||||
from utils.VerUtils import verUtils
|
||||
|
||||
class comicEntity:
|
||||
count_chapter = 0
|
||||
@@ -83,6 +84,9 @@ class comicEntity:
|
||||
comicInfo.setChapterName(chapter)
|
||||
if not comicInfo.nextExistsGetPath("done_"):
|
||||
comicEntity.comicChapter(href,scramble=True,sleep=random.randint(15,25))
|
||||
#存在就校验CBZ包是否完整
|
||||
if comicInfo.nextExistsGetPath("done_"):
|
||||
verUtils.verCBZ()
|
||||
cls.count_chapter += 1
|
||||
#一本漫画下载后等待
|
||||
#清空文件夹
|
||||
@@ -152,7 +156,6 @@ class comicEntity:
|
||||
#fileUtils.saveConfComicChapterInfo(chapterName,x,bookName)
|
||||
#if comicInfo.nextExistsGetPath("info_"):
|
||||
# print(f"{bookName} {chapterName} info文件已存在跳过")
|
||||
comicInfo.nextSaveInfoChapter(chapterName,x)
|
||||
alias = x.get("alias")
|
||||
description = x.get("description")
|
||||
images = x.get("images")
|
||||
@@ -166,7 +169,7 @@ class comicEntity:
|
||||
print("不存在ComicInfo.xml 生成中...")
|
||||
comicInfo.writeComicInfoXML(chapterName)
|
||||
|
||||
if not chapterAPIPath == None:
|
||||
if chapterAPIPath != None:
|
||||
base_url = comicInfo.getBaseUrl(chapter_url)
|
||||
chapterAPIUrl = base_url+chapterAPIPath
|
||||
data = htmlUtils.getJSON(chapterAPIUrl)
|
||||
@@ -175,7 +178,7 @@ class comicEntity:
|
||||
images = data.get("images")
|
||||
if images == None:
|
||||
ntfy.sendMsg(f"未获取到章节图像 comic_name={bookName} chapter={chapterName}")
|
||||
totalChapter = x.get("totalChapter")
|
||||
|
||||
tags = x.get("tags")
|
||||
x = tags
|
||||
print(x)
|
||||
@@ -199,4 +202,24 @@ class comicEntity:
|
||||
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)
|
||||
#保存图像
|
||||
comicInfo.nextSaveInfoChapter(chapterName, list_img)
|
||||
#验证数据是已存在且是否完整
|
||||
cbz_path = comicInfo.getDirCBZComicChapter()+".CBZ"
|
||||
is_next = True
|
||||
if os.path.exists(cbz_path):
|
||||
try:
|
||||
cbz_size = len(CBZUtils.zip_info(cbz_path)) - 1
|
||||
except:
|
||||
cbz_size = 0
|
||||
if len(list_img) == cbz_size:
|
||||
ntfy.sendMsg("数据完整,已跳过")
|
||||
is_next = False
|
||||
else:
|
||||
try:
|
||||
ntfy.sendMsg(f"删除 {cbz_path}")
|
||||
os.remove(cbz_path)
|
||||
except:
|
||||
ntfy(f"删除失败 {cbz_path}")
|
||||
if is_next:
|
||||
return download_images(list_img,comicInfo.getDirComicChapter(), filesName=list_fileName)
|
||||
Reference in New Issue
Block a user