diff --git a/utils/CBZUtils.py b/utils/CBZUtils.py index 7886eee..a0098a4 100644 --- a/utils/CBZUtils.py +++ b/utils/CBZUtils.py @@ -93,6 +93,12 @@ class CBZUtils: @classmethod def replaceZip(cls,filepath,unpack_dir=None): + ctime = os.path.getctime(filepath) + str_ctime = datetime.fromtimestamp(int(ctime)) + file_ctime = str(str_ctime.year)+"{:0>2d}".format(str_ctime.month)+"{:0>2d}".format(str_ctime.day) + c_ctime = 20230117 + if int(file_ctime) < c_ctime: + return None if unpack_dir == None: unpack_dir = str(filepath).split(".")[0] fz = ZipFile(filepath, 'r') diff --git a/utils/comic/ComicInfo.py b/utils/comic/ComicInfo.py index 82eb34b..eebe684 100644 --- a/utils/comic/ComicInfo.py +++ b/utils/comic/ComicInfo.py @@ -301,15 +301,15 @@ class comicInfo(): return None @classmethod - def getNewCBZComicChapter(cls): - return cls.getNewToComicChapter(".CBZ") + def getNewCBZComicChapter(cls,type): + return cls.getNewToComicChapter(".CBZ", type) @classmethod - def getNewIconComicChapter(cls): - return cls.getNewToComicChapter(".jpg") + def getNewIconComicChapter(cls,type): + return cls.getNewToComicChapter(".jpg", type) @classmethod - def getNewToComicChapter(cls,su): + def getNewToComicChapter(cls,su,type="dir"): c_dir = cls.getDirCBZComicChapter() s_dir = cls.getSortDirCBZComicChapter() c_path = cls.getDirCBZComicChapter()+su @@ -317,6 +317,8 @@ class comicInfo(): if os.path.exists(s_path) and s_path != None: shutil.move(s_path, c_path) print("文件已移动至:", c_path) + if type == "file": + return c_path return c_dir @classmethod diff --git a/utils/entity/BaseComicEntity.py b/utils/entity/BaseComicEntity.py index ff4ffa1..d1a268b 100644 --- a/utils/entity/BaseComicEntity.py +++ b/utils/entity/BaseComicEntity.py @@ -37,7 +37,7 @@ class baseComic: for chapter in chapters: comicInfo.setChapterIndex(chapter_index) comicInfo.setChapterName(chapter) - cbz_path = comicInfo.getNewCBZComicChapter()+".CBZ" + cbz_path = comicInfo.getNewCBZComicChapter("file") comicInfo.getNewIconComicChapter() CBZUtils.replaceZip(cbz_path) chapter_index = chapter_index + 1