From 5e7964d2dd44fe229ce1b59e64d2093a5d786fdf Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Wed, 29 May 2013 15:24:05 -0700 Subject: [PATCH] fix implicit ID search This was broken because hooks._album_for_id now returns a list. This was assuming it returned a single value (or None). --- beets/autotag/match.py | 6 ++++-- beets/autotag/mb.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/beets/autotag/match.py b/beets/autotag/match.py index 6d60831b0..122066f5e 100644 --- a/beets/autotag/match.py +++ b/beets/autotag/match.py @@ -361,10 +361,11 @@ def match_by_id(items): if bool(reduce(lambda x,y: x if x==y else (), albumids)): albumid = albumids[0] log.debug('Searching for discovered album ID: ' + albumid) - return hooks._album_for_id(albumid) + matches = hooks._album_for_id(albumid) + if matches: + return matches[0] else: log.debug('No album ID consensus.') - return None def _recommendation(results): """Given a sorted list of AlbumMatch or TrackMatch objects, return a @@ -517,6 +518,7 @@ def tag_album(items, search_artist=None, search_album=None, # Get the results from the data sources. search_cands = hooks._album_candidates(items, search_artist, search_album, va_likely) + log.debug(u'Evaluating %i candidates.' % len(search_cands)) for info in search_cands: _add_candidate(items, candidates, info) diff --git a/beets/autotag/mb.py b/beets/autotag/mb.py index 8dd4b4688..c6a1d78d5 100644 --- a/beets/autotag/mb.py +++ b/beets/autotag/mb.py @@ -329,8 +329,8 @@ def _parse_id(s): # Find the first thing that looks like a UUID/MBID. match = re.search('[a-f0-9]{8}(-[a-f0-9]{4}){3}-[a-f0-9]{12}', s) if match: - log.error('Invalid MBID.') return match.group() + log.error('Invalid MBID.') def album_for_id(albumid): """Fetches an album by its MusicBrainz ID and returns an AlbumInfo