Skip to content

Commit

Permalink
Merge pull request #69 from jmbannon/master
Browse files Browse the repository at this point in the history
multi-tags for artists + albumartists sort and credits
  • Loading branch information
sampsyo committed Jun 28, 2023
2 parents 57a330e + 3d6bff2 commit 8a1b6af
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
'''''''
Expand Down
24 changes: 24 additions & 0 deletions mediafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2101,12 +2101,36 @@ def as_dict(self):
StorageStyle('ARTIST_CREDIT'),
ASFStorageStyle('beets/Artist Credit'),
)
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'ARTISTS_SORT'),
MP4ListStorageStyle('----:com.apple.iTunes:ARTISTS_SORT'),
ListStorageStyle('ARTISTS_SORT'),
ASFStorageStyle('beets/ArtistsSort'),
)
albumartist_credit = MediaField(
MP3DescStorageStyle(u'Album Artist Credit'),
MP4StorageStyle('----:com.apple.iTunes:Album Artist Credit'),
StorageStyle('ALBUMARTIST_CREDIT'),
ASFStorageStyle('beets/Album Artist Credit'),
)
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'ALBUMARTISTS_SORT'),
MP4ListStorageStyle('----:com.apple.iTunes:ALBUMARTISTS_SORT'),
ListStorageStyle('ALBUMARTISTS_SORT'),
ASFStorageStyle('beets/AlbumArtistsSort'),
)

# Legacy album art field
art = CoverArtField()
Expand Down
8 changes: 6 additions & 2 deletions test/test_mediafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_credit',
'albumartists_credit', 'artists_sort', 'albumartists_sort'
]:
tags[key] = ['multival', 'test']

tags['art'] = self.jpg_data
Expand Down Expand Up @@ -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_credit',
'artists_sort', 'albumartists_credit', 'albumartists_sort')
)
assertCountEqual(self, MediaFile.fields(), fields)

Expand Down

0 comments on commit 8a1b6af

Please sign in to comment.