aadsm / JavaScript-ID3-Reader

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

year "undefined" for mp3s #36

Closed emosterd closed 10 years ago

emosterd commented 10 years ago

It seems that the "year" tag is not working for MP3s, and returns "undefined." I have a series of MP3s tagged with the year in both the v1 and v2 tags, but ID3-minimized.js returns "undefined" for them all.

I took a look at the example page you have, just to make sure it is not something specific to my MP3s, and it appears this is happening on your page as well. None of the year tags are displayed when selecting the MP3s, but when you select the sole M4A (02_Viandanze.m4a), the year (2011) is displayed. I downloaded this file locally and it exhibits the same behavior.

aadsm commented 10 years ago

What do you mean with "it exhibits the same behavior."? That your local version works like my webpage or that it doesn't show the year like your other MP3s?

The "year" shortcut is an alias to the "TYER" tag. There is another year tag, the "TORY".

emosterd commented 10 years ago

Sorry I was not more clear. When, using the example code provided on this page:

http://web.ist.utl.pt/antonio.afonso/www.aadsm.net/libraries/id3/#demo

and try to obtain "year," it returns undefined. I thought it was something I was doing wrong, so I took a look at the page above and click on the "Advent Chamber Orchestra" link. When it loads the tag information, you will note that there is no information next to the "Year:" field:

screen shot 2014-04-30 at 10 25 50 am

As I was clicking through the other MP3 examples on that page, none had year information displayed for them--the same behavior I was experiencing. I then tried "02_Viandanze.m4a" on this page, and the year information displays (2011):

screen shot 2014-04-30 at 10 26 39 am

For a final confirmation, I downloaded the m4a file to my server, and my code was able to pull up the year:

screen shot 2014-04-30 at 10 25 00 am

And here's a shot of an MP3 file:

screen shot 2014-04-30 at 10 27 26 am

I used KID3 to verify that the years were included in both v1 and v2 tags.

I will try to use the TORY tag and report back my results.

emosterd commented 10 years ago

So, switching "year" with "TORY" returned undefined for the M4A file now:

screen shot 2014-04-30 at 10 32 06 am

as well as the MP3s files. Assuming my code is correctly trying to pull this information:

function getID3Info(mp3ID) { var mp3URL = mp3Files[mp3ID].url; ID3.loadTags(mp3URL, function() { var tags = ID3.getAllTags(mp3URL); mp3Files[mp3ID].artist = tags.artist; mp3Files[mp3ID].title = tags.title; mp3Files[mp3ID].album = tags.album; mp3Files[mp3ID].year = tags.TORY; mp3Files[mp3ID].picture = tags.picture; / for ( var key in tags ) { console.log("tags." + key + " = " + tags[key]); } / }, {tags: ["artist", "title", "album", "TORY", "picture"]}); }

I also had it dump all of the tags it pulled in the console, and here are the results for the M4A:

tags.title = Viandanze tags.artist = Fabrizio Paterlini tags.album = Viandanze (EP) tags.track = 2 tags.count = 0 tags.year = 2011 tags.comment = [object Object] tags.compilation = 0 tags.tempo = 0 tags.encoder = iTunes 11.1.3 tags.picture = [object Object]

Here are the results for the MP3 from the screenshot above (Boulevard Big Band):

tags.version = 2.4.0 tags.major = 4 tags.revision = 0 tags.flags = [object Object] tags.size = 34818 tags.title = The More I See You tags.artist = Boulevard Big Band tags.album = Take Only For Pain tags.picture = [object Object] tags.TALB = [object Object] tags.TPE1 = [object Object] tags.TIT2 = [object Object] tags.APIC = [object Object]

Finally, here's a screenshot from KID3 for the file above:

screen shot 2014-04-30 at 10 40 36 am

aadsm commented 10 years ago

I've looked into the KID3 documentation and according to them the "Date" field is stored under the "TDRC" tag for ID3v2.4.

http://kid3.sourceforge.net/kid3_en.html#frame-list

Unfortunately the loadTags does not load all tags the MP3 has, only the default ones specified in the library.

emosterd commented 10 years ago

OK, thanks for doing the research! I'll try a different tagging tool and see if I get the desired results.