diff --git a/entity/RouMan.py b/entity/RouMan.py index 1750dfc..1c2822b 100644 --- a/entity/RouMan.py +++ b/entity/RouMan.py @@ -27,7 +27,7 @@ class comicEntity: #漫画名 title = htmlUtils.xpathData('//div[@class="col"]/h5/text()',url=c_url,num=0) #别名 - alias = htmlUtils.xpathData('//span[contains(@class,"bookid_alias")]/text()',num=1) + #alias = htmlUtils.xpathData('//span[contains(@class,"bookid_alias")]/text()',num=1) icon = htmlUtils.xpathData('//img[@class="img-thumbnail"]/@src',num=0) author = htmlUtils.xpathData('//div[contains(@class,"bookid_bookInfo")]/p[1]/text()',num=1) tags = htmlUtils.xpathData('//div[contains(@class,"bookid_bookInfo")]/p[3]/b/text()',num=0) @@ -39,5 +39,5 @@ class comicEntity: baseComic.oneComic(url=c_url,title=title,author=author, icon=icon,tags=tags,dep=dep,chapters=chapters,chapter_href=chapter_href, - alias=alias,genre="韩漫",age_rating="R18+") + genre="韩漫",age_rating="R18+") comicInfo.updateComicDate(date=date) \ No newline at end of file diff --git a/utils/CBZUtils.py b/utils/CBZUtils.py index 9c64f4f..7c71b4f 100644 --- a/utils/CBZUtils.py +++ b/utils/CBZUtils.py @@ -7,6 +7,7 @@ from utils.comic.ComicInfo import comicInfo from utils.Ntfy import ntfy from utils.FileUtils import fileUtils as fu from utils.comic.PathStr import pathStr +from utils.OldUtils import OldUtils class CBZUtils: @@ -135,7 +136,7 @@ class CBZUtils: @classmethod def updateOldCBZ(cls,filesname,result=False): - old_zipfile_path = os.path.join(pathStr.old_cbz_path,comicInfo.str_comic_name,comicInfo.str_chapter+".CBZ") + old_zipfile_path = os.path.join(pathStr.old_cbz_path,OldUtils.getOldComicName(),OldUtils.getOldChapter()+".CBZ") #判断是否存在已下载CBZ文件 if fu.exists(old_zipfile_path) and fu.notExists(CBZUtils.getCBZ_Path()): print(f"存在CBZ文件{old_zipfile_path},解压中...") diff --git a/utils/ComicUtils.py b/utils/ComicUtils.py new file mode 100644 index 0000000..28ce93c --- /dev/null +++ b/utils/ComicUtils.py @@ -0,0 +1,6 @@ +from opencc import OpenCC + +class fontUtils: + @classmethod + def ChineseConvert(cls, text,convert='t2s'): + return OpenCC(convert).convert(text) # convert from Simplified Chinese to Traditional Chinese \ No newline at end of file diff --git a/utils/OldUtils.py b/utils/OldUtils.py new file mode 100644 index 0000000..5bc9938 --- /dev/null +++ b/utils/OldUtils.py @@ -0,0 +1,16 @@ + +class OldUtils: + old_comic_name=None + old_chapter = None + + @classmethod + def setOldComicName(cls,value): cls.old_comic_name = value + + @classmethod + def setOldChapter(cls,value): cls.old_chapter=value + + @classmethod + def getOldComicName(cls): return cls.old_comic_name + + @classmethod + def getOldChapter(cls): return cls.old_chapter \ No newline at end of file diff --git a/utils/base/BaseComicEntity.py b/utils/base/BaseComicEntity.py index ca59483..b487a15 100644 --- a/utils/base/BaseComicEntity.py +++ b/utils/base/BaseComicEntity.py @@ -45,8 +45,7 @@ class baseComic: @classmethod def oneComic(cls,url,title,author,icon,tags,dep,chapters,chapter_href,alias=None,genre=None,lang="zh",age_rating=None,sleep=None): - ci.setComicInfo(homepage=url,comicname=title,alias=ci.setComicNames(title+","+alias), - author=author,icon=icon,tags=tags,dep=dep,genre=genre,lang=lang,age_rating=age_rating,chapters=chapters) + ci.setComicInfo(homepage=url,comicname=title,author=author,icon=icon,tags=tags,dep=dep,genre=genre,lang=lang,age_rating=age_rating,chapters=chapters) cls.count_chapter = 0 for href in chapter_href: ci.setChapterName(chapters[cls.count_chapter]) diff --git a/utils/comic/ComicInfo.py b/utils/comic/ComicInfo.py index 5a5746f..044222e 100644 --- a/utils/comic/ComicInfo.py +++ b/utils/comic/ComicInfo.py @@ -3,6 +3,8 @@ import os,re from utils.comic.PathStr import pathStr import json,shutil from utils.FileUtils import dbUtils +from utils.ComicUtils import fontUtils +from utils.OldUtils import OldUtils class comicInfo(): COMIC_ICON_NAME = "000" @@ -77,7 +79,7 @@ class comicInfo(): def setNodeAndValue(cls,node,value): if value != None: c_node = cls.document.createElement(node) - node_text = cls.document.createTextNode(str(value).replace("\n","")) + node_text = cls.document.createTextNode(fontUtils.ChineseConvert(str(value).replace("\n",""))) c_node.appendChild(node_text) return c_node return None @@ -87,7 +89,8 @@ class comicInfo(): @classmethod def setChapterName(cls,value): - cls.str_chapter = cls.fixFileName(value) + cls.str_chapter = fontUtils.ChineseConvert(cls.fixFileName(value)) + OldUtils.setOldChapter(cls.fixFileName(value)) cls.chapter_node = cls.setNodeAndValue(cls.chapter,value) @classmethod @@ -110,13 +113,14 @@ class comicInfo(): def getLenChapters(cls): return len(cls.str_list_chapter) @classmethod def setComicName(cls,value): - cls.str_comic_name = cls.fixFileName(value) + cls.str_comic_name = fontUtils.ChineseConvert(cls.fixFileName(value)) + OldUtils.setOldComicName(cls.fixFileName(value)) cls.comic_name_node = cls.setNodeAndValue(cls.comic_name, value) @classmethod def setComicNames(cls,value): #去重 - value = ",".join(set(str(value).split(","))) + value = ",".join(set(str(fontUtils.ChineseConvert(value)).split(","))) cls.comic_names_node = cls.setNodeAndValue(cls.comic_names,value) @classmethod def setDep(cls,value): cls.dep_node = cls.setNodeAndValue(cls.dep, value)