diff --git a/utils/CBZUtils.py b/utils/CBZUtils.py index 3b3fd73..05190fe 100644 --- a/utils/CBZUtils.py +++ b/utils/CBZUtils.py @@ -1,7 +1,6 @@ import os from pathlib import Path from zipfile import ZipFile -import shutil from utils.comic.ComicInfo import comicInfo class CBZUtils: diff --git a/utils/FileUtils.py b/utils/FileUtils.py deleted file mode 100644 index cee02d0..0000000 --- a/utils/FileUtils.py +++ /dev/null @@ -1,75 +0,0 @@ -import json -import requests,os -from utils.comic.PathStr import pathStr - -class fileUtils: - comic_name = "" - - #文件保存 - @classmethod - def file_save(cls,path,data,mode=None): - result = {} - f = {} - dir_name = os.path.dirname(path) - if not os.path.exists(dir_name): - os.makedirs(dir_name) - save_path = os.path.join(path) - data = json.dumps(data) - if mode == None: - mode = "w+" - try: - f = open(save_path, mode, encoding="utf-8") - f.write(data) - f.close() - print("data=",data) - result = path + "文件写入成功" - except: - result = path + "文件写入失败" - return result - - @classmethod - def save_conf(cls,file, data, mode=None): - file = os.path.join(cls.conf_path,file) - cls.file_save(file,data,mode) - - @classmethod - def save_comic(cls,name, data, mode=None): - print("comic_save=", name) - cls.file_save(cls.get_utl_save_comic(name),data,mode) - - @classmethod - def saveConfComicChapterInfo(cls,chapter,data,comic_name=None,mode=None): - cls.file_save(cls.getPathConfComicChapterInfo(chapter,comic_name), data,mode) - - @classmethod - def getPathConfComicChapterInfo(cls,chapter,comic_name=None): - if comic_name == None: - comic_name = cls.comic_name - return os.path.join(pathStr.base_conf_path,comic_name,"info_"+chapter) - - @classmethod - def getInfoConfComicChapter(cls,chapter,comic_name=None): - data = None - path = cls.getPathConfComicChapterInfo(chapter,comic_name) - with open(path,"r",encoding="utf-8") as fs: - data = json.loads(fs.read()) - return data - - @classmethod - def read_comic(cls,name): - file = os.path.join(cls.comic_path,name) - data = None - try: - with open(file,"r",encoding="utf-8") as fs: - data = json.loads(fs.read()) - except: - print("文件出错了 file=", file) - return data - - ''' - 返回漫画保存路径 - ''' - @classmethod - def get_utl_save_comic(cls,name): - file = os.path.join(pathStr.base_comic_img,name) - return file \ No newline at end of file diff --git a/utils/comic/ComicStr.py b/utils/comic/ComicStr.py deleted file mode 100644 index ef47133..0000000 --- a/utils/comic/ComicStr.py +++ /dev/null @@ -1,28 +0,0 @@ -class comicStr: - url = "url" - xpath = "xpath" - title = "title" - icon = "icon" - author = "author" - dep = "dep" - chapters = "chapters" - homepage = "homepage" - chapter_href = "chapter_href" - list_img = "list_img" - img = "img" - last_update = "last_update" - alias = "alias" - tags = "tags" - action = "action" - chapters_href = "chapters_href" - base_url = "" - data = "data" - result = "result" - - @classmethod - def setBaseUrl(cls,url): - cls.base_url = url - - @classmethod - def getBaseUrl(cls): - return cls.base_url \ No newline at end of file