fix
This commit is contained in:
1 parent
a8f44ec334
commit
6ca7ce1992
11 files changed
+205
-141
No files matched your search
+16
-13
@@ -91,7 +91,13 @@ class baseComic:
|
||||
cls.Onechapter(chapter_url,scramble)
|
||||
#进入下个阶段
|
||||
#章节图片全部下载后,调用下载封面
|
||||
if ciUtils.isProgressDown: downloadUtils.download_comic_icon()
|
||||
comic_icon_path = ComicPath.getPathConfComicIcon()
|
||||
chapter_icon_path = ComicPath.getPathCBZComicChapterIcon()
|
||||
if ciUtils.isProgressDown and os.path.exists(comic_icon_path) and not os.path.exists(chapter_icon_path):
|
||||
shutil.copy(comic_icon_path,chapter_icon_path)
|
||||
ntfy.sendMsg(f"复制成功:{comic_icon_path} -> {chapter_icon_path}")
|
||||
ciUtils.iconDB()
|
||||
ciUtils.setProgressCBZ()
|
||||
#下个阶段
|
||||
if ciUtils.isProgressCBZ: is_next = CBZUtils.packAutoComicChapterCBZ()
|
||||
#except Exception as e: is_next = ntfy.sendMsg(f"{ci.getComicName()} 下载出错了",error=e)
|
||||
@@ -126,22 +132,19 @@ class baseComic:
|
||||
except:
|
||||
htmlUtils.remove_HtmlCache(url)
|
||||
cls.comicChapterDownload(url)
|
||||
|
||||
(list_img,files_name) = [Comic.getChapterImgs(),Comic.file_chapter_imgs]
|
||||
#保存信息
|
||||
ci.writeJson()
|
||||
ci.writeJson()
|
||||
#验证数据是已存在且是否完整
|
||||
is_next = CBZUtils.nextCBZ()
|
||||
is_old=CBZUtils.updateOldCBZ(files_name)
|
||||
is_old=CBZUtils.updateOldCBZ()
|
||||
#不存在ComicInfo.xml则生成
|
||||
if is_next and fu.notExists(ComicPath.getPathComicInfoXML()): ci.writeComicInfoXML()
|
||||
if is_next and not is_old:
|
||||
ComicPath.TIME_SLEEP = random.randint(8,15)
|
||||
downloadUtils.download_images(list_img,ComicPath.getDirComicChapter(),files_name=files_name,concurrency=5,timeout=10)
|
||||
# ntfy.sendMsg("等待数据检验中...",sleep=0.5)
|
||||
is_next = fu.equImages(ComicPath.getDirComicChapter(),list_img)
|
||||
# if not is_next: ntfy.sendMsg(msg=f"下载数据(不完整,{int(repeat*2)}秒钟后尝试第{repeat}次",sleep=int(repeat*2))
|
||||
# repeat += 1
|
||||
else:
|
||||
if not is_next and is_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()
|
||||
return is_next
|
||||
+21
-21
@@ -5,30 +5,30 @@ from utils.OldUtils import OldUtils
|
||||
|
||||
class Comic:
|
||||
# ComicInfo.xml and ComicChapter.json bengin
|
||||
# value origin node dep
|
||||
dict_chapter = [None,None,"Title","章节名"]
|
||||
dict_comic_name = [None,None,"Series","漫画名"]
|
||||
dict_number = [None,None,"Number","编号"]
|
||||
dict_comic_names = [None,None,"SeriesGroup","别名"]
|
||||
dict_dep = [None,None,"Summary","概述"]
|
||||
dict_year = [None,None,"Year","年"]
|
||||
dict_month = [None,None,"Month","月"]
|
||||
dict_day = [None,None,"Day","日"]
|
||||
dict_author = [None,None,"Writer","作者"]
|
||||
dict_cbs = [None,None,"Publisher","出版社"]
|
||||
dict_genre = [None,None,"Genre","流派"]
|
||||
dict_tags = [None,None,"Tags","标签"]
|
||||
dict_homepage = [None,None,"Web","主页"]
|
||||
dict_page_count = [None,None,"PageCount","总页数"]
|
||||
dict_language = [None,None,"LanguageISO","语言"]
|
||||
dict_agerating = [None,None,"AgeRating","年龄分级"]
|
||||
dict_pages = [None,None,"Pages","页码"]
|
||||
# value origin node dep required
|
||||
dict_chapter = [None,None,"Title","章节名",True]
|
||||
dict_comic_name = [None,None,"Series","漫画名",True]
|
||||
dict_number = [None,None,"Number","编号",True]
|
||||
dict_comic_names = [None,None,"SeriesGroup","别名",False]
|
||||
dict_dep = [None,None,"Summary","概述",True]
|
||||
dict_year = [None,None,"Year","年",False]
|
||||
dict_month = [None,None,"Month","月",False]
|
||||
dict_day = [None,None,"Day","日",False]
|
||||
dict_author = [None,None,"Writer","作者",True]
|
||||
dict_cbs = [None,None,"Publisher","出版社",False]
|
||||
dict_genre = [None,None,"Genre","流派",True]
|
||||
dict_tags = [None,None,"Tags","标签",True]
|
||||
dict_homepage = [None,None,"Web","主页",False]
|
||||
dict_page_count = [None,None,"PageCount","总页数",True]
|
||||
dict_language = [None,None,"LanguageISO","语言",True]
|
||||
dict_agerating = [None,None,"AgeRating","年龄分级",False]
|
||||
dict_pages = [None,None,"Pages","页码",True]
|
||||
CURRENT_DOWN_LINK = None
|
||||
# ComicInfo.xml and ComicChapter.json end
|
||||
dict_icon = [None,None,"Icon","图标"]
|
||||
dict_chapter_imgs = [None,None,"ChapterImgs","图像"]
|
||||
dict_icon = [None,None,"Icon","图标",True]
|
||||
dict_chapter_imgs = [None,None,"ChapterImgs","图像",True]
|
||||
#主页
|
||||
dict_list_chapter = [None,None,"ListChapter","全部章节名"]
|
||||
dict_list_chapter = [None,None,"ListChapter","全部章节名",True]
|
||||
(update_at,current_chapter_img,file_chapter_imgs) = [None,None,None]
|
||||
|
||||
|
||||
|
||||
+17
-4
@@ -3,6 +3,7 @@ from xml.dom.minidom import Document
|
||||
from utils.FileUtils import dbUtils as db
|
||||
from common.Comic import Comic
|
||||
from common.Constant import ComicPath
|
||||
from utils.Logger import logger
|
||||
|
||||
class ComicInfoEntity:
|
||||
@classmethod
|
||||
@@ -48,7 +49,8 @@ class ComicInfo:
|
||||
|
||||
#页数
|
||||
@classmethod
|
||||
def setPages(cls,values):
|
||||
def setPages(cls,values=None):
|
||||
if values == None: values = Comic.getChapterFilesName()
|
||||
if values != None and isinstance(values,list):
|
||||
suffix = "."+str(values[0]).split(".")[-1]
|
||||
join_list=",".join(values).replace(suffix,"")
|
||||
@@ -86,10 +88,20 @@ class ComicInfo:
|
||||
if len(list_value) == 0: return list_value
|
||||
for value in list_value:
|
||||
#Comic.chapter
|
||||
if value[0] == None and value[4]:
|
||||
#数据为空 value[0], 但不允许为空value[4] = False
|
||||
msg = f"#数据为空 key={value[3]} value[0]={value[0]}, 但不允许为空value[4]={value[4]}"
|
||||
logger.error(msg)
|
||||
exit()
|
||||
if value[0] != None: root.appendChild(cls.setNodeAndValue(value[2],value[0]))
|
||||
|
||||
|
||||
@classmethod
|
||||
def initComicInfoXML(cls):
|
||||
cls.setPages()
|
||||
|
||||
@classmethod
|
||||
def writeComicInfoXML(cls,overlay=False):
|
||||
cls.initComicInfoXML()
|
||||
root = cls.root_node("ComicInfo")
|
||||
new_document = Document()
|
||||
new_document.appendChild(root)
|
||||
@@ -98,7 +110,7 @@ class ComicInfo:
|
||||
with open(save_path, "w", encoding="utf-8") as fo:
|
||||
new_document.writexml(fo, indent='', addindent='\t', newl='\n', encoding="utf-8")
|
||||
fo.close()
|
||||
print(f"已生成文件... {save_path}")
|
||||
logger.info(f"已生成文件... {save_path}")
|
||||
|
||||
@classmethod
|
||||
def setComicInfo(cls,comicname=None,homepage=None,alias=None,author=None,icon=None,tags=None,
|
||||
@@ -131,7 +143,8 @@ class ComicInfo:
|
||||
if key != None and isinstance(value,str):
|
||||
child_dict = { key : value}
|
||||
dict_data.update(child_dict)
|
||||
s = json.dumps(dict_data,ensure_ascii=False)
|
||||
s = json.dumps(dict_data,ensure_ascii=True)
|
||||
logger.info(f"json={s}")
|
||||
with open(ComicPath.getPathConfComicChapterJson(mkdir=True),"w") as fs:
|
||||
fs.write(s)
|
||||
|
||||
|
||||
+4
-2
@@ -76,6 +76,8 @@ class pathStr:
|
||||
|
||||
class ComicPath:
|
||||
COMIC_ICON_NAME = "000"
|
||||
COMIC_ICON_SUFFIX = "jpg"
|
||||
COMIC_ICON_FILE_NAME = COMIC_ICON_NAME+"."+COMIC_ICON_SUFFIX
|
||||
DEFAULT_PATH = "default"
|
||||
PROGRESS_PATH = "progress"
|
||||
ICONS_PATH = "icons"
|
||||
@@ -115,7 +117,7 @@ class ComicPath:
|
||||
def getPathConfComicChapterJson(cls,mkdir=True): return cls.setDirConf([Comic.getOriginComicName(),Comic.getOriginChapterName()],suffix="json",mkdir=mkdir)
|
||||
#漫画Icon路径
|
||||
@classmethod
|
||||
def getPathConfComicIcon(cls,mkdir=True,suffix="jpg"): return cls.setDirConf([Comic.getOriginComicName(),cls.COMIC_ICON_NAME],suffix=suffix,mkdir=mkdir)
|
||||
def getPathConfComicIcon(cls,mkdir=True): return cls.setDirConf([Comic.getOriginComicName(),cls.COMIC_ICON_NAME],suffix=cls.COMIC_ICON_SUFFIX,mkdir=mkdir)
|
||||
#Icons json文件路径
|
||||
@classmethod
|
||||
def getDirConfDefault(cls,path=None,suffix=None,mkdir=True): return cls.setDirConf([cls.DEFAULT_PATH,path],suffix=suffix,mkdir=mkdir)
|
||||
@@ -130,7 +132,7 @@ class ComicPath:
|
||||
def getDirCBZComicChapter(cls,suffix=None): return cls.setDirCBZ([Comic.getComicName(),Comic.getChapterName()],suffix=suffix)
|
||||
#漫画章节CBZ同根下封面
|
||||
@classmethod
|
||||
def getPathCBZComicChapterIcon(cls,suffix="jpg"): return cls.setDirCBZ([Comic.getComicName(),Comic.getChapterName()],suffix=suffix)
|
||||
def getPathCBZComicChapterIcon(cls,suffix="jpg",mkdir=True): return cls.setDirCBZ([Comic.getComicName(),Comic.getChapterName()],suffix=suffix,mkdir=mkdir)
|
||||
#旧版本漫画章节CBZ路径
|
||||
@classmethod
|
||||
def getPathOldCBZComicChapter(cls): return cls.setDirOld([Comic.getOriginComicName(),Comic.getOriginChapterName()],suffix="CBZ")
|
||||
|
||||
Reference in new issue
Block a user