1
0
mirror of synced 2026-05-22 14:43:19 +00:00

Added tests for id3v2, added sample data.

This commit is contained in:
Lee Treveil
2010-09-21 11:21:47 +01:00
parent cf0a438160
commit f42c52fa39
3 changed files with 20 additions and 0 deletions
+2
View File
@@ -84,10 +84,12 @@ ID3File.prototype.getTags = function getTags(version) {
var ID3v2_ALIAS = exports.ID3v2_ALIAS = {
"title" : ["TIT2", "TT2"],
"artist" : ["TPE1", "TP1"],
"albumartist" : ["TPE2", "TP2"],
"album" : ["TALB", "TAL"],
"year" : ["TYER", "TYE"],
"comment": ["COMM", "COM"],
"track" : ["TRCK", "TRK"],
"disk" : ["TPOS", "TPA"],
"genre" : ["TCON", "TCO"],
"picture": ["APIC", "PIC"],
"lyrics" : ["USLT", "ULT"]
Binary file not shown.
+18
View File
@@ -0,0 +1,18 @@
var assert = require('assert'),
id3 = require('../lib/id3'),
fs = require('fs');
var audioFile = fs.readFileSync('sample3v2.mp3');
var id3v2 = new id3(audioFile);
id3v2.parse();
assert.equal(id3v2.get('title'),'Home', 'title is not correct');
assert.equal(id3v2.get('artist'), 'Explosions In The Sky', 'artist is not correct');
assert.equal(id3v2.get('albumartist'), 'Soundtrack', 'album artist is not correct');
assert.equal(id3v2.get('album'), 'Friday Night Lights [Original Movie Soundtrack]', 'album is not correct');
assert.equal(id3v2.get('year'), 2004, 'year is not correct');
assert.equal(id3v2.get('track'),'5','track is not correct');
assert.equal(id3v2.get('disk'),'1/1', 'disk is not correct');
assert.equal(id3v2.get('genre'),'Soundtrack', 'genre is not correct');
assert.equal(id3v2.get('picture').data.length, 80938, 'picture length is not correct');