Skip to content

fix(id3): properly parse COMM and TXXX frames#30

Merged
rpuneet merged 1 commit intomainfrom
fix/id3-comm-frame
Feb 7, 2026
Merged

fix(id3): properly parse COMM and TXXX frames#30
rpuneet merged 1 commit intomainfrom
fix/id3-comm-frame

Conversation

@rpuneet
Copy link
Contributor

@rpuneet rpuneet commented Feb 7, 2026

Summary

Fixes #20

  • Fix COMM (Comment) frames displaying as "Binary data" instead of actual comment text
  • Add proper parsing for TXXX (User Defined Text) frames
  • Add support for ID3v2.2 COM frames

Root Cause

COMM frame structure was not being parsed correctly. The frame has:

  • 1 byte: encoding
  • 3 bytes: language
  • null-terminated: short description
  • remaining: actual comment text

The previous code was not properly handling the null-terminated description separator.

Changes

  • decodeCommentFrame: Properly find description/comment boundary
  • decodeUserTextFrame: New function for TXXX frames
  • Handle ID3v2.2 COM frames (was only handling v2.3/2.4 COMM)
  • Backward compatible with malformed frames (missing description)

Test plan

  • Unit tests for COMM with description separator
  • Unit tests for TXXX parsing
  • Unit tests for ID3v2.2 COM frames
  • Unit tests for decodeUserTextFrame
  • All existing tests pass

🤖 Generated with Claude Code

Fixes #20

COMM (Comment) frames were displaying as "Binary data" instead of
the actual comment text due to improper handling of the frame structure.

Changes:
- Fix decodeCommentFrame to properly handle description/comment separator
- Add decodeUserTextFrame for TXXX frames
- Add support for ID3v2.2 COM frames (in addition to COMM)
- Handle edge case where description is missing (backward compat)

COMM frame structure: encoding + language + description\0 + comment
TXXX frame structure: encoding + description\0 + value

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Feb 7, 2026

Codecov Report

❌ Patch coverage is 80.35714% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/parser/id3/id3.go 80.35% 7 Missing and 4 partials ⚠️

📢 Thoughts on this report? Let us know!

@rpuneet rpuneet merged commit a6cda1a into main Feb 7, 2026
6 of 7 checks passed
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.

Bug: ID3 Comment (COMM) frame displayed as 'Binary data' instead of text

1 participant