mirror of
https://github.com/beetbox/beets.git
synced 2026-01-20 15:14:13 +01:00
Roll back PR #1358: regression on recent duplicate
This should fix #1652, which found that this code did the wrong thing when there were *no* `found_duplicates`: that is, when the duplicate actually came from the `seen_keys` list, so the album is not in the database yet. This handling was confusing "no non-empty duplicates" with "no in-database duplicates", and incorrectly bypassing the duplicates prompt. Since having empty albums in the database is a rare case (it should be impossible!), and we should no longer *crash* when it happens, I am considering it unnecessary to handle it specially. The user will now just see "Old: 0 items" and that's that.
This commit is contained in:
parent
15190794dc
commit
cc5aba8294
1 changed files with 1 additions and 16 deletions
|
|
@ -761,16 +761,6 @@ class TerminalImportSession(importer.ImportSession):
|
|||
log.warn(u"This {0} is already in the library!",
|
||||
("album" if task.is_album else "item"))
|
||||
|
||||
# skip empty albums (coming from a previous failed import session)
|
||||
if task.is_album:
|
||||
real_duplicates = [dup for dup in found_duplicates if dup.items()]
|
||||
if not real_duplicates:
|
||||
log.info("All duplicates are empty, we ignore them")
|
||||
task.should_remove_duplicates = True
|
||||
return
|
||||
else:
|
||||
real_duplicates = found_duplicates
|
||||
|
||||
if config['import']['quiet']:
|
||||
# In quiet mode, don't prompt -- just skip.
|
||||
log.info(u'Skipping.')
|
||||
|
|
@ -778,17 +768,12 @@ class TerminalImportSession(importer.ImportSession):
|
|||
else:
|
||||
# Print some detail about the existing and new items so the
|
||||
# user can make an informed decision.
|
||||
for duplicate in real_duplicates:
|
||||
for duplicate in found_duplicates:
|
||||
print_("Old: " + summarize_items(
|
||||
list(duplicate.items()) if task.is_album else [duplicate],
|
||||
not task.is_album,
|
||||
))
|
||||
|
||||
if real_duplicates != found_duplicates: # there's empty albums
|
||||
count = len(found_duplicates) - len(real_duplicates)
|
||||
print_("Old: {0} empty album{1}".format(
|
||||
count, "s" if count > 1 else ""))
|
||||
|
||||
print_("New: " + summarize_items(
|
||||
task.imported_items(),
|
||||
not task.is_album,
|
||||
|
|
|
|||
Loading…
Reference in a new issue