count up while scanning folder

This commit is contained in:
j 2014-05-26 00:38:29 +02:00
parent 5e606b21d8
commit 00c286b3d3

View file

@ -125,6 +125,7 @@ def run_import(options=None):
listitems = [] listitems = []
assert isinstance(prefix, unicode) assert isinstance(prefix, unicode)
books = [] books = []
count = 0
for root, folders, files in os.walk(prefix): for root, folders, files in os.walk(prefix):
for f in files: for f in files:
#if f.startswith('._') or f == '.DS_Store': #if f.startswith('._') or f == '.DS_Store':
@ -134,7 +135,13 @@ def run_import(options=None):
ext = f.split('.')[-1] ext = f.split('.')[-1]
if ext in extensions: if ext in extensions:
books.append(f) books.append(f)
count += 1
if count % 1000 == 0:
state.activity = {
'activity': 'import',
'path': prefix,
'progress': [0, count],
}
state.activity = { state.activity = {
'activity': 'import', 'activity': 'import',
'path': prefix, 'path': prefix,