Giter Site home page Giter Site logo

Comments (11)

leetreveil avatar leetreveil commented on July 21, 2024

This is probably pushing the boundaries of the potential use cases for this library slightly. Let's leave it out for now, good idea though 👍

from musicmetadata.

andrewrk avatar andrewrk commented on July 21, 2024

okay. To be clear, this isn't just a random API idea that I had. This must be done somewhere for my music player app to recognize which files to put in the library. So I'll either have to maintain a fork or have a library that sits in front of musicmetadata.

from musicmetadata.

andrewrk avatar andrewrk commented on July 21, 2024

Really what I need is the ability to distinguish between audio files that have no metadata tags, and non-audio-files.

from musicmetadata.

leetreveil avatar leetreveil commented on July 21, 2024

Could you not use this?: https://github.com/broofa/node-mime

from musicmetadata.

andrewrk avatar andrewrk commented on July 21, 2024

file extension based? I don't see why I'd even bother to translate the extension into a mime type then. I could just have a set of acceptable file extensions.

But guessing based on extension is not quite as robust as actually checking the metadata header.

musicmetadata contains useful logic for determining the content type of a stream - why not expose it?

from musicmetadata.

leetreveil avatar leetreveil commented on July 21, 2024

Lets say you have 100,000 files on your computer.

Having to read some data from every single one of those files just to find out its mime type would take forever.

from musicmetadata.

andrewrk avatar andrewrk commented on July 21, 2024

If I have 100,000 files on my computer, all the more reason I need to build an index of artist/album/title etc for the music library. To build an index I need to read some data from each file, including the metadata. To even read the metadata, I have to learn the file type. The work will be done regardless.

from musicmetadata.

leetreveil avatar leetreveil commented on July 21, 2024

Lets say only 1000 of those files are audio files, all mp3s.

You could do two things:

Read the first n bytes of every file to detect the mime type. This involves opening a file descriptor, numerous sys calls, never mind actually having to read bits from the disk.

Or you could just filter on the file extension.

from musicmetadata.

andrewrk avatar andrewrk commented on July 21, 2024

okay I see why we have different mindsets: Your use case is scanning your entire hard drive; my use case is scanning, for example, /home/andy/music

I still think this principle holds true: if a module/library calculates or learns something nontrivially useful in the course of doing its main task, that information should be exposed. Otherwise API consumers will try to duplicate (poorly) the functionality, yet depending on the 2 different codebases to do the same thing.

Are you mandating that this module keep secret which decoder it ended up using on the stream?

from musicmetadata.

leetreveil avatar leetreveil commented on July 21, 2024

I just don't see the value proposition for this feature, sorry.

Either the library will emit a metadata event or it wont.

from musicmetadata.

andrewrk avatar andrewrk commented on July 21, 2024

For reference, here's what this looks like: https://github.com/superjoe30/node-musicmetadata/commit/7f922555d386d5f39c741640694a639e6f45cf63

from musicmetadata.

Related Issues (20)

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.