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

Fix handling of albumartistsort as TSO2 and TXXX:ALBUMARTISTSORT in EasyID3 #649

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

antlarr
Copy link

@antlarr antlarr commented Jun 14, 2024

albumartistsort is duplicated as a Text key in easyid3.py#L492 and as a TXXX key in easyid3.py#L533 thus replacing the previous registration.

Because of that, before this change, loading a file with EasyID3 that has a TSO2 frame doesn't make it available by accessing albumartistsort.

Even if TSO2 is not an official tag it seems to be generally supported, and since picard writes TSO2 frames for "album artist sort order", I think it's better to give priority to TSO2 over TXXX:ALBUMARTISTSORT.

I also added a test that fails with the current code and runs successfully after the fix is applied to make sure it doesn't break in the future again.

Actually, we can't just remove TXXX:ALBUMARTISTSORT registration, since that would break reading such frames in files already written as that. So I've added a third commit that falls back to getting the TXXX:ALBUMARTISTSORT value if TSO2 isn't found, deletes both TSO2 and TXXX:ALBUMARTISTSORT frames when deleting albumartistsort and added more tests for those cases.

I'm aware this third commit makes the code a bit more complex, but I've tried to make it as generic as possible just in case other fallback frames need to be added in the future for some other key.

albumartistsort was already added as a registered Text key
some lines above so adding it again as a TXXX key replaces
the previous TSO2 tag registration.

Since picard uses TSO2 for "album artist sort order" and even
if it's not an official tag it seems to be generally supported,
I think it's better to leave that one.
This tests that albumartistsort is handled by the TSO2 frameid.
I noticed that my previous fix for duplicate key registration of
albumartistsort would break reading files already having
TXXX:ALBUMARTISTSORT so this commit fixes it by making
TXXX:ALBUMARTISTSORT a fallback for albumartistsort if the first
getter can't get a value and also by making EasyID3 delete
TXXX:ALBUMARTISTSORT frames when deleting albumartistsort.

Still, when setting an albumartistsort value only TSO2 frames
are used.

This also adds tests for all those cases.
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 this pull request may close these issues.

None yet

1 participant