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

PICARD-2468: Properly handle unspecified languages in ID3v2 comments #2370

Merged
merged 2 commits into from
Mar 14, 2024

Conversation

Serial-ATA
Copy link
Contributor

Summary

  • This is a…
    • Bug fix
    • Feature addition
    • Refactoring
    • Minor / simple change (like a typo)
    • Other
  • Describe this change in 1-2 sentences:
    Picard no longer creates a duplicate COMM frame with the incorrect language when using lang='XXX' + desc=''.

Problem

Previously, a COMM frame with lang='XXX' desc='' would be saved as a separate frame with lang='eng' desc='XXX'. This is due to Picard supporting both comment:desc and comment:lang:desc syntax for comment tags.

Solution

A special case was added for lang='XXX', desc=''. I could not think of a better solution for the problem, as Picard normalizes all metadata keys. It would be more elegant if trailing colons were preserved.

Action

Possibly explore storing these comments as comment:XXX:, leaving the trailing colon as a marker for an empty description. This solution is not perfect. In the event that someone has comment:eng:XXX, all eng comments are simply stored as comment:desc. With this change, their language would be overwritten with XXX.

@zas zas requested a review from phw February 26, 2024 18:29
@phw
Copy link
Member

phw commented Feb 29, 2024

Thanks a lot for this. I think as a workaround this probably makes sense and we could include it even in the next Picard 2.x release.

Essentially this is issue happens because the language notation got introduced as an afterthought (4d85c2e). Similar issues plague the still open PR #1650 for doing the same to the lyrics tag.

I guess we should reconsider this and make a harder cut for Picard 3, making the language not optional. I' thinking of having both colons be present even if language is empty, such as comment::desc. @zas what do you think?

@zas
Copy link
Collaborator

zas commented Feb 29, 2024

I guess we should reconsider this and make a harder cut for Picard 3, making the language not optional. I' thinking of having both colons be present even if language is empty, such as comment::desc.

Yes, I agree.

Copy link
Member

@phw phw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's go with this. The code itself is good to go. Please only add a test for this case to https://github.com/metabrainz/picard/blob/master/test/test_util_tags.py#L37

Also please rebase this branch. CI is currently failing due to changes to the Github Action Windows image, and this has been fixed on the master branch.

@phw phw added the Bug fix label Mar 1, 2024
Previously, a `COMM` frame with `lang='XXX' desc=''` would be saved as a separate frame with `lang='eng' desc='XXX'`.

Signed-off-by: Serial <69764315+Serial-ATA@users.noreply.github.com>
Signed-off-by: Serial <69764315+Serial-ATA@users.noreply.github.com>
@Serial-ATA Serial-ATA requested a review from phw March 1, 2024 16:50
@Serial-ATA
Copy link
Contributor Author

Hey @phw is there anything else I need to do for this?

Copy link
Member

@phw phw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Serial-ATA I think no, I just could not get back to this earlier.

From my side I'd say we merge this as it is. It fixes the common issue while being fully backward compatible. We can also merge it then into the 2.x branch for a future release of Picard 2.

I still think we should rework this to completely eliminate the ambiguity. I added PICARD-2844 for that.

@phw phw requested a review from zas March 14, 2024 12:10
Copy link
Collaborator

@zas zas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@phw phw merged commit 63e1604 into metabrainz:master Mar 14, 2024
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants