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")):
# ciUtils.setProgressFail()
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)
print(f"已删除CBZ, {cbz_path}")
ciUtils.setProgressFail()

View File

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

View File

@ -195,17 +195,19 @@ class imageUtils:
print("remove=",imgpath)
class fileUtils:
@classmethod
def getModificationDate(cls,file_path):
return os.path.getmtime(file_path)
def getModificationDate(cls,file_path,format="%Y%m%d",not_exists=None):
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
def getModificationDateYMD(cls,file_path,not_exists="9999"):
if cls.notExists(file_path): return 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}")
ymd = cls.getModificationDate(file_path,"%Y%m%d",not_exists)
return int(ymd)
@classmethod