From a79b239d4ffd4e4d005d8ad99c0624adecebdaee Mon Sep 17 00:00:00 2001 From: Aidan Epstein Date: Thu, 29 Oct 2020 07:47:44 -0700 Subject: [PATCH 1/3] Add musicbrainz genre config option. --- beets/autotag/mb.py | 2 +- beets/config_default.yaml | 1 + docs/changelog.rst | 6 ++++-- docs/reference/config.rst | 8 ++++++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/beets/autotag/mb.py b/beets/autotag/mb.py index 211f4c42f..7952c5566 100644 --- a/beets/autotag/mb.py +++ b/beets/autotag/mb.py @@ -418,7 +418,7 @@ def album_info(release): info.media = first_medium.get('format') genres = release.get('genre-list') - if genres: + if config['musicbrainz']['genres'] and genres: info.genre = ';'.join(g['name'] for g in genres) info.decode() diff --git a/beets/config_default.yaml b/beets/config_default.yaml index c75778b80..f3e9acad1 100644 --- a/beets/config_default.yaml +++ b/beets/config_default.yaml @@ -105,6 +105,7 @@ musicbrainz: ratelimit_interval: 1.0 searchlimit: 5 extra_tags: [] + genres: no match: strong_rec_thresh: 0.04 diff --git a/docs/changelog.rst b/docs/changelog.rst index a31c6869b..2f12015a8 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -159,9 +159,11 @@ New features: * :doc:`/plugins/web`: add DELETE and PATCH methods for modifying items * :doc:`/plugins/lyrics`: Removed LyricWiki source (shut down on 21/09/2020). * Added a ``--plugins`` (or ``-p``) flag to specify a list of plugins at startup. -* Use musicbrainz genre tag api to get genre information. This currently +* Use the musicbrainz genre tag api to get genre information. This currently depends on functionality that is currently unreleased in musicbrainzngs. - See https://github.com/alastair/python-musicbrainzngs/pull/247 and + Once the functionality has been released, you can enable it with the + ``use_mb_genres`` option. See + https://github.com/alastair/python-musicbrainzngs/pull/247 and https://github.com/alastair/python-musicbrainzngs/pull/266 . Thanks to :user:`aereaux`. diff --git a/docs/reference/config.rst b/docs/reference/config.rst index 2f8cee3c9..021c3d2b7 100644 --- a/docs/reference/config.rst +++ b/docs/reference/config.rst @@ -356,6 +356,14 @@ Sets the albumartist for various-artist compilations. Defaults to ``'Various Artists'`` (the MusicBrainz standard). Affects other sources, such as :doc:`/plugins/discogs`, too. +.. _use_mb_genres: + +use_mb_genres +~~~~~~~~~~~~~ + +Use Musicbrainz genre tags to populate the ``genre`` tag. This will make it a +semicolon-separated list of all the genres tagged for the release on +musicbrainz. UI Options ---------- From 0a8c755a6bce46df234ff2bb1c7b26c8d11a75f1 Mon Sep 17 00:00:00 2001 From: Aidan Epstein Date: Fri, 30 Oct 2020 14:36:28 +0000 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Adrian Sampson --- docs/reference/config.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/config.rst b/docs/reference/config.rst index 021c3d2b7..57c03cf8e 100644 --- a/docs/reference/config.rst +++ b/docs/reference/config.rst @@ -361,9 +361,9 @@ Artists'`` (the MusicBrainz standard). Affects other sources, such as use_mb_genres ~~~~~~~~~~~~~ -Use Musicbrainz genre tags to populate the ``genre`` tag. This will make it a +Use MusicBrainz genre tags to populate the ``genre`` tag. This will make it a semicolon-separated list of all the genres tagged for the release on -musicbrainz. +MusicBrainz. UI Options ---------- From ceb046d60cc53ce7d11dd72b7f6cd7310de0daff Mon Sep 17 00:00:00 2001 From: Aidan Epstein Date: Thu, 29 Oct 2020 07:47:44 -0700 Subject: [PATCH 3/3] Add musicbrainz genre config option. --- docs/changelog.rst | 2 +- docs/reference/config.rst | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 2f12015a8..458e4b8d2 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -162,7 +162,7 @@ New features: * Use the musicbrainz genre tag api to get genre information. This currently depends on functionality that is currently unreleased in musicbrainzngs. Once the functionality has been released, you can enable it with the - ``use_mb_genres`` option. See + ``genres`` option inside the ``musicbrainz`` config. See https://github.com/alastair/python-musicbrainzngs/pull/247 and https://github.com/alastair/python-musicbrainzngs/pull/266 . Thanks to :user:`aereaux`. diff --git a/docs/reference/config.rst b/docs/reference/config.rst index 57c03cf8e..6aa9f5f53 100644 --- a/docs/reference/config.rst +++ b/docs/reference/config.rst @@ -356,15 +356,6 @@ Sets the albumartist for various-artist compilations. Defaults to ``'Various Artists'`` (the MusicBrainz standard). Affects other sources, such as :doc:`/plugins/discogs`, too. -.. _use_mb_genres: - -use_mb_genres -~~~~~~~~~~~~~ - -Use MusicBrainz genre tags to populate the ``genre`` tag. This will make it a -semicolon-separated list of all the genres tagged for the release on -MusicBrainz. - UI Options ---------- @@ -729,6 +720,17 @@ above example. Default: ``[]`` +.. _genres: + +genres +~~~~~~ + +Use MusicBrainz genre tags to populate the ``genre`` tag. This will make it a +semicolon-separated list of all the genres tagged for the release on +MusicBrainz. + +Default: ``no`` + .. _match-config: Autotagger Matching Options