Skip to content
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

mb_artistid and mb_albumartistid should be lists #43

Closed
JuniorJPDJ opened this issue May 10, 2021 · 10 comments · Fixed by #46
Closed

mb_artistid and mb_albumartistid should be lists #43

JuniorJPDJ opened this issue May 10, 2021 · 10 comments · Fixed by #46

Comments

@JuniorJPDJ
Copy link
Contributor

JuniorJPDJ commented May 10, 2021

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:

>>> 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

@JuniorJPDJ
Copy link
Contributor Author

JuniorJPDJ commented May 10, 2021

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?

@JuniorJPDJ
Copy link
Contributor Author

I successfully got results like this with own class for DescList ID3 on MP3:

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 ;/

JuniorJPDJ added a commit to JuniorJPDJ/mediafile that referenced this issue May 10, 2021
JuniorJPDJ added a commit to JuniorJPDJ/mediafile that referenced this issue May 10, 2021
@sampsyo
Copy link
Member

sampsyo commented May 10, 2021

Ah, interesting! Is there any chance that we just need to do the splitting ourselves for ID3v2.3? Or else we could just give up—and say that multiple items are not supported pre-2.4?

@JuniorJPDJ
Copy link
Contributor Author

JuniorJPDJ commented May 11, 2021

For this fields splitting shouldn't be worst idea actually, data in array elements shouldn't contain any /. It can't be used as general solution tho as other fields could contain / in element.
Eg. artists field could contain 'AC/DC' which would be handled as 2 separate artists if splitting was made.

We could add some magic bool argument to MP3ListDescStorageStyle from #42 which would decide if we should allow splitting this particular field or not.
What do you think about this idea?
Of course splitting should be enabled only on ID3v2.3, not on later, not on older tags.

I'm just still wondering if there's a way to make mutagen do it for us.
Is #21 suggesting it's possible?

@sampsyo
Copy link
Member

sampsyo commented May 11, 2021

Indeed—it would only be appropriate to this hack "on our end" for these ID fields, and not in general.

I took a look at #21 and, unless I'm misreading something, it sounds like the Mutagen docs say that v23_sep only affects saving, not reading… although I could be misunderstanding. It might be good to grep through Mutagen for v23_sep to see if that is in fact the case.

@JuniorJPDJ
Copy link
Contributor Author

JuniorJPDJ commented May 11, 2021

You seem to be right. I'll do this in #42 then ;D

@JuniorJPDJ
Copy link
Contributor Author

JuniorJPDJ commented May 11, 2021

I'll just hardcode / separator ATM but it should be changed when handling #21

JuniorJPDJ added a commit to JuniorJPDJ/mediafile that referenced this issue May 11, 2021
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.
JuniorJPDJ added a commit to JuniorJPDJ/mediafile that referenced this issue May 11, 2021
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.
JuniorJPDJ added a commit to JuniorJPDJ/mediafile that referenced this issue May 11, 2021
…StorageStyle

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.
JuniorJPDJ added a commit to JuniorJPDJ/mediafile that referenced this issue May 12, 2021
JuniorJPDJ added a commit to JuniorJPDJ/mediafile that referenced this issue May 12, 2021
…StorageStyle

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.
JuniorJPDJ added a commit to JuniorJPDJ/mediafile that referenced this issue May 13, 2021
…StorageStyle

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.
JuniorJPDJ added a commit to JuniorJPDJ/mediafile that referenced this issue May 13, 2021
@JuniorJPDJ
Copy link
Contributor Author

It's gonna get it's own PR - I removed fix from #42

@JuniorJPDJ
Copy link
Contributor Author

JuniorJPDJ commented May 13, 2021

The IDs-as-lists change could be problematic, however, and needs some careful consideration.

Well, ATM it's anyway returning only first id from list eg. when tagged by Picard which is badly broken behaviour.

Maybe we could go with something similar to genre and genres?
It seems workaroundish to me, but I get your point with backwards compatibility.

However mediafile is still not v1.0 tho so maybe it should be changed now and not later? ;p
If you are following semver spec - you are allowed to do any API changes in minor releases prior to v1.0 anyway.

JuniorJPDJ added a commit to JuniorJPDJ/mediafile that referenced this issue May 15, 2021
…StorageStyle

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.
JuniorJPDJ added a commit to JuniorJPDJ/mediafile that referenced this issue May 16, 2021
…StorageStyle

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.
JuniorJPDJ added a commit to JuniorJPDJ/mediafile that referenced this issue May 18, 2021
@JuniorJPDJ
Copy link
Contributor Author

Rebased PR is ready to review.

JuniorJPDJ added a commit to JuniorJPDJ/mediafile that referenced this issue May 21, 2021
JuniorJPDJ added a commit to JuniorJPDJ/mediafile that referenced this issue May 21, 2021
JuniorJPDJ added a commit to JuniorJPDJ/mediafile that referenced this issue May 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants