From 9a27c90a1a623e6625deef09015867db8d2b6fd7 Mon Sep 17 00:00:00 2001 From: Kim Wittenburg <5wittenb@informatik.uni-hamburg.de> Date: Tue, 4 Sep 2018 16:25:33 +0200 Subject: [PATCH] Remove Reduntant Search Action --- beetsplug/itunes.py | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/beetsplug/itunes.py b/beetsplug/itunes.py index b33859d..8b4cdb8 100644 --- a/beetsplug/itunes.py +++ b/beetsplug/itunes.py @@ -78,7 +78,6 @@ class iTunesPlugin(BeetsPlugin): 'artwork': False, # Whether to also download artwork from iTunes. Does not work well with fetchart 'method': 'lookup', # Valid values: 'search', 'lookup', 'both', 'lookup (search fallback)' }) - self.force_search = False if self.method in ['lookup', 'lookup (search fallback)', 'both']: self.register_listener('import_task_start', self.scan_track_ids) self.register_listener('before_choose_candidate', self.add_prompt_choices) @@ -130,8 +129,6 @@ class iTunesPlugin(BeetsPlugin): """Returns a list of AlbumInfo objects for iTunes search results matching an album and artist. """ - force_search = self.force_search - self.force_search = False try: candidates = [] # Lookup the track ids assigned by iTunes Match @@ -143,7 +140,7 @@ class iTunesPlugin(BeetsPlugin): for item in items: _track_ids.pop(item, None) - if force_search or self.method in ['search', 'both'] or (self.method == 'lookup (search fallback)' and len(candidates) == 0): + if self.method in ['search', 'both'] or (self.method == 'lookup (search fallback)' and len(candidates) == 0): candidates += self.search_albums(artist, album, va_likely) return candidates except ConnectionError: @@ -339,25 +336,10 @@ class iTunesPlugin(BeetsPlugin): return info def add_prompt_choices(self, session, task): - choices = [] - - if self.method in ['lookup', 'lookup (search fallback)']: - choices += [PromptChoice('c', 'searCh iTunes', self.prompt_search)] - no_itunes_matches = len(list(filter(lambda match: match.info.data_source == 'iTunes', task.candidates))) if no_itunes_matches == 1 and task.candidates[0].info.data_source == 'iTunes': print_(colorize('text_highlight', 'This is the only iTunes Match')) - return choices - - def prompt_search(self, session, task): - self.force_search = True - _, _, proposal = tag_album(task.items) - return proposal - - def noop(self, session, task): - pass - def decode_explicitness(advisory_string): return ['notExplicit', 'explicit', 'cleaned'].index(advisory_string)