edgeUpdate
This commit is contained in:
@ -17,6 +17,7 @@ def AddObs(file_path, status):
|
||||
with lock:
|
||||
if not cfg.flag:
|
||||
addobs(file_path, status)
|
||||
os.remove(file_path)
|
||||
else:
|
||||
if status == '02':
|
||||
addobs(file_path, status)
|
||||
@ -26,14 +27,14 @@ def AddObs(file_path, status):
|
||||
shutil.move(file_path, f_dst)
|
||||
|
||||
def addobs(file_path, status): #save videos
|
||||
ti.sleep(3)
|
||||
ti.sleep(5)
|
||||
videoUuid = os.path.basename(file_path).split('_')[1]
|
||||
json_data = {'videoUuid': videoUuid}
|
||||
for vre in [cfg.VreTest, cfg.VreTest2]:
|
||||
for vre in [cfg.Vre]:#[cfg.VreTest, cfg.VreTest2, cfg.Vre]:
|
||||
resp = requests.post(url=vre, data=json_data)
|
||||
status = resp.json()
|
||||
if not 'data' in status:#延迟设置
|
||||
ti.sleep(5)
|
||||
ti.sleep(15)
|
||||
resp = requests.post(url=cfg.Vre, data=json_data)
|
||||
status = resp.json()
|
||||
if 'data' in status:
|
||||
@ -41,13 +42,14 @@ def addobs(file_path, status): #save videos
|
||||
else:
|
||||
break
|
||||
status = status['data']
|
||||
|
||||
objectkey = os.path.basename(file_path)
|
||||
backups_path = os.sep.join([cfg.backups, status+'_'+objectkey])
|
||||
time = os.path.basename(file_path).split('-')[0]
|
||||
if objectkey.split('.')[-1] in ['avi','mp4']:
|
||||
objectkey = 'videos/'+time+'/'+status+'/'+status+'_'+objectkey
|
||||
resp = obsClient.putFile(bucketName, objectkey, file_path)
|
||||
os.remove(file_path)
|
||||
shutil.move(file_path, backups_path)
|
||||
#os.remove(file_path)
|
||||
|
||||
def Addimg(uuid_barcode):
|
||||
time = uuid_barcode.split('-')[0].split('_')[-1]
|
||||
|
Reference in New Issue
Block a user