This commit is contained in:
caiwx86 2023-04-01 13:23:34 +08:00
parent a756a1d1b8
commit 8deb799280
5 changed files with 12 additions and 21 deletions

View File

@ -18,9 +18,6 @@ class comicCommon:
x = cls.baseComicData(chapter_url,update=True) x = cls.baseComicData(chapter_url,update=True)
book_name = x.get("bookName") book_name = x.get("bookName")
chapter_name = x.get("chapterName") chapter_name = x.get("chapterName")
#fileUtils.saveConfComicChapterInfo(chapterName,x,bookName)
#if comicInfo.nextExistsGetPath("info_"):
# print(f"{bookName} {chapterName} info文件已存在跳过")
alias = x.get("alias") alias = x.get("alias")
description = x.get("description") description = x.get("description")
images = x.get("images") images = x.get("images")
@ -31,8 +28,7 @@ class comicCommon:
if chapter_api_path != None: if chapter_api_path != None:
chapter_api_path = str(chapter_api_path).encode('utf-8').decode('unicode_escape') chapter_api_path = str(chapter_api_path).encode('utf-8').decode('unicode_escape')
base_url = comicInfo.getBaseUrl(chapter_url) chapter_api_url = comicInfo.getBaseUrl(chapter_url)+chapter_api_path
chapter_api_url = base_url+chapter_api_path
ntfy.sendMsg(f"chapterApiUrl= {chapter_api_url}",alert=False) ntfy.sendMsg(f"chapterApiUrl= {chapter_api_url}",alert=False)
data = htmlUtils.getJSON(chapter_api_url,update=True) data = htmlUtils.getJSON(chapter_api_url,update=True)
if data != None: if data != None:

View File

@ -7,7 +7,7 @@ def rouman():
pathStr.setComicMainAndPath(pathStr.comic_rm) pathStr.setComicMainAndPath(pathStr.comic_rm)
skip.roumanskip() skip.roumanskip()
for x in range(0,52): for x in range(0,52):
roumanEntity.downladsComcis("https://rm01.xyz/books?&page="+str(x)) roumanEntity.downladsComcis("https://rm01.xyz/books?&page="+str(x))
def baozi(): def baozi():
pathStr.setComicMainAndPath(pathStr.comic_bz) pathStr.setComicMainAndPath(pathStr.comic_bz)

View File

@ -157,4 +157,5 @@ class CBZUtils:
@classmethod @classmethod
def nextCBZ(cls,list_img=None): def nextCBZ(cls,list_img=None):
if list_img == None: list_img = comicInfo.getChapterImgs()
return not cls.verCBZComic(list_img=list_img) return not cls.verCBZComic(list_img=list_img)

View File

@ -108,30 +108,21 @@ class baseComic:
if comic_main == None: print("comic_main为空退出中...") & exit() if comic_main == None: print("comic_main为空退出中...") & exit()
(list_img,files_name,chapter_name,book_name) = [ci.getChapterListImg(),ci.getChapterFilesName(),ci.getChapter(),ci.getComicName()] (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() cbz_file = ci.getNewFileCBZComicChapter()
#更新Icon #更新Icon
ci.getNewIconComicChapter() ci.getNewIconComicChapter()
#检验CBZ文件 #检验CBZ文件
CBZUtils.verCBZComic(cbz_file) CBZUtils.verCBZComic(cbz_file)
#不存在ComicInfo.xml则生成
if is_next and fu.notExists(ci.getPathComicInfoXML()): if is_next and fu.notExists(ci.getPathComicInfoXML()): ci.writeComicInfoXML(chapter_name)
#print("不存在ComicInfo.xml 生成中...")
ci.setPages(files_name)
ci.writeComicInfoXML(chapter_name)
is_next = CBZUtils.nextCBZ(list_img)
repeat = 1 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} 下载中") ntfy.sendMsg(f"{book_name} {chapter_name} 下载中")
download_images(list_img,ci.getDirComicChapter(), files_name=files_name,concurrency=None,timeout=8) 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) equ_next = len(",".join(os.listdir(ci.getDirComicChapter())).split(".jpg"))-1 == len(list_img)
if not equ_next: if not equ_next: ntfy.sendMsg(msg=f"下载数据(不完整,{int(repeat*2)}秒钟后尝试第{repeat}",sleep=int(repeat*2))
sleep_time = int(repeat)*2
time.sleep(sleep_time)
ntfy.sendMsg(f"下载数据(不完整,{sleep_time}秒钟后尝试第{repeat}")
repeat += 1 repeat += 1
return is_next return is_next

View File

@ -414,7 +414,8 @@ class comicInfo():
return save_path return save_path
@classmethod @classmethod
def nextSaveInfoChapter(cls,chapter,data): def nextSaveInfoChapter(cls,chapter,data=None):
if data == None: data = cls.getChapterImgs()
if cls.str_chapter != chapter: if cls.str_chapter != chapter:
print(f"chapter {cls.str_chapter}{chapter} 不一致,已自动跳过") print(f"chapter {cls.str_chapter}{chapter} 不一致,已自动跳过")
cls.setProgress(cls.PROGRESS_INFO) cls.setProgress(cls.PROGRESS_INFO)
@ -468,7 +469,9 @@ class comicInfo():
@classmethod @classmethod
def comicChapterDownload(cls,imgs,names): def comicChapterDownload(cls,imgs,names):
cls.setChapterImgs(imgs)
cls.setChapterListImg(imgs) cls.setChapterListImg(imgs)
cls.setPages(names)
cls.setChapterFilesName(names) cls.setChapterFilesName(names)
@classmethod @classmethod