fix document upload

This commit is contained in:
j 2016-09-23 13:10:28 +02:00
parent 6824e11d08
commit 28abab29a7
1 changed files with 8 additions and 3 deletions

View File

@ -99,7 +99,7 @@ def parse_path(client, path, prefix=None):
parts = path.split('/')
if len(parts) >= client.folderdepth and parts[client.folderdepth-1] == 'Documents':
info = ox.movie.parse_path(u'/'.join(
parts[:client.folderdepth-1] + [parts[client.folderdepth-2]]
parts[:client.folderdepth-1] + [parts[-1]]
))
else:
if len(parts) != client.folderdepth:
@ -715,11 +715,16 @@ class Client(object):
self.api.uploadData(path, oshash)
break
if documents:
print('uploading %s documents' % len(documents))
_documents = []
for oshash, item in documents:
print(oshash, self.path(oshash))
for path in self.path(oshash):
if os.path.exists(path):
self._add_document(path, item)
_documents.append([path, item])
break
print('uploading %s documents' % len(_documents))
for path, item in _documents:
self._add_document(path, item)
if data:
print('encoding and uploading %s videos' % len(data))