下载坐标文件前先进行本地和云端文件进行比较
This commit is contained in:
1 parent
bf7950502c
commit
eed0ffa2fc
1 file changed
+6
-3
+6
-3
@@ -35,6 +35,7 @@ def down_xmps_from_oss(psid,pid = ""):
|
|||||||
#在有pid 的情况下判断是否要从云端下载影棚坐标文件
|
#在有pid 的情况下判断是否要从云端下载影棚坐标文件
|
||||||
if pid != "":
|
if pid != "":
|
||||||
if local_and_remote_file_time(psid,pid) == "local_file_best_new":
|
if local_and_remote_file_time(psid,pid) == "local_file_best_new":
|
||||||
|
print("本地的文件最新,不需要下载云端影棚坐标文件")
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
if not need_down(): return
|
if not need_down(): return
|
||||||
@@ -81,12 +82,14 @@ def local_and_remote_file_time(psid,pid):
|
|||||||
if os.path.exists(localfile):
|
if os.path.exists(localfile):
|
||||||
remotefile_last_modified = os.path.getmtime(remotefile)
|
remotefile_last_modified = os.path.getmtime(remotefile)
|
||||||
localfile_last_modified = os.path.getmtime(localfile)
|
localfile_last_modified = os.path.getmtime(localfile)
|
||||||
if remotefile_last_modified <= localfile_last_modified:
|
print(f'本地文件的时间{localfile_last_modified}, 远程文件的时间{remotefile_last_modified}')
|
||||||
|
#比较两个文件的时间
|
||||||
|
if float(remotefile_last_modified) < float(localfile_last_modified):
|
||||||
print(f'本地{localfile}文件已是最新,')
|
print(f'本地{localfile}文件已是最新,')
|
||||||
return "local_file_best_new"
|
return "local_file_best_new"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print(f'本地{remotefile}文件最新')
|
print(f'远程{remotefile}文件最新')
|
||||||
return "remote_file_best_new"
|
return "remote_file_best_new"
|
||||||
print(f'本地{localfile}文件不存在')
|
print(f'本地{localfile}文件不存在')
|
||||||
return "local_file_not_exist"
|
return "local_file_not_exist"
|
||||||
@@ -114,7 +117,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
# 根据坐标文件时间戳判断是否需要更新
|
# 根据坐标文件时间戳判断是否需要更新
|
||||||
if local_and_remote_file_time(psid,pid) == "local_file_best_new":
|
if local_and_remote_file_time(psid,pid) == "local_file_best_new":
|
||||||
print(f'本地文件已是最新, 不需要更新')
|
print(f'本地文件已是最新, 不需要下载云端影棚坐标文件')
|
||||||
continue
|
continue
|
||||||
# remotefile = os.path.join(xmps_mesh_path, '11_1.xmp')
|
# remotefile = os.path.join(xmps_mesh_path, '11_1.xmp')
|
||||||
# localfile = os.path.join(ImagesGeometry, '11_1.xmp')
|
# localfile = os.path.join(ImagesGeometry, '11_1.xmp')
|
||||||
|
|||||||
Reference in new issue
Block a user