edgeupdate

This commit is contained in:
2022-12-26 15:02:50 +08:00
parent e764c3d917
commit 4d464d0304
2 changed files with 11 additions and 1 deletions

View File

@ -46,11 +46,12 @@ def addobs(file_path, status): #save videos
return 'can not get the status'
status = status['data']
objectkey = os.path.basename(file_path)
status_ = get_weightStatus(objectkey)
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
if status == '02':
if status == '02' or status_:
resp = obsClient.putFile(bucketName, objectkey, file_path)
shutil.move(file_path, backups_path)
#os.remove(file_path)
@ -72,6 +73,14 @@ def Addimg_content(uuid_barcode, context):
objectkey = 'imgs/'+time+'/'+uuid_barcode+'.jpg'
resp = obsClient.putContent(bucketName, objectkey, context)
def get_weightStatus(uuid):
uuid = uuid.split('_')[1]
resp = requests.post(url = cfg.riskControl)
up_uuid = resp['data']
if uuid in up_uuid:
return True
return False
if __name__ == '__main__':
import cv2
context = cv2.imread('/home/lc/project/ieemoo-ai-search/data/imgs/20230625-094651_37dd99b0-520d-457b-8615-efdb7f53b5b4_6907992825762.jpg')