- Add configurable `search_limit` option to Deezer and Spotify plugins
(default 5) and enforce it when returning search results.
- Rename `musicbrainz.searchlimit` to `musicbrainz.search_limit` (old
key still read with deprecation warning; slated for removal in 3.0.0).
- Update docs and changelog to reflect the changes.
This PR modernizes the codebase by replacing all `str.format()` calls,
`%` operator, and most of string concatenation with f-string literals.
Fixes#5293
Supersedes #5337
Once this is reviewed, I will squash all commits into one and add the
hash to `.git-blame-ignore-revs` file.
Moved the `_construct_search_query` method that was duplicated in the
spotify and deezer plugins into the (new) shared helper baseclass (
`SearchApiMetadataSourcePlugin`).
By default deezer now also does not ascii encode a query when it is send
but the legacy behaviour can be restored using the
`deezer.search_query_ascii` option.
closes#5860
In the documentation of the Discogs plugin the ``index_tracks``
configuration option does not include the detail about the default
configuration that is applied when the option is not explicitly managed
in the configuration file.
If this PR is approved, the documentation will include that default ;)
Fixes#5930.
- Removed whitelist check immediately after last.fm fetch, which fixes
canonicalization - also unwanted genres need to remain at this point to
get successfully resolved "up" to parent genres
- Removed the `_filter_valid_genres()` helper method and went back to
_inline_ list comprehensions (readability)
- Ensured bug #5649 does not regress (the part were a resolve would kick
out everything and no fallback happens) by running a full
`_resolve_genre()` in each stage - if no genres remain in a stage the
next one is hit.
- Refactored `_get_genre` using a local helper method and returning
immediately on a satisfying outcome (Commits
d28738d92f
and
bb516a3a9c)
- Three new `test_get_genre` cases proof canonicalization works properly
Unrelated tiny fixes along the way:
- Clarified `--keep-existing` option docs
- Ensured list return type in `_last_lookup()`
To ensure proper fallback to the next stage, in each stage we do a full
combine/resolve/log.
Also we directly return if have satisfied results. As a bonus this
improves readability.
Some duplicate code on the label magic though...
- Remove "early whitelist check", since it breaks canonicalization of
actually unwanted genres (not whitelisted) resolving "up" to parent
genres.
- Remove the filter_valid_genres method entirely and get back to inline
list comprehensions. The caveat is that None genres are not catched
that way (see below, should be one of the last functions that finally
returns lists only)
- Along the way, fix _last_lookup's rearly return to empty list instead
of None.
- Test non-whitelisted genres resolving "up" in the tree.
- Test whitelisted original and whitelisted new genre resolving "up"
- Test non-whitelisted original genre resolving "up" (and deduplication
works)