39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
import h5py, os, sys, logging, obs
|
|
from floder.config import cfg
|
|
from up_load_file import up_load
|
|
|
|
up_load_data = up_load()
|
|
def writef(uuid, num_id, feature):
|
|
fname = os.sep.join([cfg.hFile, uuid+'.h5'])
|
|
if not os.path.exists(fname):
|
|
f = h5py.File(fname, 'w')
|
|
f[str(num_id)] = feature
|
|
else:
|
|
f = h5py.File(fname, 'a')
|
|
f[str(num_id)] = feature
|
|
#print('>>>>>>>have been write')
|
|
f.close()
|
|
|
|
def readf(uuid, num_id):
|
|
fname = os.sep.join([cfg.hFile, uuid+'.h5'])
|
|
f = h5py.File(fname, 'r')
|
|
value = f[str(num_id)][:]
|
|
f.close()
|
|
return value
|
|
|
|
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
|
|
up_load_data.upLoad(objectkey, file_path)
|
|
#if obs:
|
|
# obsClient, headers = obsInit()
|
|
# resp = obsClient.putFile(cfg.obs_bucketName, objectkey, file_path, headers=headers)
|
|
#if cos:
|
|
# upLoadCos(cfg.cos_Bucket, objectkey, file_path)
|
|
|