From 00c286b3d356b1bf3e6dd2aed7eec94d4b950e59 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 26 May 2014 00:38:29 +0200 Subject: [PATCH] count up while scanning folder --- oml/item/scan.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/oml/item/scan.py b/oml/item/scan.py index 37e82f2..6c21216 100644 --- a/oml/item/scan.py +++ b/oml/item/scan.py @@ -125,6 +125,7 @@ def run_import(options=None): listitems = [] assert isinstance(prefix, unicode) books = [] + count = 0 for root, folders, files in os.walk(prefix): for f in files: #if f.startswith('._') or f == '.DS_Store': @@ -134,7 +135,13 @@ def run_import(options=None): ext = f.split('.')[-1] if ext in extensions: books.append(f) - + count += 1 + if count % 1000 == 0: + state.activity = { + 'activity': 'import', + 'path': prefix, + 'progress': [0, count], + } state.activity = { 'activity': 'import', 'path': prefix,