diff --git a/utils/base/BaseComicEntity.py b/utils/base/BaseComicEntity.py index 02fde03..fd9eb8b 100644 --- a/utils/base/BaseComicEntity.py +++ b/utils/base/BaseComicEntity.py @@ -23,7 +23,7 @@ class baseComic: if ci.getIsComicNameSkips(book_name): return None if not os.path.exists(ci.getDirConfComic()): ntfy.sendMsg(f"{random.randint(5,20)}秒后开始下载 漫画:{book_name}") else: ntfy.sendMsg(f"已存在 漫画:{book_name}") - if ci.isUpdateComic(): return comic_href + if not ci.isUpdateComic(): return comic_href else: ntfy.sendMsg(f"{book_name} 已是最新") chapters = htmlUtils.xpathData('//div[contains(@class,"bookid_chapterBox")]//div[contains(@class,"bookid_chapter")]/a/text()',url=comic_href,update=False) diff --git a/utils/comic/ComicInfo.py b/utils/comic/ComicInfo.py index b0be8b9..f763064 100644 --- a/utils/comic/ComicInfo.py +++ b/utils/comic/ComicInfo.py @@ -420,44 +420,14 @@ class comicInfo(): @classmethod def updateComicDate(cls,date=None): - data = {} update_at = cls.str_update_at if date != None: update_at = date - comic_name = cls.str_comic_name - update_path = pathStr.base_comic_update() - update_dir = os.path.dirname(update_path) - if not os.path.exists(update_dir): - os.makedirs(update_dir) - if os.path.exists(update_path): - with open(update_path,"r") as fs: - data = json.loads(fs.read()) - fs.close() - data[comic_name] = update_at - with open(update_path,"w") as fs: - fs.write(json.dumps(data)) - fs.close() - + dbUtils.setComic(cls.str_comic_name, update_at, "update") + @classmethod def isUpdateComic(cls): - is_update = True - data = {} - c_update_at = cls.str_update_at - comic_name = cls.str_comic_name - update_path = pathStr.base_comic_update() - update_dir = os.path.dirname(update_path) - if not os.path.exists(update_dir): - os.makedirs(update_dir) - try: - with open(update_path,"r") as fs: - data = json.loads(fs.read()) - fs.close() - except: - data = {} - comic_update = data.get(comic_name) - if comic_name != None and comic_update == c_update_at: - is_update = False - return is_update + return dbUtils.query(cls.str_comic_name, cls.str_update_at,"update") @classmethod def comicChapterDownload(cls,imgs,names):