mirror of
https://github.com/beetbox/beets.git
synced 2026-01-01 13:33:02 +01:00
add validation for configuration
This commit is contained in:
parent
80ca527f76
commit
366a6d7fb2
1 changed files with 9 additions and 4 deletions
|
|
@ -1329,16 +1329,21 @@ def resolve_duplicates(session, task):
|
|||
))
|
||||
|
||||
# Get the default action to follow from config.
|
||||
duplicate_action = config['import']['duplicate_action'].get()
|
||||
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 == 'skip':
|
||||
if duplicate_action == u's':
|
||||
# Skip new.
|
||||
task.set_choice(action.SKIP)
|
||||
elif duplicate_action == 'keep':
|
||||
elif duplicate_action == u'k':
|
||||
# Keep both. Do nothing; leave the choice intact.
|
||||
pass
|
||||
elif duplicate_action == 'remove':
|
||||
elif duplicate_action == u'r':
|
||||
# Remove old.
|
||||
task.should_remove_duplicates = True
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue