Skip to content

Commit 072e1df

Browse files
authored
Merge pull request #3781 from aereaux/add_genres
Add genre support using musicbrainz tags.
2 parents be0003a + d011a4e commit 072e1df

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

beets/autotag/mb.py

+6
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ def get_message(self):
7474
TRACK_INCLUDES = ['artists', 'aliases']
7575
if 'work-level-rels' in musicbrainzngs.VALID_INCLUDES['recording']:
7676
TRACK_INCLUDES += ['work-level-rels', 'artist-rels']
77+
if 'genres' in musicbrainzngs.VALID_INCLUDES['recording']:
78+
RELEASE_INCLUDES += ['genres']
7779

7880

7981
def track_url(trackid):
@@ -415,6 +417,10 @@ def album_info(release):
415417
first_medium = release['medium-list'][0]
416418
info.media = first_medium.get('format')
417419

420+
genres = release.get('genre-list')
421+
if genres:
422+
info.genre = ';'.join(g['name'] for g in genres)
423+
418424
info.decode()
419425
return info
420426

docs/changelog.rst

+5
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ New features:
159159
* :doc:`/plugins/web`: add DELETE and PATCH methods for modifying items
160160
* :doc:`/plugins/lyrics`: Removed LyricWiki source (shut down on 21/09/2020).
161161
* Added a ``--plugins`` (or ``-p``) flag to specify a list of plugins at startup.
162+
* Use musicbrainz genre tag api to get genre information. This currently
163+
depends on functionality that is currently unreleased in musicbrainzngs.
164+
See https://github.com/alastair/python-musicbrainzngs/pull/247 and
165+
https://github.com/alastair/python-musicbrainzngs/pull/266 .
166+
Thanks to :user:`aereaux`.
162167

163168
Fixes:
164169

0 commit comments

Comments
 (0)