From 752fb5e2640bbdea6506f95bfe5d1908a2e23303 Mon Sep 17 00:00:00 2001 From: Aidan Epstein Date: Fri, 23 Oct 2020 15:29:29 -0700 Subject: [PATCH] Add genre support using musicbrainz tags. --- beets/autotag/mb.py | 5 ++++- docs/changelog.rst | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/beets/autotag/mb.py b/beets/autotag/mb.py index ea8ef24da7..ee32a01413 100644 --- a/beets/autotag/mb.py +++ b/beets/autotag/mb.py @@ -70,7 +70,7 @@ def get_message(self): RELEASE_INCLUDES = ['artists', 'media', 'recordings', 'release-groups', 'labels', 'artist-credits', 'aliases', 'recording-level-rels', 'work-rels', - 'work-level-rels', 'artist-rels'] + 'work-level-rels', 'artist-rels', 'genres'] TRACK_INCLUDES = ['artists', 'aliases'] if 'work-level-rels' in musicbrainzngs.VALID_INCLUDES['recording']: TRACK_INCLUDES += ['work-level-rels', 'artist-rels'] @@ -415,6 +415,9 @@ def album_info(release): first_medium = release['medium-list'][0] info.media = first_medium.get('format') + if release.get('genre-list'): + info.genre = ';'.join(g['name'] for g in release['genre-list']) + info.decode() return info diff --git a/docs/changelog.rst b/docs/changelog.rst index e65e6b1e91..ab0a7784ac 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -159,6 +159,8 @@ 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. + Thanks to :user:`aereaux`. Fixes: