Add separate ID3v1 support - #192
Open
26fe wants to merge 1 commit into
Open
Conversation
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.
Summary
Add dedicated APIs for reading, writing, and removing trailing ID3v1 tags without changing the existing ID3v2 API behavior.
Motivation
An MP3 file can contain both ID3v2 metadata at the beginning and an ID3v1 tag at the end. Applications that update only ID3v2 may leave stale ID3v1 metadata in the same file.
Depending on which tag format a player reads, users may then see different titles, artists, albums, years, track numbers, comments, or genres.
These APIs allow applications to explicitly:
For example, an application can update ID3v2 and then write the corresponding ID3v1 fields:
Alternatively, an application that uses only ID3v2 can remove stale ID3v1 metadata:
The operations are deliberately separate. This preserves backward compatibility and lets each application decide whether ID3v1 should be synchronized, preserved, or removed.
Changes
Add readId3v1(), writeId3v1(), and removeId3v1().
Support Buffer and filepath inputs.
Support synchronous, callback, and Promise APIs.
Add comprehensive ID3v1 tests.
Validation
npm test: 85 passing
npm run eslint: passing