music-metadata
Advanced tools
Comparing version 0.7.10 to 0.7.11
@@ -24,2 +24,6 @@ import { INativeAudioMetadata, IOptions } from "../"; | ||
static calculateDuration(ah: IHeader): number; | ||
static parseFooter(tokenizer: ITokenizer, options: IOptions): Promise<Array<{ | ||
id: string; | ||
value: any; | ||
}>>; | ||
private static parseTags(footer, buffer, includeCovers); | ||
@@ -33,3 +37,2 @@ private type; | ||
private parseHeader(); | ||
private parseFooter(); | ||
} |
@@ -129,2 +129,13 @@ 'use strict'; | ||
}; | ||
APEv2Parser.parseFooter = function (tokenizer, options) { | ||
return tokenizer.readToken(Structure.TagFooter).then(function (footer) { | ||
if (footer.ID !== 'APETAGEX') { | ||
throw new Error('Expected footer to start with APETAGEX '); | ||
} | ||
return tokenizer.readToken(Structure.TagField(footer)).then(function (tags) { | ||
return APEv2Parser.parseTags(footer, tags, !options.skipCovers); | ||
}); | ||
}); | ||
}; | ||
// ToDo: public ??? | ||
APEv2Parser.parseTags = function (footer, buffer, includeCovers) { | ||
@@ -192,3 +203,3 @@ var offset = 0; | ||
return _this.tokenizer.readToken(new strtok3_1.IgnoreType(header.forwardBytes)).then(function () { | ||
return _this.parseFooter().then(function (tags) { | ||
return APEv2Parser.parseFooter(tokenizer, options).then(function (tags) { | ||
return { | ||
@@ -228,13 +239,2 @@ format: header.format, | ||
}; | ||
APEv2Parser.prototype.parseFooter = function () { | ||
var _this = this; | ||
return this.tokenizer.readToken(Structure.TagFooter).then(function (footer) { | ||
if (footer.ID !== 'APETAGEX') { | ||
throw new Error('Expected footer to start with APETAGEX '); | ||
} | ||
return _this.tokenizer.readToken(Structure.TagField(footer)).then(function (tags) { | ||
return APEv2Parser.parseTags(footer, tags, !_this.options.skipCovers); | ||
}); | ||
}); | ||
}; | ||
return APEv2Parser; | ||
@@ -241,0 +241,0 @@ }()); |
@@ -232,2 +232,14 @@ 'use strict'; | ||
public static parseFooter(tokenizer: ITokenizer, options: IOptions): Promise<Array<{ id: string, value: any }>> { | ||
return tokenizer.readToken<IFooter>(Structure.TagFooter).then((footer) => { | ||
if (footer.ID !== 'APETAGEX') { | ||
throw new Error('Expected footer to start with APETAGEX '); | ||
} | ||
return tokenizer.readToken<Buffer>(Structure.TagField(footer)).then((tags) => { | ||
return APEv2Parser.parseTags(footer, tags, !options.skipCovers); | ||
}); | ||
}); | ||
} | ||
// ToDo: public ??? | ||
private static parseTags(footer: IFooter, buffer: Buffer, includeCovers: boolean): Array<{ id: string, value: any }> { | ||
@@ -312,3 +324,3 @@ let offset = 0; | ||
return this.tokenizer.readToken(new IgnoreType(header.forwardBytes)).then(() => { | ||
return this.parseFooter().then((tags) => { | ||
return APEv2Parser.parseFooter(tokenizer, options).then((tags) => { | ||
return { | ||
@@ -350,12 +362,2 @@ format: header.format, | ||
private parseFooter(): Promise<Array<{ id: string, value: any }>> { | ||
return this.tokenizer.readToken<IFooter>(Structure.TagFooter).then((footer) => { | ||
if (footer.ID !== 'APETAGEX') { | ||
throw new Error('Expected footer to start with APETAGEX '); | ||
} | ||
return this.tokenizer.readToken<Buffer>(Structure.TagField(footer)).then((tags) => { | ||
return APEv2Parser.parseTags(footer, tags, !this.options.skipCovers); | ||
}); | ||
}); | ||
} | ||
} |
@@ -149,2 +149,6 @@ /// <reference types="node" /> | ||
numberOfSamples?: number; | ||
/** | ||
* 16-byte MD5 of raw audio | ||
*/ | ||
audioMD5?: Buffer; | ||
} | ||
@@ -151,0 +155,0 @@ export interface ITag { |
@@ -163,2 +163,7 @@ /* jshint maxlen: 300 */ | ||
numberOfSamples?: number | ||
/** | ||
* 16-byte MD5 of raw audio | ||
*/ | ||
audioMD5?: Buffer; | ||
} | ||
@@ -165,0 +170,0 @@ |
@@ -16,2 +16,3 @@ "use strict"; | ||
var RiffParser_1 = require("./riff/RiffParser"); | ||
var WavPackParser_1 = require("./wavpack/WavPackParser"); | ||
var ParserFactory = (function () { | ||
@@ -104,2 +105,5 @@ function ParserFactory() { | ||
return es6_promise_1.Promise.resolve(new RiffParser_1.WavePcmParser()); | ||
case '.wv': | ||
case '.wvp': | ||
return es6_promise_1.Promise.resolve(new WavPackParser_1.WavPackParser()); | ||
default: | ||
@@ -132,2 +136,4 @@ throw new Error("Extension " + extension + " not supported."); | ||
return es6_promise_1.Promise.resolve(new AiffParser_1.AIFFParser()); | ||
case 'audio/x-wavpack': | ||
return es6_promise_1.Promise.resolve(new WavPackParser_1.WavPackParser()); | ||
default: | ||
@@ -134,0 +140,0 @@ throw new Error("MIME-Type: " + mimeType + " not supported."); |
@@ -16,2 +16,3 @@ import {INativeAudioMetadata, IOptions} from "./"; | ||
import {WavePcmParser} from "./riff/RiffParser"; | ||
import {WavPackParser} from "./wavpack/WavPackParser"; | ||
@@ -118,2 +119,6 @@ export interface ITokenParser { | ||
case '.wv': | ||
case '.wvp': | ||
return Promise.resolve<ITokenParser>(new WavPackParser()); | ||
default: | ||
@@ -155,2 +160,5 @@ throw new Error("Extension " + extension + " not supported."); | ||
case 'audio/x-wavpack': | ||
return Promise.resolve<ITokenParser>(new WavPackParser()); | ||
default: | ||
@@ -157,0 +165,0 @@ throw new Error("MIME-Type: " + mimeType + " not supported."); |
{ | ||
"name": "music-metadata", | ||
"description": "Streaming music metadata parser for node and the browser.", | ||
"version": "0.7.10", | ||
"version": "0.7.11", | ||
"author": { | ||
@@ -57,12 +57,12 @@ "name": "Borewit", | ||
"fs-extra": "^4.0.1", | ||
"strtok3": "^1.0.3", | ||
"then-read-stream": "^0.9.1", | ||
"strtok3": "^1.1.0", | ||
"then-read-stream": "^0.9.2", | ||
"token-types": "^0.1.2" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.0.2", | ||
"@types/chai": "^4.0.3", | ||
"@types/es6-promise": "0.0.32", | ||
"@types/fs-extra": "^3.0.3", | ||
"@types/fs-extra": "^4.0.0", | ||
"@types/mocha": "^2.2.41", | ||
"@types/node": "^8.0.19", | ||
"@types/node": "^8.0.20", | ||
"chai": "^4.1.1", | ||
@@ -69,0 +69,0 @@ "coveralls": "^2.13.1", |
@@ -30,2 +30,3 @@ [![Build Status](https://travis-ci.org/Borewit/music-metadata.svg?branch=master)](https://travis-ci.org/Borewit/music-metadata) | ||
| wav | audio/wav, audio/wave | ID3v2 | | ||
| wv, wvp | audio/x-wavpack | APEv2 | | ||
@@ -32,0 +33,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
780527
130
11297
111
Updatedstrtok3@^1.1.0
Updatedthen-read-stream@^0.9.2