Skip to content

Commit

Permalink
Add multi-value variants of mb_artistid and mb_albumartistid.
Browse files Browse the repository at this point in the history
Tags are now interpreted as lists.
Resolves #43
  • Loading branch information
JuniorJPDJ committed May 22, 2021
1 parent 7ecd861 commit 25f705c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
25 changes: 17 additions & 8 deletions mediafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1994,18 +1994,27 @@ def update(self, dict):
StorageStyle('MUSICBRAINZ_ALBUMID'),
ASFStorageStyle('MusicBrainz/Album Id'),
)
mb_artistid = MediaField(
MP3DescStorageStyle(u'MusicBrainz Artist Id'),
MP4StorageStyle('----:com.apple.iTunes:MusicBrainz Artist Id'),
StorageStyle('MUSICBRAINZ_ARTISTID'),
mb_artistids = ListMediaField(
MP3ListDescStorageStyle(u'MusicBrainz Artist Id', split_v23=True),
MP4ListStorageStyle('----:com.apple.iTunes:MusicBrainz Artist Id'),
ListStorageStyle('MUSICBRAINZ_ARTISTID'),
ASFStorageStyle('MusicBrainz/Artist Id'),
)
mb_albumartistid = MediaField(
MP3DescStorageStyle(u'MusicBrainz Album Artist Id'),
MP4StorageStyle('----:com.apple.iTunes:MusicBrainz Album Artist Id'),
StorageStyle('MUSICBRAINZ_ALBUMARTISTID'),
mb_artistid = mb_artistids.single_field()

mb_albumartistids = ListMediaField(
MP3ListDescStorageStyle(
u'MusicBrainz Album Artist Id',
split_v23=True,
),
MP4ListStorageStyle(
'----:com.apple.iTunes:MusicBrainz Album Artist Id',
),
ListStorageStyle('MUSICBRAINZ_ALBUMARTISTID'),
ASFStorageStyle('MusicBrainz/Album Artist Id'),
)
mb_albumartistid = mb_albumartistids.single_field()

mb_releasegroupid = MediaField(
MP3DescStorageStyle(u'MusicBrainz Release Group Id'),
MP4StorageStyle('----:com.apple.iTunes:MusicBrainz Release Group Id'),
Expand Down
6 changes: 4 additions & 2 deletions test/test_mediafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,8 +991,10 @@ def test_properties_from_readable_fields(self):

def test_known_fields(self):
fields = list(ReadWriteTestBase.tag_fields)
fields.extend(('encoder', 'images', 'genres', 'albumtype', 'artists',
'albumartists', 'url'))
fields.extend(
('encoder', 'images', 'genres', 'albumtype', 'artists',
'albumartists', 'url', 'mb_artistids', 'mb_albumartistids')
)
assertCountEqual(self, MediaFile.fields(), fields)

def test_fields_in_readable_fields(self):
Expand Down

0 comments on commit 25f705c

Please sign in to comment.