mirror of
https://github.com/beetbox/beets.git
synced 2025-12-23 00:54:03 +01:00
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).
This commit is contained in:
parent
bf1291a97d
commit
5e7964d2dd
2 changed files with 5 additions and 3 deletions
|
|
@ -361,10 +361,11 @@ def match_by_id(items):
|
||||||
if bool(reduce(lambda x,y: x if x==y else (), albumids)):
|
if bool(reduce(lambda x,y: x if x==y else (), albumids)):
|
||||||
albumid = albumids[0]
|
albumid = albumids[0]
|
||||||
log.debug('Searching for discovered album ID: ' + albumid)
|
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:
|
else:
|
||||||
log.debug('No album ID consensus.')
|
log.debug('No album ID consensus.')
|
||||||
return None
|
|
||||||
|
|
||||||
def _recommendation(results):
|
def _recommendation(results):
|
||||||
"""Given a sorted list of AlbumMatch or TrackMatch objects, return a
|
"""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.
|
# Get the results from the data sources.
|
||||||
search_cands = hooks._album_candidates(items, search_artist,
|
search_cands = hooks._album_candidates(items, search_artist,
|
||||||
search_album, va_likely)
|
search_album, va_likely)
|
||||||
|
|
||||||
log.debug(u'Evaluating %i candidates.' % len(search_cands))
|
log.debug(u'Evaluating %i candidates.' % len(search_cands))
|
||||||
for info in search_cands:
|
for info in search_cands:
|
||||||
_add_candidate(items, candidates, info)
|
_add_candidate(items, candidates, info)
|
||||||
|
|
|
||||||
|
|
@ -329,8 +329,8 @@ def _parse_id(s):
|
||||||
# Find the first thing that looks like a UUID/MBID.
|
# 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)
|
match = re.search('[a-f0-9]{8}(-[a-f0-9]{4}){3}-[a-f0-9]{12}', s)
|
||||||
if match:
|
if match:
|
||||||
log.error('Invalid MBID.')
|
|
||||||
return match.group()
|
return match.group()
|
||||||
|
log.error('Invalid MBID.')
|
||||||
|
|
||||||
def album_for_id(albumid):
|
def album_for_id(albumid):
|
||||||
"""Fetches an album by its MusicBrainz ID and returns an AlbumInfo
|
"""Fetches an album by its MusicBrainz ID and returns an AlbumInfo
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue