This commit is contained in:
Andrew Rogl 2021-09-26 15:37:56 +10:00
parent f04059bfee
commit 463ad55ce9
3 changed files with 23 additions and 8 deletions

View file

@ -25,6 +25,7 @@ import beets.autotag.hooks
import beets
from beets import util
from beets import config
from collections import Counter
from urllib.parse import urljoin
VARIOUS_ARTISTS_ID = '89ad4ac3-39f7-470e-963a-56509c546377'
@ -454,9 +455,17 @@ def album_info(release):
first_medium = release['medium-list'][0]
info.media = first_medium.get('format')
genres = release.get('genre-list')
if config['musicbrainz']['genres'] and genres:
info.genre = ';'.join(g['name'] for g in genres)
if config['musicbrainz']['genres']:
sources = [
release['release-group'].get('genre-list', []),
release.get('genre-list', []),
]
genres = Counter()
for source in sources:
for genreitem in source:
genres[genreitem['name']] += int(genreitem['count'])
info.genre = '; '.join(g[0] for g in sorted(genres.items(),
key=lambda g: -g[1]))
extra_albumdatas = plugins.send('mb_album_extract', data=release)
for extra_albumdata in extra_albumdatas:

View file

@ -9,11 +9,17 @@ This release now requires Python 3.6 or later (it removes support for Python
For packagers:
+* We fixed a flaky test, named `test_album_art` in the `test_zero.py` file,
* We fixed a flaky test, named `test_album_art` in the `test_zero.py` file,
that some distributions had disabled. Disabling this test should no longer
be necessary.
:bug:`4037` :bug:`4038`
Major new features:
* Include the genre tags from the release group when the musicbrainz genre
option is set, and sort them by the number of votes. Thanks to
:user:`aereaux`.
1.5.0 (August 19, 2021)
-----------------------

View file

@ -753,10 +753,10 @@ Default: ``[]``
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.
Use MusicBrainz genre tags to populate (and replace if it's already set) the
``genre`` tag. This will make it a list of all the genres tagged for the
release and the release-group on MusicBrainz, separated by "; " and sorted by
the total number of votes.
Default: ``no``
.. _match-config: