fix
This commit is contained in:
1 parent
9d2a49a41b
commit
7ba8e61336
1 file changed
+13
-10
+13
-10
@@ -93,15 +93,7 @@ class CBZUtils:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def replaceZip(cls,filepath,unpack_dir=None):
|
def replaceZip(cls,filepath,unpack_dir=None):
|
||||||
if os.path.exists(filepath):
|
if not cls.compareFileDate(filepath): return None
|
||||||
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 unpack_dir == None:
|
if unpack_dir == None:
|
||||||
unpack_dir = str(filepath).split(".")[0]
|
unpack_dir = str(filepath).split(".")[0]
|
||||||
fz = ZipFile(filepath, 'r')
|
fz = ZipFile(filepath, 'r')
|
||||||
@@ -115,7 +107,7 @@ class CBZUtils:
|
|||||||
if not is_file and os.path.exists(filepath):
|
if not is_file and os.path.exists(filepath):
|
||||||
os.remove(filepath)
|
os.remove(filepath)
|
||||||
print(f"数据不完整,已删除:{filepath}")
|
print(f"数据不完整,已删除:{filepath}")
|
||||||
if is_file and os.path.exists(filepath):
|
if is_file and cls.compareFileDate(filepath):
|
||||||
os.utime(filepath)
|
os.utime(filepath)
|
||||||
print(f"已更新文件时间 {filepath}")
|
print(f"已更新文件时间 {filepath}")
|
||||||
if os.path.exists(unpack_dir):
|
if os.path.exists(unpack_dir):
|
||||||
@@ -127,6 +119,17 @@ class CBZUtils:
|
|||||||
# time.sleep(60)
|
# time.sleep(60)
|
||||||
# shutil.copy(文件的路径,另一个目录);拷贝main.ftl到准备压缩的目录下
|
# shutil.copy(文件的路径,另一个目录);拷贝main.ftl到准备压缩的目录下
|
||||||
#cls.zip_compression()
|
#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:
|
class verUtils:
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Reference in new issue
Block a user