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
|
'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)'
|
'method': 'lookup', # Valid values: 'search', 'lookup', 'both', 'lookup (search fallback)'
|
||||||
})
|
})
|
||||||
self.force_search = False
|
|
||||||
if self.method in ['lookup', 'lookup (search fallback)', 'both']:
|
if self.method in ['lookup', 'lookup (search fallback)', 'both']:
|
||||||
self.register_listener('import_task_start', self.scan_track_ids)
|
self.register_listener('import_task_start', self.scan_track_ids)
|
||||||
self.register_listener('before_choose_candidate', self.add_prompt_choices)
|
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
|
"""Returns a list of AlbumInfo objects for iTunes search results
|
||||||
matching an album and artist.
|
matching an album and artist.
|
||||||
"""
|
"""
|
||||||
force_search = self.force_search
|
|
||||||
self.force_search = False
|
|
||||||
try:
|
try:
|
||||||
candidates = []
|
candidates = []
|
||||||
# Lookup the track ids assigned by iTunes Match
|
# Lookup the track ids assigned by iTunes Match
|
||||||
@@ -143,7 +140,7 @@ class iTunesPlugin(BeetsPlugin):
|
|||||||
for item in items:
|
for item in items:
|
||||||
_track_ids.pop(item, None)
|
_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)
|
candidates += self.search_albums(artist, album, va_likely)
|
||||||
return candidates
|
return candidates
|
||||||
except ConnectionError:
|
except ConnectionError:
|
||||||
@@ -339,25 +336,10 @@ class iTunesPlugin(BeetsPlugin):
|
|||||||
return info
|
return info
|
||||||
|
|
||||||
def add_prompt_choices(self, session, task):
|
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)))
|
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':
|
if no_itunes_matches == 1 and task.candidates[0].info.data_source == 'iTunes':
|
||||||
print_(colorize('text_highlight', 'This is the only iTunes Match'))
|
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):
|
def decode_explicitness(advisory_string):
|
||||||
return ['notExplicit', 'explicit', 'cleaned'].index(advisory_string)
|
return ['notExplicit', 'explicit', 'cleaned'].index(advisory_string)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user