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: updates PictureFrame sequencing to prevent unfortunate conflicts #66

Merged
merged 2 commits into from
Oct 13, 2021

Conversation

tillt
Copy link
Contributor

@tillt tillt commented Oct 13, 2021

When the source file contains multiple APIC frames, with equal Descriptions, we will only use the first one. This is not really what we want. We want to use the first one matching this Description and PictureType.

This patch ensures that APIC frames of different PictureType will be considered unique even if the Description was not.

Updates sequencing tests accordingly. Seems I had to get a bit more verbose in the test coverage.

Copy link
Owner

@n10v n10v left a comment

Choose a reason for hiding this comment

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

Hi @tillt,
thanks for your issue and submitted solution! Your change makes complete sense to me and I merge it.

In id3v2 docs it says that There may be several pictures attached to one file but only one with the same content descriptor. But what is content descriptor for APIC? There is no such property in it and no explanation in specs. And it also doesn't make sense to me to keep same APICs only by description. Considering picture type and description makes more sense.

Even though the change is good, it breaks behaviour, so I will release a new major version with this change.

@@ -22,7 +23,7 @@ type PictureFrame struct {
}

func (pf PictureFrame) UniqueIdentifier() string {
return pf.Description
return fmt.Sprintf("%02X%s", pf.PictureType, pf.Description)
Copy link
Owner

Choose a reason for hiding this comment

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

Nice idea to use 2 bytes for picture type in unique identifier 👍

@n10v n10v merged commit ca3c642 into n10v:master Oct 13, 2021
@n10v
Copy link
Owner

n10v commented Oct 13, 2021

See v2.0.0 release

This pull request was closed.
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.

2 participants