mirror of
https://github.com/beetbox/beets.git
synced 2026-02-11 09:54:31 +01:00
musicbrainz: Rename searchlimit config option to search_limit
This commit is contained in:
parent
d00d51e0bf
commit
a674fd3095
3 changed files with 23 additions and 7 deletions
|
|
@ -18,12 +18,14 @@ from __future__ import annotations
|
|||
|
||||
import traceback
|
||||
from collections import Counter
|
||||
from contextlib import suppress
|
||||
from functools import cached_property
|
||||
from itertools import product
|
||||
from typing import TYPE_CHECKING, Any, Iterable, Sequence
|
||||
from urllib.parse import urljoin
|
||||
|
||||
import musicbrainzngs
|
||||
from confuse.exceptions import NotFoundError
|
||||
|
||||
import beets
|
||||
import beets.autotag.hooks
|
||||
|
|
@ -371,7 +373,7 @@ class MusicBrainzPlugin(MetadataSourcePlugin):
|
|||
"https": False,
|
||||
"ratelimit": 1,
|
||||
"ratelimit_interval": 1,
|
||||
"searchlimit": 5,
|
||||
"search_limit": 5,
|
||||
"genres": False,
|
||||
"external_ids": {
|
||||
"discogs": False,
|
||||
|
|
@ -383,6 +385,15 @@ class MusicBrainzPlugin(MetadataSourcePlugin):
|
|||
"extra_tags": [],
|
||||
},
|
||||
)
|
||||
# TODO: Remove in 3.0.0
|
||||
with suppress(NotFoundError):
|
||||
self.config["search_limit"] = self.config["match"][
|
||||
"searchlimit"
|
||||
].get()
|
||||
self._log.warning(
|
||||
"'musicbrainz.searchlimit' option is deprecated and will be "
|
||||
"removed in 3.0.0. Use 'musicbrainz.search_limit' instead."
|
||||
)
|
||||
hostname = self.config["host"].as_str()
|
||||
https = self.config["https"].get(bool)
|
||||
# Only call set_hostname when a custom server is configured. Since
|
||||
|
|
@ -799,7 +810,7 @@ class MusicBrainzPlugin(MetadataSourcePlugin):
|
|||
)
|
||||
try:
|
||||
method = getattr(musicbrainzngs, f"search_{query_type}s")
|
||||
res = method(limit=self.config["searchlimit"].get(int), **filters)
|
||||
res = method(limit=self.config["search_limit"].get(int), **filters)
|
||||
except musicbrainzngs.MusicBrainzError as exc:
|
||||
raise MusicBrainzAPIError(
|
||||
exc, f"{query_type} search", filters, traceback.format_exc()
|
||||
|
|
|
|||
|
|
@ -2554,7 +2554,7 @@ Major new features and bigger changes:
|
|||
analysis tool. Thanks to :user:`jmwatte`. :bug:`1343`
|
||||
- A new ``filesize`` field on items indicates the number of bytes in the file.
|
||||
:bug:`1291`
|
||||
- A new :ref:`searchlimit` configuration option allows you to specify how many
|
||||
- A new :ref:`search_limit` configuration option allows you to specify how many
|
||||
search results you wish to see when looking up releases at MusicBrainz during
|
||||
import. :bug:`1245`
|
||||
- The importer now records the data source for a match in a new flexible
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ Default
|
|||
https: no
|
||||
ratelimit: 1
|
||||
ratelimit_interval: 1.0
|
||||
searchlimit: 5
|
||||
search_limit: 5
|
||||
extra_tags: []
|
||||
genres: no
|
||||
external_ids:
|
||||
|
|
@ -82,16 +82,21 @@ make the import process quicker.
|
|||
|
||||
Default: ``yes``.
|
||||
|
||||
.. _searchlimit:
|
||||
.. _search_limit:
|
||||
|
||||
searchlimit
|
||||
+++++++++++
|
||||
search_limit
|
||||
++++++++++++
|
||||
|
||||
The number of matches returned when sending search queries to the MusicBrainz
|
||||
server.
|
||||
|
||||
Default: ``5``.
|
||||
|
||||
searchlimit
|
||||
+++++++++++
|
||||
|
||||
.. deprecated:: 2.4 Use `search_limit`_.
|
||||
|
||||
.. _extra_tags:
|
||||
|
||||
extra_tags
|
||||
|
|
|
|||
Loading…
Reference in a new issue