This commit is contained in:
cwx
2023-04-07 10:26:46 +08:00
parent ab6ea5b476
commit da76a2ce17
4 changed files with 28 additions and 4 deletions
+15 -2
View File
@@ -1,5 +1,5 @@
import base64,hashlib,os,shutil
import math,time,json
import math,time,json,datetime
from PIL import Image
from tinydb import TinyDB, Query
from common.Constant import ComicPath
@@ -155,7 +155,7 @@ class imageUtils:
#10_29.jpg
base_fn = file_str[-1].split("_")
blocks = int(base_fn[0])
save_path = ComicPath.getFileScrambleImageSave(imgpath)
save_path = os.path.join(ComicPath.getDirComicChapter(),ComicPath.getFileScrambleImageSave(imgpath))
# print(type(aid),type(img_name))
if blocks:
s = blocks # 随机值
@@ -195,6 +195,19 @@ class imageUtils:
print("remove=",imgpath)
class fileUtils:
@classmethod
def getModificationDate(cls,file_path):
return os.path.getmtime(file_path)
@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}")
return int(ymd)
@classmethod
def exists(cls,path):
return os.path.exists(path)