mirror of
https://github.com/beetbox/beets.git
synced 2025-12-30 04:22:40 +01:00
more efficiently limit the number of results returned from MB
This commit is contained in:
parent
b565a3afd4
commit
751a46c716
4 changed files with 8 additions and 5 deletions
2
NEWS
2
NEWS
|
|
@ -17,6 +17,8 @@
|
|||
* Fixed bug that completely broke non-autotagged imports ("import -A").
|
||||
* Fixed bug that logged the wrong paths when using "import -l".
|
||||
* Fixed autotagging for the creatively-named band !!!.
|
||||
* Efficiency tweak should reduce the number of MusicBrainz queries per
|
||||
autotagged album.
|
||||
* A new "-v" command line switch enables debugging output.
|
||||
|
||||
1.0b4
|
||||
|
|
|
|||
|
|
@ -448,8 +448,9 @@ def tag_album(items, search_artist=None, search_album=None):
|
|||
# Get candidate metadata from search.
|
||||
if not search_artist or not search_album:
|
||||
raise InsufficientMetadataError()
|
||||
candidates = mb.match_album(search_artist, search_album, len(items))
|
||||
candidates = list(candidates)[:MAX_CANDIDATES]
|
||||
candidates = mb.match_album(search_artist, search_album,
|
||||
len(items), MAX_CANDIDATES)
|
||||
candidates = list(candidates)
|
||||
|
||||
# Get candidates from plugins.
|
||||
candidates.extend(plugins.candidates(items))
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ def release_dict(release, tracks=None):
|
|||
|
||||
return out
|
||||
|
||||
def match_album(artist, album, tracks=None):
|
||||
def match_album(artist, album, tracks=None, limit=SEARCH_LIMIT):
|
||||
"""Searches for a single album ("release" in MusicBrainz parlance)
|
||||
and returns an iterator over dictionaries of information (as
|
||||
returned by `release_dict`).
|
||||
|
|
|
|||
|
|
@ -131,8 +131,8 @@ class LastIdPlugin(BeetsPlugin):
|
|||
criteria['artistName'] = last_artist
|
||||
|
||||
# Perform the search.
|
||||
cands = mb.get_releases(**criteria)
|
||||
cands = list(cands)[:autotag.MAX_CANDIDATES]
|
||||
criteria['limit'] = autotag.MAX_CANDIDATES
|
||||
cands = list(mb.get_releases(**criteria))
|
||||
|
||||
log.debug('Matched last candidates: %s' %
|
||||
', '.join([cand['album'] for cand in cands]))
|
||||
|
|
|
|||
Loading…
Reference in a new issue