From b698f758e7df49ff5d9c09bd2f9946589841d2bc Mon Sep 17 00:00:00 2001 From: yvesf Date: Fri, 19 Nov 2010 23:37:40 +0100 Subject: prettify output; only one pdf thread --- index.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'index.py') 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() -- cgit v1.2.1