@pipeline.stage
def user_query(session, task):
 if task.skip:
  return task
 task.choose_match(session)
 plugins.send('import_task_choice', session=session, task=task)
 if (task.choice_flag is action.TRACKS):
  def emitter(task):
   for item in task.items:
    task = SingletonImportTask(task.toppath, item)
    for new_task in task.handle_created(session):
     (yield new_task)
   (yield SentinelImportTask(task.toppath, task.paths))
  ipl = pipeline.Pipeline([emitter(task), lookup_candidates(session), user_query(session)])
  return pipeline.multiple(ipl.pull())
 if (task.choice_flag is action.ALBUMS):
  ipl = pipeline.Pipeline([iter([task]), group_albums(session), lookup_candidates(session), user_query(session)])
  return pipeline.multiple(ipl.pull())
 resolve_duplicates(session, task)
 apply_choice(session, task)
 return task

@ pipeline . stage def user_query ( session , task ) : if task . skip : return task task . choose_match ( session ) plugins . send ( 'import_task_choice' , session = session , task = task ) if ( task . choice_flag is action . TRACKS ) : def emitter ( task ) : for item in task . items : task = SingletonImportTask ( task . toppath , item ) for new_task in task . handle_created ( session ) : ( yield new_task ) ( yield SentinelImportTask ( task . toppath , task . paths ) ) ipl = pipeline . Pipeline ( [ emitter ( task ) , lookup_candidates ( session ) , user_query ( session ) ] ) return pipeline . multiple ( ipl . pull ( ) ) if ( task . choice_flag is action . ALBUMS ) : ipl = pipeline . Pipeline ( [ iter ( [ task ] ) , group_albums ( session ) , lookup_candidates ( session ) , user_query ( session ) ] ) return pipeline . multiple ( ipl . pull ( ) ) resolve_duplicates ( session , task ) apply_choice ( session , task ) return task
a coroutine for interfacing with the user about the tagging process .