This commit is contained in:
caiwx86 2023-01-16 02:55:35 +08:00
parent 193d2d904b
commit 1b538bacea
3 changed files with 14 additions and 6 deletions

View File

@ -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')

View File

@ -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

View File

@ -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