update
This commit is contained in:
@ -55,7 +55,7 @@ def addobs(file_path, status): #save videos
|
|||||||
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
|
||||||
resp = obsClient.putFile(bucketName, objectkey, file_path, hearders=headers)
|
resp = obsClient.putFile(bucketName, objectkey, file_path, headers=headers)
|
||||||
#os.remove(file_path)
|
#os.remove(file_path)
|
||||||
|
|
||||||
def updateAgain():
|
def updateAgain():
|
||||||
@ -73,7 +73,7 @@ def updateAgain():
|
|||||||
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
|
||||||
resp = obsClient.putFile(bucketName, objectkey, file_path, hearders=headers)
|
resp = obsClient.putFile(bucketName, objectkey, file_path, headers=headers)
|
||||||
os.remove(file_path)
|
os.remove(file_path)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
@ -86,14 +86,14 @@ def Addimg(uuid_barcode):
|
|||||||
file_path = os.sep.join([cfg.Tempimg, '3_'+uuid_barcode+'.jpg'])
|
file_path = os.sep.join([cfg.Tempimg, '3_'+uuid_barcode+'.jpg'])
|
||||||
if not os.path.exists(file_path):
|
if not os.path.exists(file_path):
|
||||||
file_path = os.sep.join([cfg.Tempimg, 'ex_'+uuid_barcode+'.jpg'])
|
file_path = os.sep.join([cfg.Tempimg, 'ex_'+uuid_barcode+'.jpg'])
|
||||||
resp = obsClient.putFile(bucketName, objectkey, file_path, hearders=headers)
|
resp = obsClient.putFile(bucketName, objectkey, file_path, headers=headers)
|
||||||
|
|
||||||
def Addimg_content(uuid_barcode, context):
|
def Addimg_content(uuid_barcode, context):
|
||||||
success, encoded_image = cv2.imencode(".jpg",context)
|
success, encoded_image = cv2.imencode(".jpg",context)
|
||||||
context = encoded_image.tobytes()
|
context = encoded_image.tobytes()
|
||||||
time = uuid_barcode.split('-')[0]
|
time = uuid_barcode.split('-')[0]
|
||||||
objectkey = 'imgs/'+time+'/'+uuid_barcode+'.jpg'
|
objectkey = 'imgs/'+time+'/'+uuid_barcode+'.jpg'
|
||||||
resp = obsClient.putContent(bucketName, objectkey, context, hearders=headers)
|
resp = obsClient.putContent(bucketName, objectkey, context, headers=headers)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import cv2
|
import cv2
|
||||||
|
Reference in New Issue
Block a user