[ID3v2] TCON Frame#135
Merged
Merged
Conversation
There was a problem hiding this comment.
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
GenreFrameand routeTCONparsing/creation through the frame factory andId3v2Taggetters/setters. - Remove
TCON-specific logic fromTextInformationFrame. - Fix
StringUtils.trimStart, addStringUtils.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.
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.
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 🤖