update
This commit is contained in:
31
up_again.py
Normal file
31
up_again.py
Normal file
@ -0,0 +1,31 @@
|
||||
import os
|
||||
import requests
|
||||
from obs import ObsClient
|
||||
obsClient = ObsClient(
|
||||
access_key_id='LHXJC7GIC2NNUUHHTNVI',
|
||||
secret_access_key='sVWvEItrFKWPp5DxeMvX8jLFU69iXPpzkjuMX3iM',
|
||||
server='https://obs.cn-east-3.myhuaweicloud.com'
|
||||
)
|
||||
bucketName = 'ieemoo-ai'
|
||||
|
||||
def upAgain(path, url):
|
||||
for name in os.listdir(path):
|
||||
try:
|
||||
file_path = os.sep.join([path, name])
|
||||
videoUuid = name.split('_')[1]
|
||||
json_date = {'videoUuid': videoUuid}
|
||||
resp = requests.post(url=url,
|
||||
data=json_date)
|
||||
status = resp.json()['data']
|
||||
time = name.split('-')[0]
|
||||
objectkey = 'videos/'+time+'/'+status+'/'+status+'_'+name
|
||||
#print('>>>>>>>>>',objectkey)
|
||||
resp = obsClient.putFile(bucketName, objectkey, file_path)
|
||||
os.remove(file_path)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
if __name__ == '__main__':
|
||||
path = '../module/ieemoo-ai-searchv2/videos'
|
||||
url = 'https://api.ieemoo.com/emoo-api/intelligence/queryVideoCompareResult.do'
|
||||
upAgain(path, url)
|
Reference in New Issue
Block a user