edgeUpdate

This commit is contained in:
2023-01-17 15:29:19 +08:00
parent 931445efdd
commit 961eabd344

View File

@ -27,14 +27,14 @@ def AddObs(file_path, status):
shutil.move(file_path, f_dst) shutil.move(file_path, f_dst)
def addobs(file_path, status): #save videos def addobs(file_path, status): #save videos
ti.sleep(1) ti.sleep(0.5)
videoUuid = os.path.basename(file_path).split('_')[1] videoUuid = os.path.basename(file_path).split('_')[1]
json_data = {'videoUuid': videoUuid} json_data = {'videoUuid': videoUuid}
for vre in [cfg.VreTest, cfg.VreTest2, cfg.Vre]: for vre in [cfg.VreTest, cfg.VreTest2, cfg.Vre]:
resp = requests.post(url=vre, data=json_data) resp = requests.post(url=vre, data=json_data)
status = resp.json() status = resp.json()
if not 'data' in status:#延迟设置 if not 'data' in status:#延迟设置
ti.sleep(1) ti.sleep(0.5)
resp = requests.post(url=vre, data=json_data) resp = requests.post(url=vre, data=json_data)
status = resp.json() status = resp.json()
if 'data' in status: if 'data' in status:
@ -42,18 +42,18 @@ def addobs(file_path, status): #save videos
else: else:
break break
if not 'data' in status: if not 'data' in status:
os.remove(file_path) # os.remove(file_path)
return 'can not get the status' return 'can not get the status'
status = status['data'] status = status['data']
objectkey = os.path.basename(file_path) objectkey = os.path.basename(file_path)
status_ = get_weightStatus(objectkey) status_ = get_weightStatus(objectkey)
backups_path = os.sep.join([cfg.backups, status+'_'+objectkey]) # backups_path = os.sep.join([cfg.backups, status+'_'+objectkey])
time = os.path.basename(file_path).split('-')[0] time = os.path.basename(file_path).split('-')[0]
if objectkey.split('.')[-1] in ['avi','mp4']: if objectkey.split('.')[-1] in ['avi','mp4']:
objectkey = 'videos/'+time+'/'+status+'/'+status+'_'+objectkey objectkey = 'videos/'+time+'/'+status+'/'+status+'_'+objectkey
if status == '02' or status_: if status == '02' or status_:
resp = obsClient.putFile(bucketName, objectkey, file_path) resp = obsClient.putFile(bucketName, objectkey, file_path)
shutil.move(file_path, backups_path) # shutil.move(file_path, backups_path)
#os.remove(file_path) #os.remove(file_path)
def Addimg(uuid_barcode): def Addimg(uuid_barcode):