-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert mb_artistid and mb_albumartistid to lists #46
Conversation
c4841b9
to
386a852
Compare
386a852
to
98d2d02
Compare
Rebased on top of master. |
Alright, so this is the tricky one. On the surface, it's a simple change; unfortunately, the interaction with reality is complicated. Probably most importantly (and as discussed elsewhere), changing the type of these existing fields would break current software that depends on these fields—most importantly, it would break beets (and beets plugins). This change would be tricky to get right everywhere, especially considering third-party plugins that might rely on the string behavior. Providing a second interface to get list-style access to the same data would be awesome. Second, there is a broader issue here about how to deal with multi-value tags in MediaFile. It would be really great to come up with some sort of consistent way to expose list-formatted data. However, there are many complicating factors:
So generally speaking, there is a deeper problem to be solved here about how to expose both list-shaped and non-listy versions of data—for different use cases and different situations. I honestly don't know what to do about it. But I confess some discomfort with introducing lists of data without more clarity on what the grand plan is. |
Actual problem with those values is that files are already tagged with this fields as multi-valued by most of software and I'm not sure why those are NOT lists at the first place. Musicbrainz itself specifies those tags as multi-valued as you need to write information about all artist IDs to the same tag.
Is there any format beyond
I don't get what you are talking about now - fields you mentioned are not lists and are not supposed to be lists. Only few of fields are made to be lists and part of those were already implemented before I tried to deal with multi-valued fields ;O In sake of backwards compatibility I probably could rename those fields to I'm not sure what will happen if you for example overwrite first value using single-value tag when list would contain more than one value. Will it remove other values? Leave other values untouched and just change first? Second option creates loads of bugs in end software.
There's no grand plan ;D And yes, this is a bug - EDIT: >>> mf = MediaFile('/home/juniorjpdj/temp/Szpadyzor crew.flac')
>>> mf.mb_artistid
'164ed128-525d-4798-883f-be13502de86b'
>>> mf.mb_albumartistid
'164ed128-525d-4798-883f-be13502de86b'
>>> mf.save()
>>> mutagen.File('/home/juniorjpdj/temp/Szpadyzor crew.flac')['MUSICBRAINZ_ARTISTID']
['164ed128-525d-4798-883f-be13502de86b', 'ded6b91b-26d8-4bc0-8aa9-fab9b54cd157']
>>> mf.mb_artistid = "test"
>>> mf.mb_artistid
'test'
>>> mf.save()
>>> mutagen.File('/home/juniorjpdj/temp/Szpadyzor crew.flac')['MUSICBRAINZ_ARTISTID']
['test']
>>> mutagen.File('/home/juniorjpdj/temp/Szpadyzor crew.flac')['MUSICBRAINZ_ALBUMARTISTID']
['164ed128-525d-4798-883f-be13502de86b', 'ded6b91b-26d8-4bc0-8aa9-fab9b54cd157'] |
I just renamed lists to plural forms and added >>> mf.mb_albumartistids
['164ed128-525d-4798-883f-be13502de86b', 'ded6b91b-26d8-4bc0-8aa9-fab9b54cd157']
>>> mf.mb_albumartistid
'164ed128-525d-4798-883f-be13502de86b'
>>> mf.mb_albumartistid = '164ed128-525d-4798-883f-be13502de86b'
>>> mf.mb_albumartistid
'164ed128-525d-4798-883f-be13502de86b'
>>> mf.mb_albumartistids
['164ed128-525d-4798-883f-be13502de86b'] I also rolled back tests as my changes are not needed anymore as main tags work as before. What do you think about it now? EDIT: it also works for ID3v2.3 so it fixes weird behaviour: >>> from mediafile import MediaFile
>>> f = MediaFile('/home/juniorjpdj/temp/ID3v230_Szpadyzor crew.mp3')
>>> f.mb_artistid
'164ed128-525d-4798-883f-be13502de86b'
>>> f.mb_artistids
['164ed128-525d-4798-883f-be13502de86b',
'ded6b91b-26d8-4bc0-8aa9-fab9b54cd157',
'680a88be-9f13-4487-add6-e0367841194d',
'e5f3eaf9-f76b-4fee-ba4f-3208e53587c1']
>>> f.mb_albumartistids
['164ed128-525d-4798-883f-be13502de86b',
'ded6b91b-26d8-4bc0-8aa9-fab9b54cd157']
>>> f.mb_albumartistid
'164ed128-525d-4798-883f-be13502de86b'
>>> f.mb_artistids
['164ed128-525d-4798-883f-be13502de86b',
'ded6b91b-26d8-4bc0-8aa9-fab9b54cd157',
'680a88be-9f13-4487-add6-e0367841194d',
'e5f3eaf9-f76b-4fee-ba4f-3208e53587c1']
f.mb_artistid = "kek"
f.mb_artistids
['kek'] |
53b3bec
to
c4218ff
Compare
Tags are now interpreted as lists. Resolves beetbox#43
c4218ff
to
25f705c
Compare
. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!! So sorry this took me so long to review in full detail, but this looks perfect. Thanks for sorting this out!!
Resolves #43.