From 7ec93d6049cb40c2c83fe2868b56458c7e2c8620 Mon Sep 17 00:00:00 2001 From: David Logie Date: Thu, 1 Jun 2023 22:31:14 +0100 Subject: [PATCH] Store the release group's title. beets does not currently store the "canonical" release group title, only each release's title and disambiguation. Oddly, beets does store the release group disambiguation. Without this there is no way to determine a release group's title without separately querying a data source. --- beets/autotag/hooks.py | 2 ++ beets/autotag/mb.py | 3 +++ beets/library.py | 2 ++ docs/changelog.rst | 2 ++ 4 files changed, 9 insertions(+) diff --git a/beets/autotag/hooks.py b/beets/autotag/hooks.py index af5ddc42d..5aa23d8a7 100644 --- a/beets/autotag/hooks.py +++ b/beets/autotag/hooks.py @@ -84,6 +84,7 @@ class AlbumInfo(AttrDict): mediums: Optional[int] = None, artist_sort: Optional[str] = None, releasegroup_id: Optional[str] = None, + release_group_title: Optional[str] = None, catalognum: Optional[str] = None, script: Optional[str] = None, language: Optional[str] = None, @@ -120,6 +121,7 @@ class AlbumInfo(AttrDict): self.mediums = mediums self.artist_sort = artist_sort self.releasegroup_id = releasegroup_id + self.release_group_title = release_group_title self.catalognum = catalognum self.script = script self.language = language diff --git a/beets/autotag/mb.py b/beets/autotag/mb.py index 025c39d96..7eecb1db0 100644 --- a/beets/autotag/mb.py +++ b/beets/autotag/mb.py @@ -445,6 +445,9 @@ def album_info(release: Dict) -> beets.autotag.hooks.AlbumInfo: info.releasegroup_id = release['release-group']['id'] info.albumstatus = release.get('status') + if release['release-group'].get('title'): + info.release_group_title = release['release-group'].get('title') + # Get the disambiguation strings at the release and release group level. if release['release-group'].get('disambiguation'): info.releasegroupdisambig = \ diff --git a/beets/library.py b/beets/library.py index b52d5f873..836396eb3 100644 --- a/beets/library.py +++ b/beets/library.py @@ -526,6 +526,7 @@ class Item(LibModel): 'acoustid_fingerprint': types.STRING, 'acoustid_id': types.STRING, 'mb_releasegroupid': types.STRING, + 'release_group_title': types.STRING, 'asin': types.STRING, 'isrc': types.STRING, 'catalognum': types.STRING, @@ -1086,6 +1087,7 @@ class Album(LibModel): 'albumtypes': types.SEMICOLON_SPACE_DSV, 'label': types.STRING, 'mb_releasegroupid': types.STRING, + 'release_group_title': types.STRING, 'asin': types.STRING, 'catalognum': types.STRING, 'script': types.STRING, diff --git a/docs/changelog.rst b/docs/changelog.rst index 05b450019..2c9519c07 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -88,6 +88,8 @@ New features: * :doc:`/plugins/convert`: Add support for generating m3u8 playlists together with converted media files. :bug:`4373` +* Fetch the ``release_group_title`` field from MusicBrainz. + :bug: `4809` Bug fixes: