From dc0c0114eb634b27749d0f64fa221ffa60f3f6bb Mon Sep 17 00:00:00 2001 From: Dixon Xavier Date: Sun, 12 Jun 2016 21:26:21 +0530 Subject: [PATCH] Initial code changes for review, issue #185 --- beets/config_default.yaml | 1 + beets/ui/commands.py | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/beets/config_default.yaml b/beets/config_default.yaml index 4c12c3df07..fa77a82dc5 100644 --- a/beets/config_default.yaml +++ b/beets/config_default.yaml @@ -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"] diff --git a/beets/ui/commands.py b/beets/ui/commands.py index d2270c6620..f89a2a909b 100644 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -824,11 +824,19 @@ def resolve_duplicate(self, task, found_duplicates): log.warn(u"This {0} is already in the library!", (u"album" if task.is_album else u"item")) + # If set, get the action to follow from config. + sel = config['import']['duplicate_action'].as_choice({ + u'skip': u's', + u'keep': u'k', + u'remove': u'r', + u'ask': None, + }) + if config['import']['quiet']: # In quiet mode, don't prompt -- just skip. log.info(u'Skipping.') sel = u's' - else: + elif sel is None: # Print some detail about the existing and new items so the # user can make an informed decision. for duplicate in found_duplicates: