mirror of
https://github.com/beetbox/beets.git
synced 2026-01-05 07:23:33 +01:00
Move autotag.mb.SEARCH_LIMIT to configuration.
Merge branch 'search-limit-in-config' From pull request #1245 by @Freso.
This commit is contained in:
commit
29739dbe04
4 changed files with 20 additions and 5 deletions
|
|
@ -25,7 +25,6 @@ import beets
|
|||
from beets import util
|
||||
from beets import config
|
||||
|
||||
SEARCH_LIMIT = 5
|
||||
VARIOUS_ARTISTS_ID = '89ad4ac3-39f7-470e-963a-56509c546377'
|
||||
BASE_URL = 'http://musicbrainz.org/'
|
||||
|
||||
|
|
@ -301,7 +300,7 @@ def album_info(release):
|
|||
return info
|
||||
|
||||
|
||||
def match_album(artist, album, tracks=None, limit=SEARCH_LIMIT):
|
||||
def match_album(artist, album, tracks=None):
|
||||
"""Searches for a single album ("release" in MusicBrainz parlance)
|
||||
and returns an iterator over AlbumInfo objects. May raise a
|
||||
MusicBrainzAPIError.
|
||||
|
|
@ -324,7 +323,8 @@ def match_album(artist, album, tracks=None, limit=SEARCH_LIMIT):
|
|||
return
|
||||
|
||||
try:
|
||||
res = musicbrainzngs.search_releases(limit=limit, **criteria)
|
||||
res = musicbrainzngs.search_releases(
|
||||
limit=config['musicbrainz']['searchlimit'].get(int), **criteria)
|
||||
except musicbrainzngs.MusicBrainzError as exc:
|
||||
raise MusicBrainzAPIError(exc, 'release search', criteria,
|
||||
traceback.format_exc())
|
||||
|
|
@ -336,7 +336,7 @@ def match_album(artist, album, tracks=None, limit=SEARCH_LIMIT):
|
|||
yield albuminfo
|
||||
|
||||
|
||||
def match_track(artist, title, limit=SEARCH_LIMIT):
|
||||
def match_track(artist, title):
|
||||
"""Searches for a single track and returns an iterable of TrackInfo
|
||||
objects. May raise a MusicBrainzAPIError.
|
||||
"""
|
||||
|
|
@ -349,7 +349,8 @@ def match_track(artist, title, limit=SEARCH_LIMIT):
|
|||
return
|
||||
|
||||
try:
|
||||
res = musicbrainzngs.search_recordings(limit=limit, **criteria)
|
||||
res = musicbrainzngs.search_recordings(
|
||||
limit=config['musicbrainz']['searchlimit'].get(int), **criteria)
|
||||
except musicbrainzngs.MusicBrainzError as exc:
|
||||
raise MusicBrainzAPIError(exc, 'recording search', criteria,
|
||||
traceback.format_exc())
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ musicbrainz:
|
|||
host: musicbrainz.org
|
||||
ratelimit: 1
|
||||
ratelimit_interval: 1.0
|
||||
searchlimit: 5
|
||||
|
||||
match:
|
||||
strong_rec_thresh: 0.04
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ Changelog
|
|||
Features:
|
||||
|
||||
* Stop on invalid queries instead of ignoring the invalid part.
|
||||
* A new :ref:`searchlimit` configuration option allows you to specify how many
|
||||
search results you wish to see when looking up releases at MusicBrainz
|
||||
during import. :bug:`1245`
|
||||
|
||||
Fixes:
|
||||
|
||||
|
|
|
|||
|
|
@ -480,6 +480,16 @@ to one request per second.
|
|||
.. _limited: http://musicbrainz.org/doc/XML_Web_Service/Rate_Limiting
|
||||
.. _MusicBrainz: http://musicbrainz.org/
|
||||
|
||||
.. _searchlimit:
|
||||
|
||||
searchlimit
|
||||
~~~~~~~~~~~
|
||||
|
||||
The number of matches returned when sending search queries to the
|
||||
MusicBrainz server.
|
||||
|
||||
Default: ``5``.
|
||||
|
||||
.. _match-config:
|
||||
|
||||
Autotagger Matching Options
|
||||
|
|
|
|||
Loading…
Reference in a new issue