update info is async now
This commit is contained in:
parent
5f3f2eb4d3
commit
e7cec4cc46
1 changed files with 20 additions and 27 deletions
|
@ -610,21 +610,7 @@ class Client(object):
|
||||||
r = self.api.update(post)
|
r = self.api.update(post)
|
||||||
|
|
||||||
if r['data']['info']:
|
if r['data']['info']:
|
||||||
info = r['data']['info']
|
r = self.update_info(r['data']['info'], prefix)
|
||||||
max_info = 100
|
|
||||||
total = len(info)
|
|
||||||
sent = 0
|
|
||||||
for offset in range(0, total, max_info):
|
|
||||||
post = {'info': {}, 'upload': True}
|
|
||||||
post['info'] = self.get_info_for_ids(info[offset:offset+max_info], prefix)
|
|
||||||
if len(post['info']):
|
|
||||||
r = self.api.update(post)
|
|
||||||
sent += len(post['info'])
|
|
||||||
if sent:
|
|
||||||
print 'sent info for %s files' % sent
|
|
||||||
#send empty list to get updated list of requested info/files/data
|
|
||||||
post = {'info': {}}
|
|
||||||
r = self.api.update(post)
|
|
||||||
|
|
||||||
if not 'data' in r:
|
if not 'data' in r:
|
||||||
print r
|
print r
|
||||||
|
@ -687,18 +673,8 @@ class Client(object):
|
||||||
info = r['data']['info']
|
info = r['data']['info']
|
||||||
|
|
||||||
if info:
|
if info:
|
||||||
print 'info for %d files requested' % len(info)
|
r = self.update_info(info)
|
||||||
max_info = 100
|
sys.exit()
|
||||||
total = len(info)
|
|
||||||
sent = 0
|
|
||||||
for offset in range(0, total, max_info):
|
|
||||||
post = {'info': {}, 'upload': True}
|
|
||||||
post['info'] = self.get_info_for_ids(info[offset:offset+max_info])
|
|
||||||
if len(post['info']):
|
|
||||||
r = self.api.update(post)
|
|
||||||
sent += len(post['info'])
|
|
||||||
if sent:
|
|
||||||
print 'uploading info for %d files' % sent
|
|
||||||
|
|
||||||
if data:
|
if data:
|
||||||
print 'encoding and uploading %s videos' % len(data)
|
print 'encoding and uploading %s videos' % len(data)
|
||||||
|
@ -736,6 +712,23 @@ class Client(object):
|
||||||
self.api.uploadData(path, oshash)
|
self.api.uploadData(path, oshash)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
def update_info(self, info, prefix=None):
|
||||||
|
if info:
|
||||||
|
post = {'info': {}, 'upload': True}
|
||||||
|
post['info'] = self.get_info_for_ids(info, prefix)
|
||||||
|
r = self.api.update(post)
|
||||||
|
if 'taskId' in r['data']:
|
||||||
|
t = self.api.taskStatus(task_id=r['data']['taskId'])
|
||||||
|
print 'waiting for server ...'
|
||||||
|
while t['data']['status'] == 'PENDING':
|
||||||
|
time.sleep(5)
|
||||||
|
t = self.api.taskStatus(task_id=r['data']['taskId'])
|
||||||
|
print 'sent info for %s files' % len(post['info'])
|
||||||
|
#send empty list to get updated list of requested info/files/data
|
||||||
|
post = {'info': {}}
|
||||||
|
r = self.api.update(post)
|
||||||
|
return r
|
||||||
|
|
||||||
def upload_frames(self, args):
|
def upload_frames(self, args):
|
||||||
if not self.user:
|
if not self.user:
|
||||||
print "you need to login"
|
print "you need to login"
|
||||||
|
|
Loading…
Reference in a new issue