From 88fc2bdff97c0694a752002d610b2f77ca935236 Mon Sep 17 00:00:00 2001 From: Edgars Supe Date: Wed, 8 Sep 2021 10:45:31 +0300 Subject: [PATCH 1/5] Add `albumtypes` to Album schema --- beets/library.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/beets/library.py b/beets/library.py index 54ff7eae9..302c8d37a 100644 --- a/beets/library.py +++ b/beets/library.py @@ -1042,6 +1042,7 @@ class Album(LibModel): 'mb_albumid': types.STRING, 'mb_albumartistid': types.STRING, 'albumtype': types.STRING, + 'albumtypes': types.STRING, 'label': types.STRING, 'mb_releasegroupid': types.STRING, 'asin': types.STRING, @@ -1091,6 +1092,7 @@ class Album(LibModel): 'mb_albumid', 'mb_albumartistid', 'albumtype', + 'albumtypes', 'label', 'mb_releasegroupid', 'asin', From a04850a5369c181e972e31ddb68d65c0d78b9038 Mon Sep 17 00:00:00 2001 From: Edgars Supe Date: Wed, 8 Sep 2021 10:46:14 +0300 Subject: [PATCH 2/5] Add `albumtypes` to AlbumInfo --- beets/autotag/mb.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/beets/autotag/mb.py b/beets/autotag/mb.py index 122723db5..0dc450d69 100644 --- a/beets/autotag/mb.py +++ b/beets/autotag/mb.py @@ -417,18 +417,17 @@ def album_info(release): if reltype: info.albumtype = reltype.lower() - # Log the new-style "primary" and "secondary" release types. - # Eventually, we'd like to actually store this data, but we just log - # it for now to help understand the differences. + # Set the new-style "primary" and "secondary" release types. + albumtypes = [] if 'primary-type' in release['release-group']: rel_primarytype = release['release-group']['primary-type'] if rel_primarytype: - log.debug('primary MB release type: ' + rel_primarytype.lower()) + albumtypes.append(rel_primarytype.lower()) if 'secondary-type-list' in release['release-group']: if release['release-group']['secondary-type-list']: - log.debug('secondary MB release type(s): ' + ', '.join( - [secondarytype.lower() for secondarytype in - release['release-group']['secondary-type-list']])) + for sec_type in release['release-group']['secondary-type-list']: + albumtypes.append(sec_type.lower()) + info.albumtypes = ','.join(albumtypes) # Release events. info.country, release_date = _preferred_release_event(release) From 1bd53ad2aa60c3d05bfb12aaca824a07e3fadb49 Mon Sep 17 00:00:00 2001 From: Edgars Supe Date: Thu, 9 Sep 2021 10:36:38 +0300 Subject: [PATCH 3/5] Add `albumtypes` to Item schema --- beets/library.py | 1 + 1 file changed, 1 insertion(+) diff --git a/beets/library.py b/beets/library.py index 302c8d37a..4e8eed001 100644 --- a/beets/library.py +++ b/beets/library.py @@ -494,6 +494,7 @@ class Item(LibModel): 'mb_releasetrackid': types.STRING, 'trackdisambig': types.STRING, 'albumtype': types.STRING, + 'albumtypes': types.STRING, 'label': types.STRING, 'acoustid_fingerprint': types.STRING, 'acoustid_id': types.STRING, From 700c505560b8ea34d7572b0d0b54ad6afe2b00f3 Mon Sep 17 00:00:00 2001 From: Edgars Supe Date: Thu, 9 Sep 2021 15:40:48 +0300 Subject: [PATCH 4/5] Delimit album types with '; ' --- beets/autotag/mb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beets/autotag/mb.py b/beets/autotag/mb.py index 0dc450d69..a70c74834 100644 --- a/beets/autotag/mb.py +++ b/beets/autotag/mb.py @@ -427,7 +427,7 @@ def album_info(release): if release['release-group']['secondary-type-list']: for sec_type in release['release-group']['secondary-type-list']: albumtypes.append(sec_type.lower()) - info.albumtypes = ','.join(albumtypes) + info.albumtypes = '; '.join(albumtypes) # Release events. info.country, release_date = _preferred_release_event(release) From a5c6ed7867ae02b120352cbca2c4d9c4af902ed0 Mon Sep 17 00:00:00 2001 From: Edgars Supe Date: Thu, 9 Sep 2021 15:52:37 +0300 Subject: [PATCH 5/5] Add info about albumtypes to changelog --- docs/changelog.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index c02fe455c..85625011f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -20,6 +20,10 @@ Major new features: option is set, and sort them by the number of votes. Thanks to :user:`aereaux`. +* Primary and secondary release types from MusicBrainz are now stored in + ``albumtypes`` field. Thanks to :user:`edgars-supe`. + :bug:`2200` + 1.5.0 (August 19, 2021) -----------------------