Repository: beetbox/mediafile (language: python)

Issue:
mb_artistid and mb_albumartistid should be lists
Hey!
When trying to fix my PR (#42) I found error I can't fix myself.

`mb_artistid` and `mb_albumartistid` should be lists!
`mediafile`'s version:
```python
>>> mf = MediaFile('/home/juniorjpdj/temp/Szpadyzor crew.flac')
>>> mf.mb_artistid
'164ed128-525d-4798-883f-be13502de86b'
>>> mf.mb_albumartistid
'164ed128-525d-4798-883f-be13502de86b'
```

Picard is tagging it like that (mutagen dump):
FLAC:  `'musicbrainz_artistid': ['164ed128-525d-4798-883f-be13502de86b', 'ded6b91b-26d8-4bc0-8aa9-fab9b54cd157'],`
MP3 (ID3v2.3): ` 'TXXX:MusicBrainz Artist Id': TXXX(encoding=<Encoding.UTF16: 1>, desc='MusicBrainz Artist Id', text=['ca780457-5bf6-4a7d-95fa-0d0d4920f26f/258a67d1-172d-4d16-8d6c-09efde60896f/af262d86-542d-4864-8527-083065166d6c']),`

Fixing FLAC parsing is easy I can't make it work in MP3 case.

Current code is returning only the first author in case of FLAC and `'/'` separated string in case of MP3.

Helping fixing this will also help me solve some problems with #42 ;D


Discussion / hints:
```python
mutagen.File('/home/juniorjpdj/temp/Szpadyzor crew.flac')['MUSICBRAINZ_ARTISTID']
Out[39]: 
['164ed128-525d-4798-883f-be13502de86b',
 'ded6b91b-26d8-4bc0-8aa9-fab9b54cd157']
mutagen.File('/home/juniorjpdj/temp/ID3v240_Szpadyzor crew.mp3')['TXXX:MusicBrainz Album Artist Id']
Out[40]: TXXX(encoding=<Encoding.UTF8: 3>, desc='MusicBrainz Album Artist Id', text=['164ed128-525d-4798-883f-be13502de86b', 'ded6b91b-26d8-4bc0-8aa9-fab9b54cd157'])
mutagen.File('/home/juniorjpdj/temp/ID3v230_Szpadyzor crew.mp3')['TXXX:MusicBrainz Album Artist Id']
Out[41]: TXXX(encoding=<Encoding.UTF16: 1>, desc='MusicBrainz Album Artist Id', text=['164ed128-525d-4798-883f-be13502de86b/ded6b91b-26d8-4bc0-8aa9-fab9b54cd157'])
```

Main problem is with ID3v2.3 separator not being parsed by mutagen?
I successfully got results like this with own class for DescList ID3 on MP3:
```python
from mediafile import MediaFile
MediaFile('/home/juniorjpdj/temp/ID3v240_Szpadyzor crew.mp3').mb_albumartistid
Out[3]: 
['164ed128-525d-4798-883f-be13502de86b',
 'ded6b91b-26d8-4bc0-8aa9-fab9b54cd157']
MediaFile('/home/juniorjpdj/temp/ID3v230_Szpadyzor crew.mp3').mb_albumartistid
Out[4]: ['164ed128-525d-4798-883f-be13502de86b/ded6b91b-26d8-4bc0-8aa9-fab9b54cd157']
MediaFile('/home/juniorjpdj/temp/Szpadyzor crew.flac').mb_albumartistid
Out[5]: 
['164ed128-525d-4798-883f-be13502de86b',
 'ded6b91b-26d8-4bc0-8aa9-fab9b54cd157']
```
but I still don't know how to handle separator in ID3v2.3 ;/

Fix patch:
diff --git a/mediafile.py b/mediafile.py
index a9e5e8e..90e54a8 100644
--- a/mediafile.py
+++ b/mediafile.py
@@ -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'),


Test patch:
diff --git a/test/test_mediafile.py b/test/test_mediafile.py
index 269cdd2..9e1fdd7 100644
--- a/test/test_mediafile.py
+++ b/test/test_mediafile.py
@@ -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):