This commit is contained in:
cwx
2022-12-13 06:36:57 +08:00
6 changed files with 29 additions and 14 deletions
+10 -6
View File
@@ -5,6 +5,7 @@ from utils.ImageUtils import imageUtils
from utils.comic.ComicInfo import comicInfo
from utils.CBZUtils import CBZUtils
from utils.downloader import download_images
from utils.Ntfy import ntfy
class comicEntity:
@@ -29,13 +30,15 @@ class comicEntity:
book_name = book.get("name")
updatedAt = book.get("updatedAt")
comicHref = baseUrl+"/books/"+book_id
random_int = random.uniform(5,20)
random_int = random.randint(5,20)
comicInfo.setComicName(book_name)
dirConfComic = comicInfo.getDirConfComic()
if not os.path.exists(dirConfComic):
print(f"{random_int}秒后开始下载 漫画:{book_name}")
ntfy.sendMsg(f"{random_int}秒后开始下载 漫画:{book_name}")
time.sleep(random_int)
cls.oneComic(comicHref, random.uniform(0,3))
else:
ntfy.sendMsg(f"已存在 漫画:{book_name}")
cls.oneComic(comicHref, random.uniform(0,3))
print(books)
#for comicHref in comicsHref:
@@ -76,7 +79,7 @@ class comicEntity:
chapter = chapters[count_chapter]
comicInfo.setChapterName(chapter)
if not comicInfo.nextExistsGetPath("done_"):
comicEntity.comicChapter(href,scramble=True,sleep=random.uniform(15,25))
comicEntity.comicChapter(href,scramble=True,sleep=random.randint(15,25))
count_chapter += 1
#一本漫画下载后等待
#清空文件夹
@@ -113,7 +116,7 @@ class comicEntity:
shutil.rmtree(dirComicChapter)
cls.comicChapter(chapter_url,scramble,sleep)
if not sleep == None:
print(f"{sleep} 秒后开始下载下一个章节")
ntfy.sendMsg(f"{sleep} 秒后开始下载下一个章节")
time.sleep(sleep)
@classmethod
@@ -149,6 +152,7 @@ class comicEntity:
description = x.get("description")
images = x.get("images")
chapterAPIPath = x.get("chapterAPIPath")
ntfy.sendMsg(f"{bookName} {chapterName} 下载中")
comicInfo.setComicName(bookName)
comicInfo.setChapterName(chapterName)
comicInfo.setDep(description)
@@ -165,7 +169,7 @@ class comicEntity:
chapterName = data.get("name")
images = data.get("images")
if images == None:
print(f"未获取到章节图像 comic_name={bookName} chapter={chapterName}")
ntfy.sendMsg(f"未获取到章节图像 comic_name={bookName} chapter={chapterName}")
totalChapter = x.get("totalChapter")
tags = x.get("tags")
x = tags