FLAC: read tags from a later VORBIS_COMMENT block if the first is empty - #719
Open
augboz wants to merge 1 commit into
Open
FLAC: read tags from a later VORBIS_COMMENT block if the first is empty#719augboz wants to merge 1 commit into
augboz wants to merge 1 commit into
Conversation
Some FLAC files in the wild contain an empty first VORBIS_COMMENT block followed by a populated one. mutagen kept the first block and discarded the rest (quodlibet#377), so these files read as having no tags, while FFmpeg and the reference implementation read the populated block. When the current comment block is empty and a later one is found, prefer the populated block and drop the empty leading block. Adds a regression test. Closes quodlibet#692
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #692.
Some FLAC files in the wild contain an empty first VORBIS_COMMENT block followed by a populated one (the issue has a sample file). mutagen kept the first block and discarded the rest (per #377), so these files read as having no tags, while FFmpeg, metaflac, and macOS read the populated block.
This changes the load logic: when the current comment block is empty and a later VORBIS_COMMENT block is found, the populated block is preferred and the empty leading block is dropped (leaving a single, spec-compliant comment block on re-save). Files with a single block, or a populated first block followed by extras, are unaffected (#377 behaviour preserved).
Added a regression test that injects an empty VORBIS_COMMENT block before a populated one and checks the tags are read; it fails on
mainand passes with this change. Fulltests/test_flac.pypasses andflake8is clean.Happy to add a NEWS entry if you'd like; I left it out since I didn't have a PR number to reference yet.