This commit is contained in:
caiwx86 2022-12-18 13:00:00 +08:00
parent d1ca41de63
commit 831604101a

View File

@ -8,6 +8,8 @@ from utils.downloader import download_images
from utils.Ntfy import ntfy from utils.Ntfy import ntfy
class comicEntity: class comicEntity:
count_chapter = 0
@classmethod @classmethod
def baseComicData(cls,url): def baseComicData(cls,url):
@ -75,15 +77,13 @@ class comicEntity:
comicInfo.setListChapter(chapters) comicInfo.setListChapter(chapters)
#comicUtils.setComic(title,alias,icon,author,tags,action,dep,update_date,chapters,chapter_href) #comicUtils.setComic(title,alias,icon,author,tags,action,dep,update_date,chapters,chapter_href)
count_chapter = 0 cls.count_chapter = 0
for href in chapter_href: for href in chapter_href:
chapter = chapters[count_chapter] chapter = chapters[count_chapter]
comicInfo.setChapterName(chapter) comicInfo.setChapterName(chapter)
if not comicInfo.nextExistsGetPath("done_"): if not comicInfo.nextExistsGetPath("done_"):
comicEntity.comicChapter(href,scramble=True,sleep=random.randint(15,25)) comicEntity.comicChapter(href,scramble=True,sleep=random.randint(15,25))
count_chapter += 1 cls.count_chapter += 1
lenChapters = comicInfo.getLenChapters()
ntfy.sendMsg(f"预计总章节大小:{count_chapter} / {lenChapters}")
#一本漫画下载后等待 #一本漫画下载后等待
#清空文件夹 #清空文件夹
pathDirComic = comicInfo.getDirComic() pathDirComic = comicInfo.getDirComic()
@ -115,10 +115,11 @@ class comicEntity:
print(f"文件已删除: {remove_path}") print(f"文件已删除: {remove_path}")
except: except:
dirComicChapter = str(comicInfo.getDirComicChapter) dirComicChapter = str(comicInfo.getDirComicChapter)
if not dirComicChapter == None and os.path.exists(dirComicChapter): if dirComicChapter != None and os.path.exists(dirComicChapter):
shutil.rmtree(dirComicChapter) shutil.rmtree(dirComicChapter)
cls.comicChapter(chapter_url,scramble,sleep) cls.comicChapter(chapter_url,scramble,sleep)
if not sleep == None: if sleep != None:
ntfy.sendMsg(f"预计总章节大小:{cls.count_chapter} / "+ comicInfo.getLenChapters())
ntfy.sendMsg(f"{sleep} 秒后开始下载下一个章节") ntfy.sendMsg(f"{sleep} 秒后开始下载下一个章节")
time.sleep(sleep) time.sleep(sleep)