Skip to content

Commit

Permalink
Convert mb_artistid and mb_albumartistid to multivalue
Browse files Browse the repository at this point in the history
Resolves #43
  • Loading branch information
JuniorJPDJ committed May 13, 2021
1 parent 1e6108a commit c4841b9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
21 changes: 13 additions & 8 deletions mediafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1992,16 +1992,21 @@ 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_artistid = 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_albumartistid = 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_releasegroupid = MediaField(
Expand Down
12 changes: 6 additions & 6 deletions test/test_mediafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ class ReadWriteTestBase(ArtTestMixin, GenreListTestMixin,
'mb_trackid': '8b882575-08a5-4452-a7a7-cbb8a1531f9e',
'mb_releasetrackid': 'c29f3a57-b439-46fd-a2e2-93776b1371e0',
'mb_albumid': '9e873859-8aa4-4790-b985-5a953e8ef628',
'mb_artistid': '7cf0ea9d-86b9-4dad-ba9e-2355a64899ea',
'mb_artistid': ['7cf0ea9d-86b9-4dad-ba9e-2355a64899ea'],
'art': None,
'label': u'the label',
}
Expand Down Expand Up @@ -372,7 +372,6 @@ class ReadWriteTestBase(ArtTestMixin, GenreListTestMixin,
'mb_releasetrackid',
'mb_workid',
'mb_albumid',
'mb_artistid',
'art',
'label',
'rg_track_peak',
Expand All @@ -382,7 +381,6 @@ class ReadWriteTestBase(ArtTestMixin, GenreListTestMixin,
'r128_track_gain',
'r128_album_gain',
'albumartist',
'mb_albumartistid',
'artist_sort',
'albumartist_sort',
'acoustid_fingerprint',
Expand Down Expand Up @@ -715,7 +713,7 @@ 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', 'mb_artistid', 'mb_albumartistid']:
tags[key] = ['multival', 'test']

tags['art'] = self.jpg_data
Expand Down Expand Up @@ -991,8 +989,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_artistid', 'mb_albumartistid')
)
assertCountEqual(self, MediaFile.fields(), fields)

def test_fields_in_readable_fields(self):
Expand Down

0 comments on commit c4841b9

Please sign in to comment.