-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Background
In ID3v2.3, the forward slash (/) is used as a separator for multiple values in text frames. This causes problems for artist names that legitimately contain a /, such as AC/DC.
When reading such tags, the artist value is split into an array. For example:
AC/DC-->['AC', 'DC']Axwell /\ Ingrosso-->['Axwell ', '\ Ingrosso']
This is not a node-taglib-sharp bug, but a side effect of the ID3v2.3 specification.
Common workaround
To handle this, many audio players maintain a whitelist of known artists containing / and re-join the split values. For example:
['AC', 'DC']-->AC/DC['Axwell ', '\ Ingrosso']-->Axwell /\ Ingrosso
My audio player Dopamine implements this logic via a MetadataPatcher, which can be found here:
https://github.com/digimezzo/dopamine/blob/master/src/app/common/metadata/metadata-patcher.ts
Why trimming matters
For the MetadataPatcher to work correctly, it is essential that the split values are not trimmed. The original spacing is required to match the split array back to the original string.
Example:
['Axwell ', '\ Ingrosso']can be matched toAxwell /\ Ingrosso['Axwell', '\ Ingrosso']cannot be matched toAxwell /\ Ingrosso
Current behavior
For Artists and Album Artists, node-taglib-sharp preserves whitespace, which is correct.
However, for Genres, the returned values are trimmed. For example:
Genre1 / Genre2-->['Genre1', 'Genre2']
Instead of the expected:
['Genre1 ', ' Genre2']
This is a subtle detail, but it differs from the behavior of taglib#.
Comparison
Legend:
- u = untrimmed
- t = trimmed
| Field | taglib# | node-taglib-sharp |
|---|---|---|
| Artists | u | u |
| Album artists | u | u |
| Genres | u | t |
Screenshots attached below for reference.
taglib#
node-taglib-sharp
