mirror of
https://github.com/beetbox/beets.git
synced 2026-02-09 00:41:57 +01:00
musicbrainz: fix release type (#6299)
- Update the MusicBrainz integration to read the release group's canonical `'primary-type'` field instead of the legacy `'type'` field when deriving `info.albumtype`. Noticed that `albumtype` was missing from the metadata when I did some imports in my library.
This commit is contained in:
commit
0cde654ffe
2 changed files with 3 additions and 7 deletions
|
|
@ -607,12 +607,8 @@ class MusicBrainzPlugin(MusicBrainzAPIMixin, MetadataSourcePlugin):
|
|||
if release.get("disambiguation"):
|
||||
info.albumdisambig = release.get("disambiguation")
|
||||
|
||||
# Get the "classic" Release type. This data comes from a legacy API
|
||||
# feature before MusicBrainz supported multiple release types.
|
||||
if "type" in release["release-group"]:
|
||||
reltype = release["release-group"]["type"]
|
||||
if reltype:
|
||||
info.albumtype = reltype.lower()
|
||||
if reltype := release["release-group"].get("primary-type"):
|
||||
info.albumtype = reltype.lower()
|
||||
|
||||
# Set the new-style "primary" and "secondary" release types.
|
||||
albumtypes = []
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class MBAlbumInfoTest(MusicBrainzTestCase):
|
|||
"asin": "ALBUM ASIN",
|
||||
"disambiguation": "R_DISAMBIGUATION",
|
||||
"release-group": {
|
||||
"type": "Album",
|
||||
"primary-type": "Album",
|
||||
"first-release-date": date_str,
|
||||
"id": "RELEASE GROUP ID",
|
||||
"disambiguation": "RG_DISAMBIGUATION",
|
||||
|
|
|
|||
Loading…
Reference in a new issue