mirror of
https://github.com/beetbox/beets.git
synced 2025-12-26 02:24:33 +01:00
duplicate resolution prompt (#164)
"Skip" and "keep both" work already, but "remove old" does not. It sets a flag on the import task object; this flag should then be read by the apply_choices coroutine, where appropriate action should be taken as part of the same transaction that adds stuff to the DB. Unresolved questions: - Should old files be deleted? (How is this decided? Based on config parameters, or with another prompt option?) - Logging details. - Folder naming. If I have two albums with the same name, I want them in different directories. - Quiet mode. Currently, there are no checks -- the prompt should not be made in quiet mode. (In that case, what should it do?)
This commit is contained in:
parent
19b08f8e99
commit
ced4e1ace8
2 changed files with 16 additions and 1 deletions
|
|
@ -308,6 +308,7 @@ class ImportTask(object):
|
|||
self.path = path
|
||||
self.items = items
|
||||
self.sentinel = False
|
||||
self.remove_duplicates = False
|
||||
|
||||
@classmethod
|
||||
def done_sentinel(cls, toppath):
|
||||
|
|
|
|||
|
|
@ -570,7 +570,21 @@ def resolve_duplicate(task, config):
|
|||
"""
|
||||
log.warn("This %s is already in the library!" %
|
||||
("album" if task.is_album else "item"))
|
||||
task.set_choice(importer.action.SKIP)
|
||||
sel = ui.input_options(
|
||||
('Skip new', 'Keep both', 'Remove old'),
|
||||
color=config.color
|
||||
)
|
||||
if sel == 's':
|
||||
# Skip new.
|
||||
task.set_choice(importer.action.SKIP)
|
||||
elif sel == 'k':
|
||||
# Keep both. Do nothing; leave the choice intact.
|
||||
pass
|
||||
elif sel == 'r':
|
||||
# Remove old.
|
||||
task.remove_duplictes = True
|
||||
else:
|
||||
assert False
|
||||
|
||||
# The import command.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue