From 965097b20b8ecc246c73a9993adfefd0f0beba03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=99=A8?= Date: Wed, 14 Dec 2022 15:17:35 +0800 Subject: [PATCH] edgeUpdate --- utils/config.py | 4 +++- utils/updateObs.py | 12 +++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/utils/config.py b/utils/config.py index ebde369..99314cc 100644 --- a/utils/config.py +++ b/utils/config.py @@ -53,7 +53,9 @@ _C.URL = 'https://api.ieemoo.com/emoo-api/intelligence' #online _C.VreTest = 'http://api.test.ieemoo.cn/emoo-api/intelligence/queryVideoCompareResult.do' _C.VreTest2 = 'http://api.test2.ieemoo.cn/emoo-api/intelligence/queryVideoCompareResult.do' -#_C.Vre = 'https://api.ieemoo.com/emoo-api/intelligence/queryVideoCompareResult.do' #online +_C.Vre = 'https://api.ieemoo.com/emoo-api/intelligence/queryVideoCompareResult.do' #online + +_C.backups = '../module/output/videos' _C.Ocrimg = '../module/ieemoo-ai-assist/imgs'#post ocr img _C.Ocrtxt = '../module/ieemoo-ai-assist/document'#post ocr txts diff --git a/utils/updateObs.py b/utils/updateObs.py index 525fbc1..8c018a5 100644 --- a/utils/updateObs.py +++ b/utils/updateObs.py @@ -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]