aadsm / JavaScript-ID3-Reader

ID3 tags reader in JavaScript (ID3v1, ID3v2 and AAC)
http://www.aadsm.net/libraries/id3/
Other
556 stars 145 forks source link

Unable to read local file #3

Closed adriengibrat closed 13 years ago

adriengibrat commented 14 years ago

The 'readFileDataFromFileSystem' function (id3.js, ligne 30) call an undefined function 'ReadFile' And the condition to guess if a file is local or not is strange: 'mountpoint://' is not very common.... 'file://' is more obvious!

aadsm commented 14 years ago

You're absolutely right and that's because mountpoint:// is not related to file:// :)

This is a leftover from the origin of the library, I created it while working at Opera Software and we were doing server-side JavaScript for the Opera Unite platform. This platform had access to the widget File I/O API that uses the mountpoint:// protocol to refer to the local filesystem (http://dev.opera.com/libraries/fileio/) ReadFile was a function that was using that API but it is so specific to Opera Unite that I've omitted it when I published the library on github. Unfortunately I was too lazy to remove those leftovers, I'll remove them on the weekend :)

Thanks for the warning!

adriengibrat commented 14 years ago

I'm trying to write a Readfile function that will use HTML5 fileReader... that 'll be supported by more browsers ;) I'm in hollydays, so don't expect me to code it quick...

aadsm commented 14 years ago

Awesome! That's a very good idea, I'll eagerly wait for your patch :)

Enjoy your vacation!

ekosz commented 13 years ago

Hi there.

Has there been any updates as to having this code work with the HTML5 FileAPI? As of right now I don't know how I would get reader to understand one of the 4 ways the FileAPI currently returns the data (ArrayBuffer, BinaryString, Text, or DataURI).

Any news on this would be awesome!

aadsm commented 13 years ago

Hi,

I do have something working actually, but I didn't really like the end result (design wise) so I didn't pull any changes to github. I'll create a branch then, with those changes. Unfortunately I don't have that code with me at the moment, so it will take a week or so to be available.

ekosz commented 13 years ago

@aadsm Thats fine. Any pointers on where to start would be awesome. Thanks!

aadsm commented 13 years ago

Hi,

If you wanna start your own what you need to do first is to implement the dataReader interface that will return a BinaryFile like object, using the FileAPI, and give it to the loadTags function as options.dataReader.

Somewhat similar to BufferedBinaryAjax, it's a function that receives (url, win, fail), it will be called by loadTags with the correct arguments, when ready, it calls the "win" callback function with a BinaryFile-like object as an argument that will be used to read the file contents.

karai17 commented 13 years ago

Hey;

I happened across this project in my searches for a JavaScript id3 parser, but I am having trouble getting it to read local files. I noticed a few comments above you mentioned you would commit a branch that uses the FileAPI instead of AJAX. I was wondering if you were still planning on doing so?

In the project I am working on, I am not using the FileReader() to grab the src blob for my audio tag, but instead using the createObjectURL() (and all other browser variations thereof). Would that still be compatible with the branch you are working on?

Thanks~

aadsm commented 13 years ago

Hi,

You're right, I said I would but got so much stuff in the meanwhile that I ended up forgetting it. Let's see if I can do it tomorrow then, will check the usage of createObjectURL too.

Btw, it's not using FileAPI instead of AJAX. There is another reader basically and when you load you can choose which reader you want to use the Ajax or the FileAPI.

aadsm commented 13 years ago

I finally uploaded it, here's a working page using it: http://www.aadsm.net/libraries/id3/ You can take a peek at http://www.aadsm.net/libraries/id3/index.js