From 5caf083c67d7b3f11039d683b89a03db1a2b18ac Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Sat, 17 Jun 2023 18:01:14 -0700 Subject: [PATCH 1/5] multi-tags for artists + albumartists sort and credits' --- mediafile.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/mediafile.py b/mediafile.py index 4f763a0..78c6a0c 100644 --- a/mediafile.py +++ b/mediafile.py @@ -2101,12 +2101,36 @@ def as_dict(self): StorageStyle('ARTIST_CREDIT'), ASFStorageStyle('beets/Artist Credit'), ) + artists_credits = ListMediaField( + MP3ListDescStorageStyle(u'Artists Credits'), + MP4ListStorageStyle('----:com.apple.iTunes:Artists Credits'), + ListStorageStyle('ARTISTS_CREDITS'), + ASFStorageStyle('beets/Artists Credits'), + ) + artists_sort = ListMediaField( + MP3ListDescStorageStyle(u'Artists Sort'), + MP4ListStorageStyle('----:com.apple.iTunes:Artists Sort'), + ListStorageStyle('ARTISTS_SORT'), + ASFStorageStyle('beets/Artists Sort'), + ) albumartist_credit = MediaField( MP3DescStorageStyle(u'Album Artist Credit'), MP4StorageStyle('----:com.apple.iTunes:Album Artist Credit'), StorageStyle('ALBUMARTIST_CREDIT'), ASFStorageStyle('beets/Album Artist Credit'), ) + albumartists_credits = ListMediaField( + MP3ListDescStorageStyle(u'Album Artists Credits'), + MP4ListStorageStyle('----:com.apple.iTunes:Album Artists Credits'), + ListStorageStyle('ALBUMARTISTS_CREDITS'), + ASFStorageStyle('beets/Album Artists Credits'), + ) + albumartists_sort = ListMediaField( + MP3ListDescStorageStyle(u'Album Artists Sort'), + MP4ListStorageStyle('----:com.apple.iTunes:Album Artists Sort'), + ListStorageStyle('ALBUMARTISTS_SORT'), + ASFStorageStyle('beets/Album Artists Sort'), + ) # Legacy album art field art = CoverArtField() From b6b8623f2cbdebfda56bc4ccb95f7325f8430a19 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Sat, 17 Jun 2023 18:11:33 -0700 Subject: [PATCH 2/5] test --- test/test_mediafile.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/test_mediafile.py b/test/test_mediafile.py index fa474bd..81b5a4a 100644 --- a/test/test_mediafile.py +++ b/test/test_mediafile.py @@ -715,7 +715,10 @@ def _generate_tags(self, base=None): for key in ['disc', 'disctotal', 'track', 'tracktotal', 'bpm']: tags[key] = 1 - for key in ['artists', 'albumartists']: + for key in [ + 'artists', 'albumartists', 'artists_credits', + 'albumartists_credits', 'artists_sort', 'albumartists_sort' + ]: tags[key] = ['multival', 'test'] tags['art'] = self.jpg_data @@ -1110,7 +1113,8 @@ def test_known_fields(self): fields.extend( ('encoder', 'images', 'genres', 'albumtype', 'artists', 'albumartists', 'url', 'mb_artistids', 'mb_albumartistids', - 'albumtypes', 'catalognums', 'languages') + 'albumtypes', 'catalognums', 'languages', 'artists_credits', + 'artists_sort', 'albumartists_credits', 'albumartists_sort') ) assertCountEqual(self, MediaFile.fields(), fields) From 2e382a832e3ab398e480aa2625fd636026926510 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Sat, 17 Jun 2023 18:19:37 -0700 Subject: [PATCH 3/5] more descs --- mediafile.py | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/mediafile.py b/mediafile.py index 78c6a0c..0bf5d6a 100644 --- a/mediafile.py +++ b/mediafile.py @@ -2102,15 +2102,31 @@ def as_dict(self): ASFStorageStyle('beets/Artist Credit'), ) artists_credits = ListMediaField( - MP3ListDescStorageStyle(u'Artists Credits'), - MP4ListStorageStyle('----:com.apple.iTunes:Artists Credits'), + MP3ListDescStorageStyle(desc=u'ARTISTSCREDITS'), + MP3ListDescStorageStyle(desc=u'ARTISTS_CREDITS'), + MP3ListDescStorageStyle(desc=u'ARTISTS CREDITS', read_only=True), + MP4ListStorageStyle('----:com.apple.iTunes:ARTISTSCREDITS'), + MP4ListStorageStyle('----:com.apple.iTunes:ARTISTS_CREDITS'), + MP4ListStorageStyle( + '----:com.apple.iTunes:ARTISTS CREDITS', read_only=True + ), + ListStorageStyle('ARTISTSCREDITS'), ListStorageStyle('ARTISTS_CREDITS'), + ListStorageStyle('ARTISTS CREDITS', read_only=True), ASFStorageStyle('beets/Artists Credits'), ) artists_sort = ListMediaField( - MP3ListDescStorageStyle(u'Artists Sort'), - MP4ListStorageStyle('----:com.apple.iTunes:Artists Sort'), + MP3ListDescStorageStyle(desc=u'ARTISTSSORT'), + MP3ListDescStorageStyle(desc=u'ARTISTS_SORT'), + MP3ListDescStorageStyle(desc=u'ARTISTS SORT', read_only=True), + MP4ListStorageStyle('----:com.apple.iTunes:ARTISTSSORT'), + MP4ListStorageStyle('----:com.apple.iTunes:ARTISTS_SORT'), + MP4ListStorageStyle( + '----:com.apple.iTunes:ARTISTS SORT', read_only=True + ), + ListStorageStyle('ARTISTSSORT'), ListStorageStyle('ARTISTS_SORT'), + ListStorageStyle('ARTISTS SORT', read_only=True), ASFStorageStyle('beets/Artists Sort'), ) albumartist_credit = MediaField( @@ -2120,15 +2136,31 @@ def as_dict(self): ASFStorageStyle('beets/Album Artist Credit'), ) albumartists_credits = ListMediaField( - MP3ListDescStorageStyle(u'Album Artists Credits'), - MP4ListStorageStyle('----:com.apple.iTunes:Album Artists Credits'), + MP3ListDescStorageStyle(desc=u'ALBUMARTISTSCREDITS'), + MP3ListDescStorageStyle(desc=u'ALBUMARTISTS_CREDITS'), + MP3ListDescStorageStyle(desc=u'ALBUMARTISTS CREDITS', read_only=True), + MP4ListStorageStyle('----:com.apple.iTunes:ALBUMARTISTSCREDITS'), + MP4ListStorageStyle('----:com.apple.iTunes:ALBUMARTISTS_CREDITS'), + MP4ListStorageStyle( + '----:com.apple.iTunes:ALBUMARTISTS CREDITS', read_only=True + ), + ListStorageStyle('ALBUMARTISTSCREDITS'), ListStorageStyle('ALBUMARTISTS_CREDITS'), + ListStorageStyle('ALBUMARTISTS CREDITS', read_only=True), ASFStorageStyle('beets/Album Artists Credits'), ) albumartists_sort = ListMediaField( - MP3ListDescStorageStyle(u'Album Artists Sort'), - MP4ListStorageStyle('----:com.apple.iTunes:Album Artists Sort'), + MP3ListDescStorageStyle(desc=u'ALBUMARTISTSSORT'), + MP3ListDescStorageStyle(desc=u'ALBUMARTISTS_SORT'), + MP3ListDescStorageStyle(desc=u'ALBUMARTISTS SORT', read_only=True), + MP4ListStorageStyle('----:com.apple.iTunes:ALBUMARTISTSSORT'), + MP4ListStorageStyle('----:com.apple.iTunes:ALBUMARTISTS_SORT'), + MP4ListStorageStyle( + '----:com.apple.iTunes:ALBUMARTISTS SORT', read_only=True + ), + ListStorageStyle('ALBUMARTISTSSORT'), ListStorageStyle('ALBUMARTISTS_SORT'), + ListStorageStyle('ALBUMARTISTS SORT', read_only=True), ASFStorageStyle('beets/Album Artists Sort'), ) From 37cb43ad390ee836ffd70058981ed2e18f88d839 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Mon, 26 Jun 2023 19:34:10 -0700 Subject: [PATCH 4/5] album/artists_credit --- mediafile.py | 56 +++++++++--------------------------------- test/test_mediafile.py | 8 +++--- 2 files changed, 16 insertions(+), 48 deletions(-) diff --git a/mediafile.py b/mediafile.py index 0bf5d6a..a5ec5e5 100644 --- a/mediafile.py +++ b/mediafile.py @@ -2101,33 +2101,17 @@ def as_dict(self): StorageStyle('ARTIST_CREDIT'), ASFStorageStyle('beets/Artist Credit'), ) - artists_credits = ListMediaField( - MP3ListDescStorageStyle(desc=u'ARTISTSCREDITS'), - MP3ListDescStorageStyle(desc=u'ARTISTS_CREDITS'), - MP3ListDescStorageStyle(desc=u'ARTISTS CREDITS', read_only=True), - MP4ListStorageStyle('----:com.apple.iTunes:ARTISTSCREDITS'), - MP4ListStorageStyle('----:com.apple.iTunes:ARTISTS_CREDITS'), - MP4ListStorageStyle( - '----:com.apple.iTunes:ARTISTS CREDITS', read_only=True - ), - ListStorageStyle('ARTISTSCREDITS'), - ListStorageStyle('ARTISTS_CREDITS'), - ListStorageStyle('ARTISTS CREDITS', read_only=True), - ASFStorageStyle('beets/Artists Credits'), + artists_credit = ListMediaField( + MP3ListDescStorageStyle(desc=u'ARTISTS_CREDIT'), + MP4ListStorageStyle('----:com.apple.iTunes:ARTISTS_CREDIT'), + ListStorageStyle('ARTISTS_CREDIT'), + ASFStorageStyle('beets/ArtistsCredit'), ) artists_sort = ListMediaField( - MP3ListDescStorageStyle(desc=u'ARTISTSSORT'), MP3ListDescStorageStyle(desc=u'ARTISTS_SORT'), - MP3ListDescStorageStyle(desc=u'ARTISTS SORT', read_only=True), - MP4ListStorageStyle('----:com.apple.iTunes:ARTISTSSORT'), MP4ListStorageStyle('----:com.apple.iTunes:ARTISTS_SORT'), - MP4ListStorageStyle( - '----:com.apple.iTunes:ARTISTS SORT', read_only=True - ), - ListStorageStyle('ARTISTSSORT'), ListStorageStyle('ARTISTS_SORT'), - ListStorageStyle('ARTISTS SORT', read_only=True), - ASFStorageStyle('beets/Artists Sort'), + ASFStorageStyle('beets/ArtistsSort'), ) albumartist_credit = MediaField( MP3DescStorageStyle(u'Album Artist Credit'), @@ -2135,33 +2119,17 @@ def as_dict(self): StorageStyle('ALBUMARTIST_CREDIT'), ASFStorageStyle('beets/Album Artist Credit'), ) - albumartists_credits = ListMediaField( - MP3ListDescStorageStyle(desc=u'ALBUMARTISTSCREDITS'), - MP3ListDescStorageStyle(desc=u'ALBUMARTISTS_CREDITS'), - MP3ListDescStorageStyle(desc=u'ALBUMARTISTS CREDITS', read_only=True), - MP4ListStorageStyle('----:com.apple.iTunes:ALBUMARTISTSCREDITS'), - MP4ListStorageStyle('----:com.apple.iTunes:ALBUMARTISTS_CREDITS'), - MP4ListStorageStyle( - '----:com.apple.iTunes:ALBUMARTISTS CREDITS', read_only=True - ), - ListStorageStyle('ALBUMARTISTSCREDITS'), - ListStorageStyle('ALBUMARTISTS_CREDITS'), - ListStorageStyle('ALBUMARTISTS CREDITS', read_only=True), - ASFStorageStyle('beets/Album Artists Credits'), + albumartists_credit = ListMediaField( + MP3ListDescStorageStyle(desc=u'ALBUMARTISTS_CREDIT'), + MP4ListStorageStyle('----:com.apple.iTunes:ALBUMARTISTS_CREDIT'), + ListStorageStyle('ALBUMARTISTS_CREDIT'), + ASFStorageStyle('beets/AlbumArtistsCredit'), ) albumartists_sort = ListMediaField( - MP3ListDescStorageStyle(desc=u'ALBUMARTISTSSORT'), MP3ListDescStorageStyle(desc=u'ALBUMARTISTS_SORT'), - MP3ListDescStorageStyle(desc=u'ALBUMARTISTS SORT', read_only=True), - MP4ListStorageStyle('----:com.apple.iTunes:ALBUMARTISTSSORT'), MP4ListStorageStyle('----:com.apple.iTunes:ALBUMARTISTS_SORT'), - MP4ListStorageStyle( - '----:com.apple.iTunes:ALBUMARTISTS SORT', read_only=True - ), - ListStorageStyle('ALBUMARTISTSSORT'), ListStorageStyle('ALBUMARTISTS_SORT'), - ListStorageStyle('ALBUMARTISTS SORT', read_only=True), - ASFStorageStyle('beets/Album Artists Sort'), + ASFStorageStyle('beets/AlbumArtistsSort'), ) # Legacy album art field diff --git a/test/test_mediafile.py b/test/test_mediafile.py index 81b5a4a..8105983 100644 --- a/test/test_mediafile.py +++ b/test/test_mediafile.py @@ -716,8 +716,8 @@ def _generate_tags(self, base=None): tags[key] = 1 for key in [ - 'artists', 'albumartists', 'artists_credits', - 'albumartists_credits', 'artists_sort', 'albumartists_sort' + 'artists', 'albumartists', 'artists_credit', + 'albumartists_credit', 'artists_sort', 'albumartists_sort' ]: tags[key] = ['multival', 'test'] @@ -1113,8 +1113,8 @@ def test_known_fields(self): fields.extend( ('encoder', 'images', 'genres', 'albumtype', 'artists', 'albumartists', 'url', 'mb_artistids', 'mb_albumartistids', - 'albumtypes', 'catalognums', 'languages', 'artists_credits', - 'artists_sort', 'albumartists_credits', 'albumartists_sort') + 'albumtypes', 'catalognums', 'languages', 'artists_credit', + 'artists_sort', 'albumartists_credit', 'albumartists_sort') ) assertCountEqual(self, MediaFile.fields(), fields) From 3d6bff21ddfb06513dd8242aecaebb3a7f67c46e Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Wed, 28 Jun 2023 09:04:07 -0700 Subject: [PATCH 5/5] changelog --- docs/index.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/index.rst b/docs/index.rst index f410401..9ad829a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -135,6 +135,11 @@ To copy tags from one MediaFile to another: Changelog --------- +v0.11.1 +''''''' +- Add the multiple-valued properties ``artists_credit``, ``artists_sort``, + ``albumartists_credit``, and ``albumartists_sort``. + v0.11.0 '''''''