Skip to content

[ID3v2] TCON Frame#135

Merged
benrr101 merged 6 commits into
developfrom
feat/id3v2/tcon-frame
May 22, 2026
Merged

[ID3v2] TCON Frame#135
benrr101 merged 6 commits into
developfrom
feat/id3v2/tcon-frame

Conversation

@benrr101
Copy link
Copy Markdown
Owner

Description

Finally splitting the text information frame class into a separate TCON frame. This frame has special behavior for how genres are handled, and it was getting cumbersome to have all the different cases within the text information frame class.

As an added benefit, I fixed a bug in AIFF behavior where null bytes aren't being trimmed from the start of some field somewhere (ie, there was a bug in StringUtils.trimStart)

This will be prerequisite work for applying the same eager loading that we just did in URL frames.

🤖

Most of this was coded by codex. The commits that were mostly written by codex are prefixed with 🤖

@benrr101 benrr101 added this to the v7.0.0 milestone May 22, 2026
@benrr101 benrr101 requested a review from Copilot May 22, 2026 06:03
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR splits ID3v2 TCON (content type / genre) handling out of TextInformationFrame into a dedicated GenreFrame, since TCON has version-specific parsing/rendering behavior (notably ID3v2.4 multi-field behavior and numeric genre mapping). It also fixes StringUtils.trimStart behavior and adds trimEnd, with accompanying unit tests.

Changes:

  • Introduce GenreFrame and route TCON parsing/creation through the frame factory and Id3v2Tag getters/setters.
  • Remove TCON-specific logic from TextInformationFrame.
  • Fix StringUtils.trimStart, add StringUtils.trimEnd, and add unit tests for both.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test-unit/utilsTests.ts Adds unit coverage for StringUtils.trimStart/trimEnd.
test-unit/id3v2/textInformationFrameTests.ts Removes the TCON-specific v4 parsing expectation from TextInformationFrame tests.
test-unit/id3v2/id3v2TagTests.ts Updates tag-level genre tests to expect/use GenreFrame.
test-unit/id3v2/genreFrameTests.ts Expands tests for parsing/rendering/behavior of the new GenreFrame.
src/utils.ts Fixes trimStart bug and adds trimEnd.
src/index.ts Exports Id3v2GenreFrame from the public API surface.
src/id3v2/id3v2Tag.ts Special-cases TCON to use GenreFrame for get/set paths.
src/id3v2/frames/textInformationFrame.ts Removes embedded TCON parsing/rendering logic now handled by GenreFrame.
src/id3v2/frames/genreFrame.ts New dedicated implementation for TCON parsing/rendering across ID3v2 versions.
src/id3v2/frames/frameFactory.ts Creates GenreFrame when encountering TCON.
src/id3v2/frames/frame.ts Adds FrameClassType.GenreFrame to support type-based filtering.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/id3v2/frames/frame.ts
@benrr101 benrr101 merged commit 3be75e6 into develop May 22, 2026
4 checks passed
@benrr101 benrr101 deleted the feat/id3v2/tcon-frame branch May 22, 2026 17:17
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