Comments (7)
About point 3, I did notice the current particular case for APIC tag frame, here are some comments about it.
The documentation uses the terminology picture
but the current implementation uses image
as the property name.
The documentation uses the term pictureType
but the library currently uses type
as the property name
It would have been nicer to align terminology with the documentation as much as possible.
Also to better align with the rest of the library pictureType
should just have been a number in both create
and read
. To better separate concerns, the name could be retrieve separately from the the type. More on this below.
Fixing these now would introduce breaking changes, so I suppose we will leave with it that way. Later we could introduced a new major version with breaking changes.
Some issues the way this is currently implemented:
- the create and read API are asymmetric:
The picture type is currently hard-coded to 3 (Front Cover) here , but is returned as an object with propertiestype: { id: number, name: string }
.
I am not sure why the name is returned here, usually a name is used either to display in a UI or as a debug facility. Also names are usually preferred to numbers (easier to work with), but here since we are very close to the format for all the other frames (all the other frames accept and return numbers), I think we should have returned justtype: number
.
Ideally for APIC we would like to have the read
return an object format compatible with the create
, imagine, you read all the tags and want to rewrite them (which I will need to do in my code), then you can read
=> modify/delete/add
=> write
(note that update
unfortunately has a particular case for tags with multiple values, I won't extend on that here).
With that in mind, I suggest the following changes:
- provide a set of constant definitions for the picture type
- for
create
- accepts
type
as an object{ id: number }
(name
should be ignored), accepting the object format allows to make it compatible with the value returned byread
, we could also potentially accepttype
as a number, but that would complicate code for both the library and clients of the library, I leave this open for discussion
- accepts
- for
read
- nothing to change I believe
- update the documentation to specify that
name
is informational only provided byread
but not accepted bycreate
from node-id3.
We could potentially also provide maps to map constants to debug names for user convenience (similarly to the APIC case).
from node-id3.
I will try to provide a PR for this after this one #124.
from node-id3.
Hi @pbricout,
you're absolutely correct about the APIC frame, especially the hardcoded cover type. To give some context about the naming choices, the first implementation was commited 6 years ago (1d0a550) and it was honestly a mess itself 😄 I didn't really think much about naming choices etc., just wanted it to work back then. But with more inconsistencies, it's clear that it was a bad choice. I also don't remember why I chose to add the name to the type.
However, I've always tried not to break anything when re-writing things while the library is at version 0.x, which is why I don't think renaming is an option for now, like you said. I wanted to at least get all v2.3.0 frames working before upping to 1.x. I'd probably wait with accepting type
as a number until the read implementation can be changed. The hardcoded type is definitely a bug, though.
from node-id3.
What do you think if we simply use Constants
instead of TagConstants
? Since this is in the context of a tag library, maybe the tag prefix isn't necessary?
from node-id3.
I have now pushed a PR #126.
from node-id3.
Merged in 17a2479 / ed4495b, thanks!
from node-id3.
Related Issues (20)
- ImageBuffer returns undefined after editing other tags HOT 2
- Explain in docs that `write` doesn't create new file =) HOT 4
- "releaseTime" tag not read from AIFF file HOT 6
- Duration not supported HOT 1
- update function does not take v4 tags into account
- Changes and fixes for new API release
- Updating tags in AIFF files makes tags/audio unreadable by other applications HOT 5
- Incorrect timestamps on Syncronized lyrics HOT 16
- Setting synchronisedLyrics to undefined throws an error HOT 4
- [BuG] MP3 File is corrupted HOT 8
- Not reading id3v1 HOT 1
- Support for audio formats other than mp3 HOT 4
- Support large files HOT 2
- Issues with metadata being read by certain players HOT 2
- Basic adding tags not working HOT 5
- iTunes/Apple Music GRP1 grouping tag is not supported
- Possible song corruption when editing metadata while playing the song. HOT 5
- Using CTOC Entry Count byte causes issue with large number of entries HOT 8
- Support Different Text Encodings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-id3.