music-metadata-browser
Advanced tools
Comparing version 1.7.1 to 1.8.0
import { IAudioMetadata, IOptions } from 'music-metadata/lib/type'; | ||
import * as mm from 'music-metadata/lib/core'; | ||
export { IPicture, IAudioMetadata, IOptions, ITag, INativeTagDict } from 'music-metadata/lib/type'; | ||
export { IPicture, IAudioMetadata, IOptions, ITag, INativeTagDict, IChapter } from 'music-metadata/lib/type'; | ||
/** | ||
@@ -5,0 +5,0 @@ * Parse audio Stream |
@@ -34,6 +34,5 @@ "use strict"; | ||
methodDescription: 'parseStream()', | ||
parseUrl: (audioTrackUrl, options) => { | ||
return httpGetByUrl(audioTrackUrl).then(stream => { | ||
return mm.parseNodeStream(stream, stream.type, options); | ||
}); | ||
parseUrl: async (audioTrackUrl, options) => { | ||
const stream = await httpGetByUrl(audioTrackUrl); | ||
return mm.parseNodeStream(stream, stream.type, options); | ||
} | ||
@@ -43,6 +42,5 @@ }, | ||
methodDescription: 'parseBlob()', | ||
parseUrl: (audioTrackUrl, options) => { | ||
return getAsBlob(audioTrackUrl).then(blob => { | ||
return mm.parseBlob(blob, options); | ||
}); | ||
parseUrl: async (audioTrackUrl, options) => { | ||
const blob = await getAsBlob(audioTrackUrl); | ||
return mm.parseBlob(blob, options); | ||
} | ||
@@ -60,29 +58,28 @@ }, | ||
parsers.forEach(parser => { | ||
it(parser.methodDescription, () => { | ||
return parser.parseUrl(urlInBloom, { native: true }).then(metadata => { | ||
expect(metadata).toBeDefined(); | ||
expect(metadata.format.tagTypes).toEqual(['vorbis'], 'expect Vorbis metadata header'); | ||
expect(metadata.format.duration).toEqual(2.0, 'duration should be 2.0 sec'); | ||
expect(metadata.format.sampleRate).toEqual(44100, 'sample-rate should be 44.1 kHz'); | ||
expect(metadata.format.numberOfChannels).toEqual(2, 'number of channels should be 2 (stereo)'); | ||
expect(metadata.format.bitrate).toEqual(64000, 'bitrate should be 64 kbit/sec'); | ||
expect(metadata.common.title).toEqual('In Bloom'); | ||
expect(metadata.common.artist).toEqual('Nirvana'); | ||
expect(metadata.common.albumartist).toEqual('Nirvana', 'common.albumartist'); | ||
expect(metadata.common.album).toEqual('Nevermind', 'common.album'); | ||
expect(metadata.common.year).toEqual(1991, 'common.year'); | ||
expect(metadata.common.track).toEqual({ no: 2, of: 12 }, 'common.track'); | ||
expect(metadata.common.disk).toEqual({ no: 1, of: 1 }, 'common.disk'); | ||
expect(metadata.common.genre).toEqual(['Grunge', 'Alternative'], 'genre'); | ||
expect(metadata.common.picture[0].format).toEqual('image/jpeg', 'picture format'); | ||
expect(metadata.common.picture[0].data.length).toEqual(30966, 'picture length'); | ||
expect(metadata.common.barcode).toEqual('0720642442524', 'common.barcode (including leading zero)'); | ||
expect(metadata.common.asin).toEqual('B000003TA4', 'common.asin'); | ||
expect(metadata.common.catalognumber).toEqual(['GED24425'], 'common.asin'); | ||
expect(metadata.common.isrc).toEqual(['USGF19942502'], 'common.isrc'); | ||
// Make sure the orderTags is working | ||
const vorbisTags = mm.orderTags(metadata.native.vorbis); | ||
expect(vorbisTags.TRACKNUMBER).toEqual(['2'], 'vorbis.TRACKNUMBER'); | ||
expect(vorbisTags.TRACKTOTAL).toEqual(['12'], 'vorbis.TRACKTOTAL'); | ||
}); | ||
it(parser.methodDescription, async () => { | ||
const metadata = await parser.parseUrl(urlInBloom); | ||
expect(metadata).toBeDefined(); | ||
expect(metadata.format.tagTypes).toEqual(['vorbis'], 'expect Vorbis metadata header'); | ||
expect(metadata.format.duration).toEqual(2.0, 'duration should be 2.0 sec'); | ||
expect(metadata.format.sampleRate).toEqual(44100, 'sample-rate should be 44.1 kHz'); | ||
expect(metadata.format.numberOfChannels).toEqual(2, 'number of channels should be 2 (stereo)'); | ||
expect(metadata.format.bitrate).toEqual(64000, 'bitrate should be 64 kbit/sec'); | ||
expect(metadata.common.title).toEqual('In Bloom'); | ||
expect(metadata.common.artist).toEqual('Nirvana'); | ||
expect(metadata.common.albumartist).toEqual('Nirvana', 'common.albumartist'); | ||
expect(metadata.common.album).toEqual('Nevermind', 'common.album'); | ||
expect(metadata.common.year).toEqual(1991, 'common.year'); | ||
expect(metadata.common.track).toEqual({ no: 2, of: 12 }, 'common.track'); | ||
expect(metadata.common.disk).toEqual({ no: 1, of: 1 }, 'common.disk'); | ||
expect(metadata.common.genre).toEqual(['Grunge', 'Alternative'], 'genre'); | ||
expect(metadata.common.picture[0].format).toEqual('image/jpeg', 'picture format'); | ||
expect(metadata.common.picture[0].data.length).toEqual(30966, 'picture length'); | ||
expect(metadata.common.barcode).toEqual('0720642442524', 'common.barcode (including leading zero)'); | ||
expect(metadata.common.asin).toEqual('B000003TA4', 'common.asin'); | ||
expect(metadata.common.catalognumber).toEqual(['GED24425'], 'common.asin'); | ||
expect(metadata.common.isrc).toEqual(['USGF19942502'], 'common.isrc'); | ||
// Make sure the orderTags is working | ||
const vorbisTags = mm.orderTags(metadata.native.vorbis); | ||
expect(vorbisTags.TRACKNUMBER).toEqual(['2'], 'vorbis.TRACKNUMBER'); | ||
expect(vorbisTags.TRACKTOTAL).toEqual(['12'], 'vorbis.TRACKTOTAL'); | ||
}, 5000); | ||
@@ -99,8 +96,7 @@ }); | ||
test_data_1.tiuqottigeloot_vol24_Tracks.forEach(track => { | ||
it(`track ${track.metaData.artist} - ${track.metaData.title}`, () => { | ||
it(`track ${track.metaData.artist} - ${track.metaData.title}`, async () => { | ||
const url = test_data_1.providers.netlify.getUrl(track.url); | ||
return parser.parseUrl(url).then(metadata => { | ||
expect(metadata.common.artist).toEqual(track.metaData.artist); | ||
expect(metadata.common.title).toEqual(track.metaData.title); | ||
}); | ||
const metadata = await parser.parseUrl(url); | ||
expect(metadata.common.artist).toEqual(track.metaData.artist); | ||
expect(metadata.common.title).toEqual(track.metaData.title); | ||
}); | ||
@@ -107,0 +103,0 @@ }); |
{ | ||
"name": "music-metadata-browser", | ||
"version": "1.7.1", | ||
"version": "1.8.0", | ||
"description": "Browserifed version of music-metadata", | ||
@@ -106,3 +106,3 @@ "main": "lib/index.js", | ||
"debug": "^4.0.1", | ||
"music-metadata": "^4.9.2", | ||
"music-metadata": "^5.0.0", | ||
"readable-stream": "^3.3.0", | ||
@@ -109,0 +109,0 @@ "readable-web-to-node-stream": "^2.0.0", |
@@ -228,11 +228,8 @@ [![Build Status](https://travis-ci.org/Borewit/music-metadata-browser.svg?branch=master)](https://travis-ci.org/Borewit/music-metadata-browser) | ||
### Options | ||
The following (optional) configurations can be passed: | ||
* `duration`: default: `false`, if set to `true`, it will parse the whole media file if required to determine the duration. | ||
* `fileSize`: provide this if parsing from a stream. | ||
* `loadParser: (moduleName: string) => Promise<ITokenParser>;`: default: lazy load using require, allows custom async lazy loading of parser modules. The resolved `ITokenParser` will not be cached. | ||
* `native`: default: `false`, if set to `true`, it will return native tags in addition to the `common` tags. | ||
* `fileSize`: only provide this in combination with `parseStream` function. | ||
* `observer: (update: MetadataEvent) => void;`: Will be called after each change to `common` (generic) tag, or `format` properties. | ||
* `skipCovers`: default: `false`, if set to `true`, it will not return embedded cover-art (images). | ||
* `skipPostHeaders? boolean` default: `false`, if set to `true`, it will not search all the entire track for additional headers. Only recommenced to use in combination with streams. | ||
* `includeChapters` default: `false`, if set to `true`, it will parse chapters (currently only MP4 files). _experimental functionality_ | ||
@@ -247,3 +244,3 @@ Although in most cases duration is included, in some cases it requires `music-metadata` parsing the entire file. | ||
* [`format: IFormat`](#format) Audio format information | ||
* `native: INativeTags` List of native (original) tags found in the parsed audio file. If the native option is set to false, this property is not defined. | ||
* `native: INativeTags` List of native (original) tags found in the parsed audio file. | ||
* [`common: ICommonTagsResult`](https://github.com/Borewit/music-metadata/blob/master/doc/common_metadata.md) Is a generic (abstract) way of reading metadata information. | ||
@@ -254,3 +251,5 @@ | ||
Audio format information. Defined in the TypeScript `IFormat` interface: | ||
* `dataformat?: string` Audio encoding format. e.g.: 'flac' | ||
* `container?: string` Audio encoding format. e.g.: 'flac' | ||
* `codec?` Name of the codec (algorithm used for the audio compression) | ||
* `codecProfile?: string` Codec profile / settings | ||
* `tagTypes?: TagType[]` List of tagging formats found in parsed audio file | ||
@@ -261,4 +260,2 @@ * `duration?: number` Duration in seconds | ||
* `bitsPerSample?: number` Audio bit depth | ||
* `encoder?` Encoder name | ||
* `codecProfile?: string` Codec profile | ||
* `lossless?: boolean` True if lossless, false for lossy encoding | ||
@@ -265,0 +262,0 @@ * `numberOfChannels?: number` Number of audio channels |
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
34389
292
282
+ Added@tokenizer/token@0.1.1(transitive)
+ Addedmusic-metadata@5.4.3(transitive)
+ Addedstrtok3@4.1.1(transitive)
+ Addedthen-read-stream@3.0.1(transitive)
+ Addedtoken-types@2.1.1(transitive)
- Removedmusic-metadata@4.9.2(transitive)
- Removedstrtok3@3.1.7(transitive)
- Removedthen-read-stream@2.0.8(transitive)
- Removedtoken-types@1.3.2(transitive)
Updatedmusic-metadata@^5.0.0