mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 00:24:25 +01:00
Allow selecting either tags or genres in the includes, defaulting to genres
Genres is a filtered list based on what musicbrainz considers a genre, tags are all the user-submitted tags. [1] 1. https://musicbrainz.org/doc/MusicBrainz_API#:~:text=Since%20genres%20are,!). Also apply suggestions from code review Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
This commit is contained in:
parent
f3da80e512
commit
9e7d5debdc
3 changed files with 17 additions and 2 deletions
|
|
@ -90,6 +90,7 @@ RELEASE_INCLUDES = list(
|
|||
"isrcs",
|
||||
"url-rels",
|
||||
"release-rels",
|
||||
"genres",
|
||||
"tags",
|
||||
}
|
||||
& set(musicbrainzngs.VALID_INCLUDES["release"])
|
||||
|
|
@ -370,6 +371,10 @@ def _merge_pseudo_and_actual_album(
|
|||
|
||||
|
||||
class MusicBrainzPlugin(MetadataSourcePlugin):
|
||||
@cached_property
|
||||
def genres_field(self) -> str:
|
||||
return f"{config['musicbrainz']['genres_tag'].get()}-list"
|
||||
|
||||
def __init__(self):
|
||||
"""Set up the python-musicbrainz-ngs module according to settings
|
||||
from the beets configuration. This should be called at startup.
|
||||
|
|
@ -382,6 +387,7 @@ class MusicBrainzPlugin(MetadataSourcePlugin):
|
|||
"ratelimit": 1,
|
||||
"ratelimit_interval": 1,
|
||||
"genres": False,
|
||||
"genres_tag": "genre",
|
||||
"external_ids": {
|
||||
"discogs": False,
|
||||
"bandcamp": False,
|
||||
|
|
@ -723,8 +729,8 @@ class MusicBrainzPlugin(MetadataSourcePlugin):
|
|||
|
||||
if self.config["genres"]:
|
||||
sources = [
|
||||
release["release-group"].get("tag-list", []),
|
||||
release.get("tag-list", []),
|
||||
release["release-group"].get(self.genres_field, []),
|
||||
release.get(self.genres_field, []),
|
||||
]
|
||||
genres: Counter[str] = Counter()
|
||||
for source in sources:
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ been dropped.
|
|||
New features:
|
||||
|
||||
- :doc:`plugins/ftintitle`: Added argument for custom feat. words in ftintitle.
|
||||
- :doc:`plugins/musicbrainz`: Allow selecting tags or genres to populate the
|
||||
genres tag.
|
||||
- :doc:`plugins/ftintitle`: Added argument to skip the processing of artist and
|
||||
album artist are the same in ftintitle.
|
||||
- :doc:`plugins/play`: Added `$playlist` marker to precisely edit the playlist
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ Default
|
|||
ratelimit_interval: 1.0
|
||||
extra_tags: []
|
||||
genres: no
|
||||
genres_tag: genre
|
||||
external_ids:
|
||||
discogs: no
|
||||
bandcamp: no
|
||||
|
|
@ -136,6 +137,12 @@ Default
|
|||
``beatport_album_id``, ``deezer_album_id``, ``tidal_album_id``). On re-imports
|
||||
existing data will be overwritten.
|
||||
|
||||
.. conf:: _genres_tag
|
||||
:default: genres
|
||||
|
||||
Either ``genres`` or ``tags``. Specify ``genres`` to use just musicbrainz genres and
|
||||
``tags`` to use all user-supplied musicbrainz tags.
|
||||
|
||||
.. include:: ./shared_metadata_source_config.rst
|
||||
|
||||
.. _building search indexes: https://musicbrainz.org/doc/Development/Search_server_setup
|
||||
|
|
|
|||
Loading…
Reference in a new issue