Remove Reduntant Search Action
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user