diff --git a/mediafile.py b/mediafile.py index 89791d6..8b73495 100644 --- a/mediafile.py +++ b/mediafile.py @@ -893,14 +893,19 @@ def delete(self, mutagen_file): class MP3ListDescStorageStyle(MP3DescStorageStyle, ListStorageStyle): - def __init__(self, desc=u'', key='TXXX', **kwargs): - super(MP3ListDescStorageStyle, self).__init__(desc=desc, key=key, - **kwargs) + def __init__(self, desc=u'', key='TXXX', split_v23=False, **kwargs): + self.split_v23 = split_v23 + super(MP3ListDescStorageStyle, self).__init__( + desc=desc, key=key, **kwargs + ) def fetch(self, mutagen_file): for frame in mutagen_file.tags.getall(self.key): if frame.desc.lower() == self.description.lower(): - return frame.text + if mutagen_file.tags.version == (2, 3, 0) and self.split_v23: + return sum([el.split('/') for el in frame.text], start=[]) + else: + return frame.text return [] def store(self, mutagen_file, values): @@ -1988,15 +1993,19 @@ def update(self, dict): ASFStorageStyle('MusicBrainz/Album Id'), ) mb_artistid = ListMediaField( - MP3ListDescStorageStyle(u'MusicBrainz Artist Id'), + MP3ListDescStorageStyle(u'MusicBrainz Artist Id', split_v23=True), MP4ListStorageStyle('----:com.apple.iTunes:MusicBrainz Artist Id'), ListStorageStyle('MUSICBRAINZ_ARTISTID'), ASFStorageStyle('MusicBrainz/Artist Id'), ) mb_albumartistid = ListMediaField( - MP3ListDescStorageStyle(u'MusicBrainz Album Artist Id'), + MP3ListDescStorageStyle( + u'MusicBrainz Album Artist Id', + split_v23=True, + ), MP4ListStorageStyle( - '----:com.apple.iTunes:MusicBrainz Album Artist Id'), + '----:com.apple.iTunes:MusicBrainz Album Artist Id', + ), ListStorageStyle('MUSICBRAINZ_ALBUMARTISTID'), ASFStorageStyle('MusicBrainz/Album Artist Id'), )