def upload(dir): fs = os.listdir(dir) for f in fs: file = dir + "/" + f if os.path.isdir(file): upload(file) else: if'DS_Store' not in file and 'png' not in f and 'JPG' not in f: putAliyun(file, f)
#获得上传的时长 defprogress_callback(bytes_consumed, total_bytes): print('bytes_consumed is {}'.format(bytes_consumed)) print('total_bytes is {}'.format(total_bytes))
if result.status == 200: aliyun = 'http://video.oss-cn-hangzhou.aliyuncs.com/{}'.format(key) title = '【{}】{}'.format(getmkname(path), f.split('.mp4')[0]) dataset.append([title, aliyun]) else: print('upload fail,error code', result.status)
defupload(dir): fs = os.listdir(dir) for f in fs: file = dir + "/" + f if os.path.isdir(file): upload(file) else: if'DS_Store'notin file and'png'notin f and'JPG'notin f: putAliyun(file, f)