Git Product home page Git Product logo

Comments (5)

creeperyang avatar creeperyang commented on May 27, 2024

Looks good. I will have a look as soon.

from id3-parser.

creeperyang avatar creeperyang commented on May 27, 2024

Here is ID3v1 protocol. As it says, ID3v1 would be like:

Property Legnth
Song Title 30 characters
Artist 30 characters
Album 30 characters
Year 4 characters
Comment 30 characters
Genre 1 byte

Property like Artist may does not need 30 bytes, so, it will be padding with binary 0.

However, for lib's readUTF8String util, it will break reading when get 0x00. So I don't think we have to use /(^\s+|\s+$|\0.*$)/g.

from id3-parser.

creeperyang avatar creeperyang commented on May 27, 2024

And it's great if you can offer a counterexample.

Use

let buf = fs.readFileSync('xxxxx.mp3')
buf = buf.slice(buf.length - 128)

to extract the id3v1 part.

from id3-parser.

Satyam avatar Satyam commented on May 27, 2024

It might be so for the v1 part, I had no issue with that one. I had a set of MP3s created by a clearly non standard-compliant software (of which, many exists) which happened to be in ID3v2, encoded with ISO8859 and null-terminated. This module included the null in the resulting string. Though it looked Ok when printed through console.log, when that string was stored in a SQLite database (not an unusual thing, MediaMonkey does that) with its automatic typecasting, it stored the string not as of type TEXT but as BLOB and that simply because of the non-visible null at the end of the string. I fixed it by stripping that null, but I wouldn't recommend my patch for this library module. A more generic fix could be to use the same regular expression you use for v1 tags for both v1 and v2, but that would have required moving whiteRe out of the function it is declared in and have the ability to strip both blanks and nulls.

from id3-parser.

creeperyang avatar creeperyang commented on May 27, 2024

Get it. I'll assess whether to change whiteRe.

from id3-parser.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.