Merge branch 'main' of https://git.caiwenxiu.cn/cwx/PyComicPackRouMan
This commit is contained in:
parent
50b0fc8119
commit
3d00520c14
@ -92,3 +92,9 @@ class netUtils:
|
|||||||
shutil.copy(pathComicIcon, save_path)
|
shutil.copy(pathComicIcon, save_path)
|
||||||
print(f"{pathComicIcon} 已复制至: {save_path}")
|
print(f"{pathComicIcon} 已复制至: {save_path}")
|
||||||
comicInfo.nextDownloadToCBZChapter()
|
comicInfo.nextDownloadToCBZChapter()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def sendMsg(cls, msg):
|
||||||
|
print(f"#ntfy: {msg}")
|
||||||
|
requests.post("https://ntfy.caiwenxiu.cn/PyComic",
|
||||||
|
data=msg.encode(encoding='utf-8'))
|
||||||
@ -29,13 +29,13 @@ class comicEntity:
|
|||||||
book_name = book.get("name")
|
book_name = book.get("name")
|
||||||
updatedAt = book.get("updatedAt")
|
updatedAt = book.get("updatedAt")
|
||||||
comicHref = baseUrl+"/books/"+book_id
|
comicHref = baseUrl+"/books/"+book_id
|
||||||
random_int = random.uniform(5,20)
|
random_int = random.randint(5,20)
|
||||||
comicInfo.setComicName(book_name)
|
comicInfo.setComicName(book_name)
|
||||||
dirConfComic = comicInfo.getDirConfComic()
|
#dirConfComic = comicInfo.getDirConfComic()
|
||||||
if not os.path.exists(dirConfComic):
|
#if not os.path.exists(dirConfComic):
|
||||||
print(f"{random_int}秒后开始下载 漫画:{book_name}")
|
netUtils.sendMsg(f"{random_int}秒后开始下载 漫画:{book_name}")
|
||||||
time.sleep(random_int)
|
time.sleep(random_int)
|
||||||
cls.oneComic(comicHref, random.uniform(0,3))
|
cls.oneComic(comicHref, random.uniform(0,3))
|
||||||
|
|
||||||
print(books)
|
print(books)
|
||||||
#for comicHref in comicsHref:
|
#for comicHref in comicsHref:
|
||||||
@ -76,7 +76,7 @@ class comicEntity:
|
|||||||
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.uniform(15,25))
|
comicEntity.comicChapter(href,scramble=True,sleep=random.randint(15,25))
|
||||||
count_chapter += 1
|
count_chapter += 1
|
||||||
#一本漫画下载后等待
|
#一本漫画下载后等待
|
||||||
#清空文件夹
|
#清空文件夹
|
||||||
@ -106,14 +106,14 @@ class comicEntity:
|
|||||||
#完成删除原文件
|
#完成删除原文件
|
||||||
remove_path = comicInfo.getDirComicChapter()
|
remove_path = comicInfo.getDirComicChapter()
|
||||||
shutil.rmtree(remove_path)
|
shutil.rmtree(remove_path)
|
||||||
print(f"文件已删除: {remove_path}")
|
netUtils.sendMsg(f"文件已删除: {remove_path}")
|
||||||
except:
|
except:
|
||||||
dirComicChapter = comicInfo.getDirComicChapter
|
dirComicChapter = comicInfo.getDirComicChapter
|
||||||
if not dirComicChapter == None and os.path.exists(dirComicChapter):
|
if not 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 not sleep == None:
|
||||||
print(f"{sleep} 秒后开始下载下一个章节")
|
netUtils.sendMsg(f"{sleep} 秒后开始下载下一个章节")
|
||||||
time.sleep(sleep)
|
time.sleep(sleep)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -149,6 +149,7 @@ class comicEntity:
|
|||||||
description = x.get("description")
|
description = x.get("description")
|
||||||
images = x.get("images")
|
images = x.get("images")
|
||||||
chapterAPIPath = x.get("chapterAPIPath")
|
chapterAPIPath = x.get("chapterAPIPath")
|
||||||
|
netUtils.sendMsg(f"{bookName} {chapterName} 下载中")
|
||||||
comicInfo.setComicName(bookName)
|
comicInfo.setComicName(bookName)
|
||||||
comicInfo.setChapterName(chapterName)
|
comicInfo.setChapterName(chapterName)
|
||||||
comicInfo.setDep(description)
|
comicInfo.setDep(description)
|
||||||
@ -165,7 +166,7 @@ class comicEntity:
|
|||||||
chapterName = data.get("name")
|
chapterName = data.get("name")
|
||||||
images = data.get("images")
|
images = data.get("images")
|
||||||
if images == None:
|
if images == None:
|
||||||
print(f"未获取到章节图像 comic_name={bookName} chapter={chapterName}")
|
netUtils.sendMsg(f"未获取到章节图像 comic_name={bookName} chapter={chapterName}")
|
||||||
totalChapter = x.get("totalChapter")
|
totalChapter = x.get("totalChapter")
|
||||||
tags = x.get("tags")
|
tags = x.get("tags")
|
||||||
x = tags
|
x = tags
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user