fix document upload

This commit is contained in:
j 2016-09-23 13:10:28 +02:00
parent 6824e11d08
commit 28abab29a7

View file

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