This commit is contained in:
2023-06-26 16:31:07 +08:00
parent 00d6bc25c5
commit e749605916
5 changed files with 52 additions and 35 deletions

View File

@ -21,11 +21,11 @@ class opvideo:
def opFeature(self, uuid, finalnum, video):
videoFeature = []
self.addFeature(uuid, finalnum, video)
for num_id in range(0, finalnum):
print('>>>>>{}'.format(range(0, int(finalnum)+1)))
for num_id in range(0, int(finalnum)+1):
feature = readf(uuid, num_id)
videoFeature.append(feature)
redic = self.opVideFeature(videoFeature)
#print(redic)
return redic
def opVideFeature(self, videoFeature):

View File

@ -1,5 +1,14 @@
import h5py, os
from floder.config import cfg
from obs import ObsClient
import obs
obsClient = ObsClient(
access_key_id='LHXJC7GIC2NNUUHHTNVI',
secret_access_key='sVWvEItrFKWPp5DxeMvX8jLFU69iXPpzkjuMX3iM',
server='https://obs.cn-east-3.myhuaweicloud.com')
bucketName = 'ieemoo-ai'
headers = obs.SetObjectMetadataHeader()
headers.cacheControl = "no-cache"
def writef(uuid, num_id, feature):
fname = os.sep.join([cfg.hFile, uuid+'.h5'])
@ -9,7 +18,7 @@ def writef(uuid, num_id, feature):
else:
f = h5py.File(fname, 'a')
f[str(num_id)] = feature
print('>>>>>>>have been write')
#print('>>>>>>>have been write')
f.close()
def readf(uuid, num_id):
@ -22,3 +31,9 @@ def readf(uuid, num_id):
def removef(uuid):
fname = os.sep.join([cfg.hFile, uuid+'.h5'])
os.remove(fname)
def uploadf(video_name, num, file_path):
time = video_name.split('-')[0]
objectkey = video_name.split('.')[0]+'_'+str(num)+'.mp4'
objectkey = 'conpurchase/'+time+'/'+objectkey
resp = obsClient.putFile(bucketName, objectkey, file_path, headers=headers)