def resolve_duplicates(session, task):
 if (task.choice_flag in (action.ASIS, action.APPLY, action.RETAG)):
  found_duplicates = task.find_duplicates(session.lib)
  if found_duplicates:
   log.debug(u'found duplicates: {}'.format([o.id for o in found_duplicates]))
   duplicate_action = config['import']['duplicate_action'].as_choice({u'skip': u's', u'keep': u'k', u'remove': u'r', u'ask': u'a'})
   log.debug(u'default action for duplicates: {0}', duplicate_action)
   if (duplicate_action == u's'):
    task.set_choice(action.SKIP)
   elif (duplicate_action == u'k'):
    pass
   elif (duplicate_action == u'r'):
    task.should_remove_duplicates = True
   else:
    session.resolve_duplicate(task, found_duplicates)
   session.log_choice(task, True)

def resolve_duplicates ( session , task ) : if ( task . choice_flag in ( action . ASIS , action . APPLY , action . RETAG ) ) : found_duplicates = task . find_duplicates ( session . lib ) if found_duplicates : log . debug ( u'found duplicates: {}' . format ( [ o . id for o in found_duplicates ] ) ) duplicate_action = config [ 'import' ] [ 'duplicate_action' ] . as_choice ( { u'skip' : u's' , u'keep' : u'k' , u'remove' : u'r' , u'ask' : u'a' } ) log . debug ( u'default action for duplicates: {0}' , duplicate_action ) if ( duplicate_action == u's' ) : task . set_choice ( action . SKIP ) elif ( duplicate_action == u'k' ) : pass elif ( duplicate_action == u'r' ) : task . should_remove_duplicates = True else : session . resolve_duplicate ( task , found_duplicates ) session . log_choice ( task , True )
check if a task conflicts with items or albums already imported and ask the session to resolve this .