use server side offset if provided

This commit is contained in:
j 2014-04-11 19:01:25 +02:00
parent fc0d0612c8
commit 72b5643e68

View file

@ -1048,6 +1048,10 @@ class API(ox.API):
time.sleep(5) time.sleep(5)
if data and data.get('result') == 1: if data and data.get('result') == 1:
done += len(chunk) done += len(chunk)
if data.get('offset') not in (None, done):
print 'server offset out of sync, continue from', data['offset']
done = data['offset']
f.seek(done)
with open(self._resume_file, 'w') as r: with open(self._resume_file, 'w') as r:
json.dump({ json.dump({
'uploadUrl': uploadUrl, 'uploadUrl': uploadUrl,