mirror of
https://github.com/beetbox/beets.git
synced 2025-12-25 01:53:31 +01:00
Add new importer configuration to deal with duplicate items
This commit is contained in:
parent
2669b35945
commit
a73ad99dd8
2 changed files with 19 additions and 1 deletions
|
|
@ -23,6 +23,7 @@ import:
|
|||
group_albums: no
|
||||
pretend: false
|
||||
search_ids: []
|
||||
duplicate_action: ask
|
||||
|
||||
clutter: ["Thumbs.DB", ".DS_Store"]
|
||||
ignore: [".*", "*~", "System Volume Information", "lost+found"]
|
||||
|
|
|
|||
|
|
@ -1327,7 +1327,24 @@ def resolve_duplicates(session, task):
|
|||
log.debug(u'found duplicates: {}'.format(
|
||||
[o.id for o in found_duplicates]
|
||||
))
|
||||
session.resolve_duplicate(task, found_duplicates)
|
||||
|
||||
# Get the default action to follow from config.
|
||||
duplicate_action = config['import']['duplicate_action'].get()
|
||||
log.debug(u'default action for duplicates: {0}', duplicate_action)
|
||||
|
||||
if duplicate_action == 'skip':
|
||||
# Skip new.
|
||||
task.set_choice(action.SKIP)
|
||||
elif duplicate_action == 'keep':
|
||||
# Keep both. Do nothing; leave the choice intact.
|
||||
pass
|
||||
elif duplicate_action == 'remove':
|
||||
# Remove old.
|
||||
task.should_remove_duplicates = True
|
||||
else:
|
||||
# No default action set; ask the session.
|
||||
session.resolve_duplicate(task, found_duplicates)
|
||||
|
||||
session.log_choice(task, True)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue