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(content): Decode IPLS/TIPL/TMCL with odd value count gracefully #154

Merged
merged 2 commits into from
Feb 8, 2025

Conversation

Holzhaus
Copy link
Contributor

@Holzhaus Holzhaus commented Feb 8, 2025

This might be an option to fix decoding errors due to broken IPLS/TIPL/TMCL frames. See #147 for details.

Note: The big downside of this solution is that applications have no way to distinguish a tag with a valid TIPL frame where the last even value is empty from a tag with an invalid TIPL frame where the last even value is missing anymore.
If you wanted to bui.d a tool that checks if your tags are valid, you couldn't use rust-id3 anymore. If this should be possible, we'd have to go for options 2/3 described in #147 (comment).

Using this branch, the sample file from #147 can be decoded successfully:

$ cargo run --example id3info sample.mp3
# ID3 ID3v2.4 - 35 frames
TIT2="Wily's Castle"
TPE1="RushJet1"
TRCK="17/28"
TALB="Mega Man 2 Remade"
TPOS="1/1"
TDRC="2014-12-01"
TCON="8-Bit Electronic"
TBPM="0"
TCMP="0"
TLAN="eng"
USLT:[XXX]=""
TPE2="RushJet1"
TSOP="RushJet1"
TIPL:arranger=""
TDOR="2014-12-01"
TXXX:Script="Latn"
TMED="Digital Media"
TXXX:Artist Credit="RushJet1"
TXXX:MP3GAIN_MINMAX="063,208"
TXXX:ALBUMARTISTSORT="RushJet1"
TXXX:MP3GAIN_UNDO="+002,+002,N"
TXXX:Album Artist Credit="RushJet1"
COMM:[eng]="Visit http://rushjet1.com"
TXXX:MusicBrainz Album Status="Official"
TXXX:MusicBrainz Album Release Country="XW"
TXXX:MusicBrainz Album Id="6cda3c13-80b7-49a4-b8ac-889565442f94"
UFID:http://musicbrainz.org=b"ef471528-ee72-49a7-b0d4-500a6034ea6e"
TXXX:MusicBrainz Release Group Id="570518df-14de-4b4d-9c97-e02a58d057b1"
TXXX:MusicBrainz Release Track Id="c79faf7f-43b8-4ba3-b553-3f931b5f9bd8"
COMM:iTunNORM[eng]=" 000003DA 000003DA 000009A2 000009A2 00000000 00000000 00005A81 00005A81 00000000 00000000"
APIC:Front cover=<image, image/jpeg, description "", 40510 bytes>
TXXX:REPLAYGAIN_TRACK_GAIN="-2.48 dB"
TXXX:REPLAYGAIN_TRACK_PEAK="0.715942"
TXXX:REPLAYGAIN_ALBUM_GAIN="-2.03 dB"
TXXX:REPLAYGAIN_ALBUM_PEAK="0.851807"

The test data from extracted from the sample file attached to polyfloyd#147.

    $ cargo run --example tagdump sample.mp3 > testdata/github-issue-147.id3
    Tag size: 42998
    Footer: no
    Writing 42998 bytes to stdout...
    Done.
@Holzhaus Holzhaus force-pushed the graceful-tipl-decoding branch from 8d9e43f to 7c90acc Compare February 8, 2025 13:22
@polyfloyd
Copy link
Owner

Nice!

This seems like a good solution. I am not super concerned about being able to check tags for validity. ID3 is an old standard and there is plenty of mangled data out there. Being able to read as much as possible is preferred.

@polyfloyd polyfloyd merged commit d1c18df into polyfloyd:main Feb 8, 2025
16 checks passed
@Holzhaus Holzhaus deleted the graceful-tipl-decoding branch February 9, 2025 12:38
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