diff --git a/beetsplug/musicbrainz.py b/beetsplug/musicbrainz.py index 3b49107ad..57656b956 100644 --- a/beetsplug/musicbrainz.py +++ b/beetsplug/musicbrainz.py @@ -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: diff --git a/docs/changelog.rst b/docs/changelog.rst index e6821327e..1225f4f9f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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 diff --git a/docs/plugins/musicbrainz.rst b/docs/plugins/musicbrainz.rst index 00c553d8b..ac6d7a7d6 100644 --- a/docs/plugins/musicbrainz.rst +++ b/docs/plugins/musicbrainz.rst @@ -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