This commit is contained in:
caiwx86 2023-04-07 10:35:25 +08:00
parent da76a2ce17
commit 83142498b3
3 changed files with 13 additions and 12 deletions

View File

@ -70,7 +70,8 @@ class baseComic:
#if ciUtils.isProgressDone() and fu.notExists(ComicPath.getNewCBZComicChapter("file")): #if ciUtils.isProgressDone() and fu.notExists(ComicPath.getNewCBZComicChapter("file")):
# ciUtils.setProgressFail() # ciUtils.setProgressFail()
cbz_path = ComicPath.getPathCBZComicChapter() cbz_path = ComicPath.getPathCBZComicChapter()
if fileUtils.getModificationDateYMD(cbz_path,not_exists="20101010") > 20230405: file_date = int(fileUtils.getModificationDate(cbz_path,"%Y%m%d%H",not_exists="2010010101"))
if file_date > 2023040610 and file_date < 2023040710:
os.remove(cbz_path) os.remove(cbz_path)
print(f"已删除CBZ, {cbz_path}") print(f"已删除CBZ, {cbz_path}")
ciUtils.setProgressFail() ciUtils.setProgressFail()

View File

@ -19,7 +19,5 @@ def proxy():
os.environ["https_proxy"] = "http://127.0.0.1:7890" os.environ["https_proxy"] = "http://127.0.0.1:7890"
if __name__ == '__main__': if __name__ == '__main__':
# rouman() rouman()
# baozi() # baozi()
result = fileUtils.getModificationDateYMD("D:\mnt\Comics\RM\CBZ\把妹鬼达人\第1话-色鬼授予的爱爱超能力.CBZ")
print(result)

View File

@ -195,17 +195,19 @@ class imageUtils:
print("remove=",imgpath) print("remove=",imgpath)
class fileUtils: class fileUtils:
@classmethod @classmethod
def getModificationDate(cls,file_path): def getModificationDate(cls,file_path,format="%Y%m%d",not_exists=None):
return os.path.getmtime(file_path) if cls.notExists(file_path): return not_exists
file_date = os.path.getmtime(file_path)
s = time.localtime(file_date)
format_date = time.strftime(format,s)
print(f"file={file_path} {format_date}")
return format_date
@classmethod @classmethod
def getModificationDateYMD(cls,file_path,not_exists="9999"): def getModificationDateYMD(cls,file_path,not_exists="9999"):
if cls.notExists(file_path): return not_exists ymd = cls.getModificationDate(file_path,"%Y%m%d",not_exists)
file_date = cls.getModificationDate(file_path)
s = time.localtime(file_date)
ymd = time.strftime("%Y%m%d",s)
print(f"file={file_path} {ymd}")
return int(ymd) return int(ymd)
@classmethod @classmethod