Ask if should_skip() instead of sentinel

This commit is contained in:
Thomas Scholtes 2014-02-01 20:34:21 +01:00
parent ba49675252
commit 4551a89c0e

View file

@ -365,6 +365,7 @@ class ImportTask(object):
self.sentinel = False self.sentinel = False
self.remove_duplicates = False self.remove_duplicates = False
self.is_album = True self.is_album = True
self.choice_flag = None
@classmethod @classmethod
def done_sentinel(cls, toppath): def done_sentinel(cls, toppath):
@ -646,7 +647,7 @@ def initial_lookup(session):
task = None task = None
while True: while True:
task = yield task task = yield task
if task.sentinel: if task.should_skip():
continue continue
plugins.send('import_task_start', session=session, task=task) plugins.send('import_task_start', session=session, task=task)
@ -666,7 +667,7 @@ def user_query(session):
task = None task = None
while True: while True:
task = yield task task = yield task
if task.sentinel: if task.should_skip():
continue continue
# Ask the user for a choice. # Ask the user for a choice.
@ -724,7 +725,7 @@ def show_progress(session):
task = None task = None
while True: while True:
task = yield task task = yield task
if task.sentinel: if task.should_skip():
continue continue
log.info(displayable_path(task.paths)) log.info(displayable_path(task.paths))
@ -960,7 +961,7 @@ def item_lookup(session):
task = None task = None
while True: while True:
task = yield task task = yield task
if task.sentinel: if task.should_skip():
continue continue
plugins.send('import_task_start', session=session, task=task) plugins.send('import_task_start', session=session, task=task)
@ -975,7 +976,7 @@ def item_query(session):
recent = set() recent = set()
while True: while True:
task = yield task task = yield task
if task.sentinel: if task.should_skip():
continue continue
choice = session.choose_item(task) choice = session.choose_item(task)
@ -999,7 +1000,7 @@ def item_progress(session):
log.info('Importing items:') log.info('Importing items:')
while True: while True:
task = yield task task = yield task
if task.sentinel: if task.should_skip():
continue continue
log.info(displayable_path(task.item.path)) log.info(displayable_path(task.item.path))
@ -1017,7 +1018,7 @@ def group_albums(session):
task = None task = None
while True: while True:
task = yield task task = yield task
if task.sentinel: if task.should_skip():
continue continue
tasks = [] tasks = []
for _, items in itertools.groupby(task.items, group): for _, items in itertools.groupby(task.items, group):