From 8f514eb6ab961692b5fb104d5824b456b8247ad4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Nejus?= Date: Sat, 17 Jan 2026 16:41:44 +0000 Subject: [PATCH] Replace/fix Release.type with Release.primary-type --- beetsplug/musicbrainz.py | 8 ++------ test/plugins/test_musicbrainz.py | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/beetsplug/musicbrainz.py b/beetsplug/musicbrainz.py index 4257e52ef..aac20e9ac 100644 --- a/beetsplug/musicbrainz.py +++ b/beetsplug/musicbrainz.py @@ -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 = [] diff --git a/test/plugins/test_musicbrainz.py b/test/plugins/test_musicbrainz.py index 09127d169..069f1fb99 100644 --- a/test/plugins/test_musicbrainz.py +++ b/test/plugins/test_musicbrainz.py @@ -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",