This commit is contained in:
cwx
2023-04-06 18:47:34 +08:00
parent 0320cf02fa
commit dc917c2fc6
8 changed files with 50 additions and 39 deletions
+10 -13
View File
@@ -71,7 +71,7 @@ class baseComic:
#不存在完成配置文件 则允许下载
if not ciUtils.isProgressDone():
#if fu.exists(ComicPath.getNewCBZComicChapter("file")): ciUtils.setProgressDone()
cls.comicChapters(href,scramble=True)
cls.comicChapters(href)
cls.count_chapter += 1
#一本漫画下载后等待
#清空文件夹
@@ -85,10 +85,10 @@ class baseComic:
读取某章节下所有图片
'''
@classmethod
def comicChapters(cls,chapter_url,scramble=None):
def comicChapters(cls,chapter_url):
is_next = False
#try:
cls.Onechapter(chapter_url,scramble)
cls.Onechapter(chapter_url)
#进入下个阶段
#章节图片全部下载后,调用下载封面
comic_icon_path = ComicPath.getPathConfComicIcon()
@@ -107,14 +107,14 @@ class baseComic:
#根据章节地址下载全部图片,并将文件名scramble开头的图片进行解密
@classmethod
def Onechapter(cls,chapter_url,scramble=None):
def Onechapter(cls,chapter_url):
is_next = True
if not str(chapter_url).startswith("http"): chapter_url = ci.getBaseUrl() + chapter_url
#下载图片
is_next = cls.comicChapterDownload(chapter_url)
#下载完成后, 开始解密图片
chapter_dir = ComicPath.getDirComicChapter()
if scramble and os.path.exists(chapter_dir): #获取章节图片路径
if os.path.exists(chapter_dir): #获取章节图片路径
dirs = os.listdir(chapter_dir)
for img in dirs:
if img.startswith("scramble="):
@@ -135,16 +135,13 @@ class baseComic:
#保存信息
ci.writeJson()
#验证数据是已存在且是否完整
is_next = CBZUtils.nextCBZ()
is_update_old=CBZUtils.isUpdateOldCBZ()
is_next = CBZUtils.isVerCBZComic()
#不存在ComicInfo.xml则生成
if is_next and fu.notExists(ComicPath.getPathComicInfoXML()): ci.writeComicInfoXML()
if not is_next and not is_update_old:
ComicPath.TIME_SLEEP = 0.5
downloadUtils.queueDownClear()
else:
ComicPath.TIME_SLEEP = random.randint(8,15)
#图标
downloadUtils.putDownImageUrlDirFile(Comic.getIcon(),ComicPath.getDirConfComic(),ComicPath.COMIC_ICON_FILE_NAME)
downloadUtils.start_downloads(timeout=8)
if not is_next:
CBZUtils.isUpdateOldCBZ()
downloadUtils.start_downloads(timeout=8)
if is_next and fu.notExists(ComicPath.getPathComicInfoXML()): ci.writeComicInfoXML()
return is_next
+16 -1
View File
@@ -171,4 +171,19 @@ class ComicPath:
@classmethod
def getPathComicInfoXML(cls,mkdir=True): return cls.setDirImg([Comic.getComicName(),Comic.getChapterName()
,cls.COMIC_INFO_XML],mkdir=mkdir)
,cls.COMIC_INFO_XML],mkdir=mkdir)
#scramble图像路径
@classmethod
def getPathImageScrambleComicChapter(cls,count,block,mkdir=True,suffix="jpg"): return cls.setDirImg([Comic.getComicName(),Comic.getChapterName()
,"scramble="+block+"_"+count],mkdir=mkdir,suffix=suffix)
#
@classmethod
def getPathImageSaveScrambleComicChapter(cls,path,mkdir=True):
count = str(path).split("_")[-1]
return cls.setDirImg([Comic.getComicName(),Comic.getChapterName()
,count],mkdir=mkdir)
@classmethod
def getFileScrambleImageName(cls,count,block,suffix=".jpg"): return "scramble="+str(block)+"_"+str(count)+suffix
@classmethod
def getFileScrambleImageSave(cls,file): return str(file).split("_")[-1]