Skip to content

Commit

Permalink
Add genre support using musicbrainz tags.
Browse files Browse the repository at this point in the history
This requires this PR: alastair/python-musicbrainzngs#266
  • Loading branch information
aereaux committed Oct 28, 2020
1 parent 769e424 commit d70287d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions beets/autotag/mb.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ def get_message(self):
TRACK_INCLUDES = ['artists', 'aliases']
if 'work-level-rels' in musicbrainzngs.VALID_INCLUDES['recording']:
TRACK_INCLUDES += ['work-level-rels', 'artist-rels']
if 'genres' in musicbrainzngs.VALID_INCLUDES['recording']:
RELEASE_INCLUDES += ['genres']


def track_url(trackid):
Expand Down Expand Up @@ -415,6 +417,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

Expand Down
5 changes: 5 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +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
depends on functionality that is currently unreleased in musicbrainzngs.
See https://github.com/alastair/python-musicbrainzngs/pull/247 and
https://github.com/alastair/python-musicbrainzngs/pull/266 .
Thanks to :user:`aereaux`.

Fixes:

Expand Down

0 comments on commit d70287d

Please sign in to comment.