remove debug, avoid returning same path twice

This commit is contained in:
j 2016-09-23 13:22:07 +02:00
parent 28abab29a7
commit 2809ebb07b

View file

@ -304,12 +304,12 @@ class Client(object):
def path(self, oshash): def path(self, oshash):
conn, c = self._conn() conn, c = self._conn()
c.execute(u'SELECT path FROM file WHERE oshash = ?', (oshash, )) c.execute(u'SELECT path FROM file WHERE oshash = ?', (oshash, ))
paths = [] paths = set()
for row in c: for row in c:
path = row[0] path = row[0]
paths.append(path) paths.add(path)
conn.close() conn.close()
return paths return list(paths)
def online(self): def online(self):
self.api = API(self._config['url'], media_cache=self.media_cache()) self.api = API(self._config['url'], media_cache=self.media_cache())
@ -717,7 +717,6 @@ class Client(object):
if documents: if documents:
_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):
_documents.append([path, item]) _documents.append([path, item])