Skip to content

Commit 6bc74e4

Browse files
committed
Add support for splitting of ID3v2.3 multi-value tags for MP3ListDescStorageStyle
fixes rest of problems in beetbox#43 Shouldn't be enabled on tags like `artists` or other without confidence that values will not contain separator (eg. `artists: ['AC/DC']`). Format of mbid is known and I'm sure we can enable it here. When solving beetbox#21 this separator value in `el.split('/')` also should be taken into account.
1 parent 0688864 commit 6bc74e4

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

mediafile.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -893,14 +893,19 @@ def delete(self, mutagen_file):
893893

894894

895895
class MP3ListDescStorageStyle(MP3DescStorageStyle, ListStorageStyle):
896-
def __init__(self, desc=u'', key='TXXX', **kwargs):
897-
super(MP3ListDescStorageStyle, self).__init__(desc=desc, key=key,
898-
**kwargs)
896+
def __init__(self, desc=u'', key='TXXX', split_v23=False, **kwargs):
897+
self.split_v23 = split_v23
898+
super(MP3ListDescStorageStyle, self).__init__(
899+
desc=desc, key=key, **kwargs
900+
)
899901

900902
def fetch(self, mutagen_file):
901903
for frame in mutagen_file.tags.getall(self.key):
902904
if frame.desc.lower() == self.description.lower():
903-
return frame.text
905+
if mutagen_file.tags.version == (2, 3, 0) and self.split_v23:
906+
return sum([el.split('/') for el in frame.text], start=[])
907+
else:
908+
return frame.text
904909
return []
905910

906911
def store(self, mutagen_file, values):

0 commit comments

Comments
 (0)