diff --git a/main.py b/main.py index e1c1dd0..c620200 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,5 @@ import os,skip from utils.comic.PathStr import pathStr -from utils.comic.ComicInfo import comicInfo from entity.BaoZi import comicEntity as baoziEntity from entity.RouMan import comicEntity as roumanEntity diff --git a/utils/CBZUtils.py b/utils/CBZUtils.py index 3301f91..a241a6e 100644 --- a/utils/CBZUtils.py +++ b/utils/CBZUtils.py @@ -167,62 +167,4 @@ class CBZUtils: @classmethod def nextCBZ(cls,list_img=None): - return not cls.verCBZComic(list_img=list_img) - - -class verUtils: - @classmethod - def depverNextCBZ(cls,list_img=None): - #验证数据是已存在且是否完整 - if list_img == None: - comicInfo.getChapterImgs() - cbz_path = CBZUtils.getCBZ_Path() - is_next = False - if os.path.exists(cbz_path): - try: - cbz_size = len(CBZUtils.zip_info(cbz_path)) - except: - cbz_size = 0 - if len(list_img) == cbz_size: - ntfy.sendMsg(f"{comicInfo.getComicName()} {comicInfo.getChapter()} 数据完整") - is_next = True - else: - ntfy.sendMsg(f"{comicInfo.getComicName()} {comicInfo.getChapter()} 数据不完整,尝试删除配置CBZ文件后重试") - try: - if cbz_size > len(list_img) or os.path.getsize(cbz_path) < 300000: - ntfy.sendMsg(f"删除 {cbz_path}") - os.remove(cbz_path) - comicInfo.setProgress(comicInfo.PROGRESS_NONE) - else: - is_next = True - except: - ntfy(f"删除失败 {cbz_path}") - return is_next - - @classmethod - def existsUnzipCBZ(cls,filesname): - result = False - unzip_base_path = pathStr.base_unzip_path - zipfile_path = os.path.join(unzip_base_path,comicInfo.str_comic_name,comicInfo.str_chapter+".CBZ") - #判断是否存在已下载CBZ文件 - if os.path.exists(zipfile_path) and not os.path.exists(CBZUtils.getCBZ_Path()): - print(f"存在CBZ文件{zipfile_path},解压中") - zip_file = ZipFile(zipfile_path) - #CBZ中文件数量,剔除ComicInfo.xml - if len(filesname) == len(zip_file.namelist())-1: - unzip_path = comicInfo.getDirComicChapter() - zip_file.extractall(unzip_path) - zip_file.close() - print(f"解压完成: CBZ文件{zipfile_path}") - print(f"文件校验中") - for file in os.listdir(unzip_path): - if file.endswith(".jpg") and not fileUtils.ver_file(os.path.join(unzip_path,file),type="image"): - #清空文件 - try: - shutil.rmtree(unzip_path) - except Exception as e: - print(e) - return False - comicInfo.writeComicInfoXML(overlay=True) - result = True - return result \ No newline at end of file + return not cls.verCBZComic(list_img=list_img) \ No newline at end of file diff --git a/utils/base/BaseComicEntity.py b/utils/base/BaseComicEntity.py index c9b44f5..5550ea6 100644 --- a/utils/base/BaseComicEntity.py +++ b/utils/base/BaseComicEntity.py @@ -3,7 +3,6 @@ from utils.HtmlUtils import htmlUtils from utils.FileUtils import imageUtils from utils.comic.ComicInfo import comicInfo as ci from utils.CBZUtils import CBZUtils -from utils.CBZUtils import verUtils from utils.downloader import download_images from utils.downloader import download_comic_icon from utils.Ntfy import ntfy