fix
This commit is contained in:
parent
9d2a49a41b
commit
7ba8e61336
@ -93,15 +93,7 @@ class CBZUtils:
|
||||
|
||||
@classmethod
|
||||
def replaceZip(cls,filepath,unpack_dir=None):
|
||||
if os.path.exists(filepath):
|
||||
ctime = os.path.getmtime(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)+"{:0>2d}".format(str_ctime.hour)
|
||||
c_ctime = 2023011603
|
||||
if int(file_ctime) > c_ctime:
|
||||
return None
|
||||
else:
|
||||
return None
|
||||
if not cls.compareFileDate(filepath): return None
|
||||
if unpack_dir == None:
|
||||
unpack_dir = str(filepath).split(".")[0]
|
||||
fz = ZipFile(filepath, 'r')
|
||||
@ -115,7 +107,7 @@ class CBZUtils:
|
||||
if not is_file and os.path.exists(filepath):
|
||||
os.remove(filepath)
|
||||
print(f"数据不完整,已删除:{filepath}")
|
||||
if is_file and os.path.exists(filepath):
|
||||
if is_file and cls.compareFileDate(filepath):
|
||||
os.utime(filepath)
|
||||
print(f"已更新文件时间 {filepath}")
|
||||
if os.path.exists(unpack_dir):
|
||||
@ -127,6 +119,17 @@ class CBZUtils:
|
||||
# time.sleep(60)
|
||||
# shutil.copy(文件的路径,另一个目录);拷贝main.ftl到准备压缩的目录下
|
||||
#cls.zip_compression()
|
||||
#小于则运行
|
||||
@classmethod
|
||||
def compareFileDate(cls,filepath):
|
||||
if os.path.exists(filepath):
|
||||
ctime = os.path.getmtime(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)+"{:0>2d}".format(str_ctime.hour)
|
||||
c_ctime = 2023011603
|
||||
if int(file_ctime) > c_ctime:
|
||||
return False
|
||||
return True
|
||||
|
||||
class verUtils:
|
||||
@classmethod
|
||||
|
||||
Loading…
Reference in New Issue
Block a user