summaryrefslogtreecommitdiff
path: root/index.py
diff options
context:
space:
mode:
authoryvesf <yvesf-git@xapek.org>2010-11-19 23:37:40 +0100
committeryvesf <yvesf-git@xapek.org>2010-11-19 23:37:40 +0100
commitb698f758e7df49ff5d9c09bd2f9946589841d2bc (patch)
tree2919529a53235baf92353a632de577a1e135bb38 /index.py
parentdac88861a9635504af3813f57c443040b7416163 (diff)
downloadbooksearch-b698f758e7df49ff5d9c09bd2f9946589841d2bc.tar.gz
booksearch-b698f758e7df49ff5d9c09bd2f9946589841d2bc.zip
prettify output; only one pdf thread
Diffstat (limited to 'index.py')
-rw-r--r--index.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/index.py b/index.py
index 1161165..5a37008 100644
--- a/index.py
+++ b/index.py
@@ -26,7 +26,8 @@ filepaths = Queue()
documents = Queue()
notifier = Condition()
-directory = unicode(sys.argv[0], "utf8")
+directory = unicode(sys.argv[1], "utf8")
+print u"Walking {0}".format(directory)
filecount = 0
for path, directories, files in os.walk(directory):
for filename in files:
@@ -54,6 +55,7 @@ class PDFWorker(Thread):
except Exception, e:
print u"{0} Exception: {1}".format(self.name, str(e))
finally:
+ print u"{0} finished {1}".format(self.name, filepath)
filepaths.task_done()
class IndexWorker(Thread):
@@ -66,10 +68,10 @@ class IndexWorker(Thread):
writer = index.writer()
writer.add_document(**doc)
documents.task_done()
- print u"Added {0}".format(doc['path'])
+ print u"{0} added {1}".format(self.name, doc['path'])
writer.commit()
-threads = map(lambda i: PDFWorker(), range(4))
+threads = map(lambda i: PDFWorker(), range(1))
for thread in threads:
thread.start()
@@ -108,4 +110,3 @@ oldindex.close()
except Exception,e:
print e
"""
-index.close()