diff --git a/pandora_client/__init__.py b/pandora_client/__init__.py index 3683178..7cc5bff 100755 --- a/pandora_client/__init__.py +++ b/pandora_client/__init__.py @@ -866,12 +866,10 @@ class Client(object): did = self.find_document(oshash) if not did: url = '%supload/document/' % self._config['url'] - r = self.api.upload_chunks(url, f, { + did = self.api.upload_chunks(url, f, { 'filename': os.path.basename(f) }) - if r and item: - did = self.find_document(oshash) - if item: + if did and item: r = self.api.addDocument({ 'id': did, 'item': item @@ -1210,7 +1208,10 @@ class API(ox.API): print(' ' * 80) print('') show_cursor() - return data and 'result' in data and data.get('result') == 1 + if data and 'result' in data and data.get('result') == 1: + return data.get('id', True) + else: + return False else: if DEBUG: if 'status' in data and data['status']['code'] == 401: