From 4c6dbe67805ed6994b371c7ba119e774fd94466f Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sat, 24 Oct 2015 13:06:16 -0700 Subject: [PATCH] Remove `seen_idents` set This was used since time immemorial to keep track of recently-imported music that hasn't hit the database yet. I created it when the importer only added music to the database at the end of the pipeline, after doing all the work to manipulate the metadata. Now, for several reasons, we add the music immediately after the user sees it and then manipulate the records *in the database*. With the latest change, which gets rid of the last separation between UI and database-adding, we no longer need to do this. --- beets/importer.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/beets/importer.py b/beets/importer.py index 7be755eb4..95163b6fd 100644 --- a/beets/importer.py +++ b/beets/importer.py @@ -186,7 +186,6 @@ class ImportSession(object): self.logger = self._setup_logging(loghandler) self.paths = paths self.query = query - self.seen_idents = set() self._is_resuming = dict() # Normalize the paths. @@ -1307,18 +1306,13 @@ def resolve_duplicates(session, task): and ask the session to resolve this. """ if task.choice_flag in (action.ASIS, action.APPLY): - ident = task.chosen_ident() found_duplicates = task.find_duplicates(session.lib) - if ident in session.seen_idents or found_duplicates: - log.debug( - 'resolving duplicates; in database: {}, in queue: {}'.format( - len(found_duplicates), - ident in session.seen_idents, - ) - ) + if found_duplicates: + log.debug('found duplicates: {}'.format( + [o.id for o in found_duplicates] + )) session.resolve_duplicate(task, found_duplicates) session.log_choice(task, True) - session.seen_idents.add(ident) @pipeline.mutator_stage