cancel while reading in directory

This commit is contained in:
j 2014-05-26 10:34:09 +02:00
parent f2c7491d4c
commit 60a454d929

View file

@ -136,12 +136,16 @@ def run_import(options=None):
if ext in extensions: if ext in extensions:
books.append(f) books.append(f)
count += 1 count += 1
if state.activity.get('cancel'):
state.activity = {}
return
if count % 1000 == 0: if count % 1000 == 0:
state.activity = { state.activity = {
'activity': 'import', 'activity': 'import',
'path': prefix, 'path': prefix,
'progress': [0, count], 'progress': [0, count],
} }
trigger_event('activity', state.activity)
state.activity = { state.activity = {
'activity': 'import', 'activity': 'import',
'path': prefix, 'path': prefix,