music-metadata 7.11.6 → 7.11.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/lib/ParserFactory.d.ts +0 -1
- package/lib/ParserFactory.js +9 -8
- package/lib/aiff/AiffParser.d.ts +2 -3
- package/lib/aiff/AiffParser.js +2 -3
- package/lib/apev2/APEv2Parser.js +1 -2
- package/lib/apev2/APEv2Token.d.ts +5 -5
- package/lib/asf/AsfParser.d.ts +5 -5
- package/lib/asf/AsfParser.js +7 -7
- package/lib/asf/GUID.d.ts +14 -16
- package/lib/asf/GUID.js +13 -15
- package/lib/common/CombinedTagMapper.d.ts +3 -3
- package/lib/common/CombinedTagMapper.js +1 -1
- package/lib/common/GenericTagMapper.d.ts +2 -2
- package/lib/common/GenericTagMapper.js +2 -2
- package/lib/common/MetadataCollector.js +2 -2
- package/lib/common/Util.d.ts +5 -4
- package/lib/common/Util.js +12 -24
- package/lib/dsdiff/DsdiffParser.d.ts +1 -1
- package/lib/dsdiff/DsdiffParser.js +1 -1
- package/lib/dsf/DsfParser.d.ts +1 -1
- package/lib/dsf/DsfParser.js +1 -1
- package/lib/flac/FlacParser.d.ts +1 -1
- package/lib/flac/FlacParser.js +12 -12
- package/lib/id3v1/ID3v1Parser.js +39 -39
- package/lib/id3v2/AbstractID3Parser.d.ts +1 -1
- package/lib/id3v2/AbstractID3Parser.js +3 -3
- package/lib/id3v2/FrameParser.js +7 -1
- package/lib/id3v2/ID3v24TagMapper.d.ts +2 -2
- package/lib/id3v2/ID3v24TagMapper.js +2 -2
- package/lib/id3v2/ID3v2Parser.d.ts +3 -3
- package/lib/id3v2/ID3v2Parser.js +5 -15
- package/lib/iff/index.d.ts +2 -2
- package/lib/matroska/MatroskaDtd.d.ts +1 -1
- package/lib/matroska/MatroskaDtd.js +1 -1
- package/lib/matroska/MatroskaParser.js +9 -9
- package/lib/matroska/types.d.ts +2 -2
- package/lib/matroska/types.js +1 -0
- package/lib/mp4/AtomToken.d.ts +6 -6
- package/lib/mp4/AtomToken.js +2 -2
- package/lib/mp4/MP4Parser.js +3 -3
- package/lib/mpeg/MpegParser.d.ts +1 -1
- package/lib/mpeg/MpegParser.js +4 -9
- package/lib/musepack/index.d.ts +1 -1
- package/lib/musepack/index.js +1 -1
- package/lib/ogg/speex/SpeexParser.d.ts +2 -2
- package/lib/ogg/speex/SpeexParser.js +2 -2
- package/lib/ogg/theora/TheoraParser.d.ts +1 -1
- package/lib/ogg/theora/TheoraParser.js +1 -1
- package/lib/ogg/vorbis/Vorbis.d.ts +1 -11
- package/lib/type.d.ts +2 -9
- package/lib/type.js +2 -10
- package/lib/wav/BwfChunk.d.ts +17 -0
- package/lib/wav/BwfChunk.js +28 -0
- package/lib/wav/WaveParser.d.ts +3 -3
- package/lib/wav/WaveParser.js +15 -3
- package/lib/wavpack/WavPackParser.js +1 -7
- package/lib/wavpack/WavPackToken.d.ts +2 -2
- package/lib/wavpack/WavPackToken.js +1 -1
- package/package.json +22 -14
package/lib/type.js
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TrackType = void 0;
|
|
4
|
-
var
|
|
5
|
-
(function (
|
|
6
|
-
TrackType[TrackType["video"] = 1] = "video";
|
|
7
|
-
TrackType[TrackType["audio"] = 2] = "audio";
|
|
8
|
-
TrackType[TrackType["complex"] = 3] = "complex";
|
|
9
|
-
TrackType[TrackType["logo"] = 4] = "logo";
|
|
10
|
-
TrackType[TrackType["subtitle"] = 17] = "subtitle";
|
|
11
|
-
TrackType[TrackType["button"] = 18] = "button";
|
|
12
|
-
TrackType[TrackType["control"] = 32] = "control";
|
|
13
|
-
})(TrackType = exports.TrackType || (exports.TrackType = {}));
|
|
4
|
+
var types_1 = require("./matroska/types");
|
|
5
|
+
Object.defineProperty(exports, "TrackType", { enumerable: true, get: function () { return types_1.TrackType; } });
|
|
14
6
|
//# sourceMappingURL=type.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IGetToken } from 'strtok3/lib/core';
|
|
2
|
+
export interface IBroadcastAudioExtensionChunk {
|
|
3
|
+
description: string;
|
|
4
|
+
originator: string;
|
|
5
|
+
originatorReference: string;
|
|
6
|
+
originationDate: string;
|
|
7
|
+
originationTime: string;
|
|
8
|
+
timeReferenceLow: number;
|
|
9
|
+
timeReferenceHigh: number;
|
|
10
|
+
version: number;
|
|
11
|
+
umid: Uint8Array;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Broadcast Audio Extension Chunk
|
|
15
|
+
* Ref: https://tech.ebu.ch/docs/tech/tech3285.pdf
|
|
16
|
+
*/
|
|
17
|
+
export declare const BroadcastAudioExtensionChunk: IGetToken<IBroadcastAudioExtensionChunk>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BroadcastAudioExtensionChunk = void 0;
|
|
4
|
+
const Token = require("token-types");
|
|
5
|
+
/**
|
|
6
|
+
* Broadcast Audio Extension Chunk
|
|
7
|
+
* Ref: https://tech.ebu.ch/docs/tech/tech3285.pdf
|
|
8
|
+
*/
|
|
9
|
+
exports.BroadcastAudioExtensionChunk = {
|
|
10
|
+
len: 420,
|
|
11
|
+
get: (uint8array, off) => {
|
|
12
|
+
return {
|
|
13
|
+
description: new Token.StringType(256, 'ascii').get(uint8array, off).trim(),
|
|
14
|
+
originator: new Token.StringType(32, 'ascii').get(uint8array, off + 256).trim(),
|
|
15
|
+
originatorReference: new Token.StringType(32, 'ascii').get(uint8array, off + 288).trim(),
|
|
16
|
+
originationDate: new Token.StringType(10, 'ascii').get(uint8array, off + 320).trim(),
|
|
17
|
+
originationTime: new Token.StringType(8, 'ascii').get(uint8array, off + 330).trim(),
|
|
18
|
+
timeReferenceLow: Token.UINT32_LE.get(uint8array, off + 338),
|
|
19
|
+
timeReferenceHigh: Token.UINT32_LE.get(uint8array, off + 342),
|
|
20
|
+
version: Token.UINT16_LE.get(uint8array, off + 346),
|
|
21
|
+
umid: new Token.Uint8ArrayType(64).get(uint8array, off + 348),
|
|
22
|
+
loudnessValue: Token.UINT16_LE.get(uint8array, off + 412),
|
|
23
|
+
maxTruePeakLevel: Token.UINT16_LE.get(uint8array, off + 414),
|
|
24
|
+
maxMomentaryLoudness: Token.UINT16_LE.get(uint8array, off + 416),
|
|
25
|
+
maxShortTermLoudness: Token.UINT16_LE.get(uint8array, off + 418)
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
};
|
package/lib/wav/WaveParser.d.ts
CHANGED
|
@@ -6,10 +6,10 @@ import { BasicParser } from '../common/BasicParser';
|
|
|
6
6
|
* WAVE PCM soundfile format
|
|
7
7
|
*
|
|
8
8
|
* Ref:
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* - http://www.johnloomis.org/cpe102/asgn/asgn1/riff.html
|
|
10
|
+
* - http://soundfile.sapp.org/doc/WaveFormat
|
|
11
11
|
*
|
|
12
|
-
*
|
|
12
|
+
* ToDo: Split WAVE part from RIFF parser
|
|
13
13
|
*/
|
|
14
14
|
export declare class WaveParser extends BasicParser {
|
|
15
15
|
private fact;
|
package/lib/wav/WaveParser.js
CHANGED
|
@@ -10,6 +10,7 @@ const ID3v2Parser_1 = require("../id3v2/ID3v2Parser");
|
|
|
10
10
|
const util = require("../common/Util");
|
|
11
11
|
const FourCC_1 = require("../common/FourCC");
|
|
12
12
|
const BasicParser_1 = require("../common/BasicParser");
|
|
13
|
+
const BwfChunk_1 = require("../wav/BwfChunk");
|
|
13
14
|
const debug = initDebug('music-metadata:parser:RIFF');
|
|
14
15
|
/**
|
|
15
16
|
* Resource Interchange File Format (RIFF) Parser
|
|
@@ -17,10 +18,10 @@ const debug = initDebug('music-metadata:parser:RIFF');
|
|
|
17
18
|
* WAVE PCM soundfile format
|
|
18
19
|
*
|
|
19
20
|
* Ref:
|
|
20
|
-
*
|
|
21
|
-
*
|
|
21
|
+
* - http://www.johnloomis.org/cpe102/asgn/asgn1/riff.html
|
|
22
|
+
* - http://soundfile.sapp.org/doc/WaveFormat
|
|
22
23
|
*
|
|
23
|
-
*
|
|
24
|
+
* ToDo: Split WAVE part from RIFF parser
|
|
24
25
|
*/
|
|
25
26
|
class WaveParser extends BasicParser_1.BasicParser {
|
|
26
27
|
async parse() {
|
|
@@ -101,6 +102,17 @@ class WaveParser extends BasicParser_1.BasicParser {
|
|
|
101
102
|
this.metadata.setFormat('bitrate', this.metadata.format.numberOfChannels * this.blockAlign * this.metadata.format.sampleRate); // ToDo: check me
|
|
102
103
|
await this.tokenizer.ignore(header.chunkSize);
|
|
103
104
|
break;
|
|
105
|
+
case 'bext': // Broadcast Audio Extension chunk https://tech.ebu.ch/docs/tech/tech3285.pdf
|
|
106
|
+
const bext = await this.tokenizer.readToken(BwfChunk_1.BroadcastAudioExtensionChunk);
|
|
107
|
+
Object.keys(bext).forEach(key => {
|
|
108
|
+
this.metadata.addTag('exif', 'bext.' + key, bext[key]);
|
|
109
|
+
});
|
|
110
|
+
break;
|
|
111
|
+
case '\x00\x00\x00\x00': // padding ??
|
|
112
|
+
debug(`Ignore padding chunk: RIFF/${header.chunkID} of ${header.chunkSize} bytes`);
|
|
113
|
+
this.metadata.addWarning('Ignore chunk: RIFF/' + header.chunkID);
|
|
114
|
+
await this.tokenizer.ignore(header.chunkSize);
|
|
115
|
+
break;
|
|
104
116
|
default:
|
|
105
117
|
debug(`Ignore chunk: RIFF/${header.chunkID} of ${header.chunkSize} bytes`);
|
|
106
118
|
this.metadata.addWarning('Ignore chunk: RIFF/' + header.chunkID);
|
|
@@ -43,13 +43,7 @@ class WavPackParser extends BasicParser_1.BasicParser {
|
|
|
43
43
|
this.metadata.setFormat('codec', header.flags.isDSD ? 'DSD' : 'PCM');
|
|
44
44
|
}
|
|
45
45
|
const ignoreBytes = header.blockSize - (WavPackToken_1.WavPack.BlockHeaderToken.len - 8);
|
|
46
|
-
|
|
47
|
-
// Meta-data block
|
|
48
|
-
await this.parseMetadataSubBlock(header, ignoreBytes);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
await this.tokenizer.ignore(ignoreBytes);
|
|
52
|
-
}
|
|
46
|
+
await (header.blockIndex === 0 ? this.parseMetadataSubBlock(header, ignoreBytes) : this.tokenizer.ignore(ignoreBytes));
|
|
53
47
|
if (header.blockSamples > 0) {
|
|
54
48
|
this.audioDataSize += header.blockSize; // Count audio data for bit-rate calculation
|
|
55
49
|
}
|
|
@@ -5,7 +5,7 @@ import { IGetToken } from 'strtok3/lib/core';
|
|
|
5
5
|
* 32-byte little-endian header at the front of every WavPack block
|
|
6
6
|
*
|
|
7
7
|
* Ref:
|
|
8
|
-
*
|
|
8
|
+
* - http://www.wavpack.com/WavPack5FileFormat.pdf (page 2/6: 2.0 "Block Header")
|
|
9
9
|
*/
|
|
10
10
|
export interface IBlockHeader {
|
|
11
11
|
BlockID: string;
|
|
@@ -56,7 +56,7 @@ export declare class WavPack {
|
|
|
56
56
|
static BlockHeaderToken: IGetToken<IBlockHeader>;
|
|
57
57
|
/**
|
|
58
58
|
* 3.0 Metadata Sub-Blocks
|
|
59
|
-
*
|
|
59
|
+
* Ref: http://www.wavpack.com/WavPack5FileFormat.pdf (page 4/6: 3.0 "Metadata Sub-Block")
|
|
60
60
|
*/
|
|
61
61
|
static MetadataIdToken: IGetToken<IMetadataId>;
|
|
62
62
|
private static isBitSet;
|
|
@@ -61,7 +61,7 @@ WavPack.BlockHeaderToken = {
|
|
|
61
61
|
};
|
|
62
62
|
/**
|
|
63
63
|
* 3.0 Metadata Sub-Blocks
|
|
64
|
-
*
|
|
64
|
+
* Ref: http://www.wavpack.com/WavPack5FileFormat.pdf (page 4/6: 3.0 "Metadata Sub-Block")
|
|
65
65
|
*/
|
|
66
66
|
WavPack.MetadataIdToken = {
|
|
67
67
|
len: 1,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "music-metadata",
|
|
3
3
|
"description": "Music metadata parser for Node.js, supporting virtual any audio and tag format.",
|
|
4
|
-
"version": "7.11.
|
|
4
|
+
"version": "7.11.9",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Borewit",
|
|
7
7
|
"url": "https://github.com/Borewit"
|
|
@@ -57,7 +57,8 @@
|
|
|
57
57
|
"chapter",
|
|
58
58
|
"info",
|
|
59
59
|
"parse",
|
|
60
|
-
"parser"
|
|
60
|
+
"parser",
|
|
61
|
+
"bwf"
|
|
61
62
|
],
|
|
62
63
|
"main": "lib/index.js",
|
|
63
64
|
"types": "lib/index.d.ts",
|
|
@@ -66,14 +67,14 @@
|
|
|
66
67
|
"lib/**/*.d.ts"
|
|
67
68
|
],
|
|
68
69
|
"scripts": {
|
|
69
|
-
"clean": "del-cli lib/**/*.js lib/**/*.js.map lib/**/*.d.ts src/**/*.d.ts test/**/*.js test/**/*.js.map",
|
|
70
|
+
"clean": "del-cli lib/**/*.js lib/**/*.js.map lib/**/*.d.ts src/**/*.d.ts test/**/*.js test/**/*.js.map test/**/*.js test/**/*.js.map doc-gen/**/*.js doc-gen/**/*.js.map",
|
|
70
71
|
"compile-src": "tsc -p lib",
|
|
71
72
|
"compile-test": "tsc -p test",
|
|
72
73
|
"compile-doc": "tsc -p doc-gen",
|
|
73
74
|
"compile": "npm run compile-src && npm run compile-test && npm run compile-doc",
|
|
74
|
-
"
|
|
75
|
+
"eslint": "eslint lib/**/*.ts --ignore-pattern lib/**/*.d.ts example/typescript/**/*.ts test/**/*.ts doc-gen/**/*.ts",
|
|
75
76
|
"lint-md": "remark -u preset-lint-recommended .",
|
|
76
|
-
"lint": "npm run lint-md && npm run
|
|
77
|
+
"lint": "npm run lint-md && npm run eslint",
|
|
77
78
|
"test": "mocha --require ts-node/register --require source-map-support/register --full-trace test/test-*.ts",
|
|
78
79
|
"build": "npm run clean && npm run compile && npm run doc-gen",
|
|
79
80
|
"start": "npm-run-all compile lint cover-test",
|
|
@@ -83,6 +84,7 @@
|
|
|
83
84
|
"doc-gen": "node doc-gen/gen.js"
|
|
84
85
|
},
|
|
85
86
|
"dependencies": {
|
|
87
|
+
"@tokenizer/token": "^0.3.0",
|
|
86
88
|
"content-type": "^1.0.4",
|
|
87
89
|
"debug": "^4.3.3",
|
|
88
90
|
"file-type": "16.5.3",
|
|
@@ -91,26 +93,32 @@
|
|
|
91
93
|
"token-types": "^4.1.1"
|
|
92
94
|
},
|
|
93
95
|
"devDependencies": {
|
|
94
|
-
"@tokenizer/token": "^0.3.0",
|
|
95
96
|
"@types/chai": "^4.3.0",
|
|
96
97
|
"@types/debug": "^4.1.7",
|
|
97
98
|
"@types/file-type": "^10.9.1",
|
|
98
|
-
"@types/mocha": "^9.
|
|
99
|
-
"@types/node": "^17.0.
|
|
100
|
-
"
|
|
99
|
+
"@types/mocha": "^9.1.0",
|
|
100
|
+
"@types/node": "^17.0.17",
|
|
101
|
+
"@typescript-eslint/eslint-plugin": "^5.11.0",
|
|
102
|
+
"@typescript-eslint/parser": "^5.11.0",
|
|
103
|
+
"chai": "^4.3.6",
|
|
101
104
|
"coveralls": "^3.1.1",
|
|
102
105
|
"del-cli": "4.0.1",
|
|
103
|
-
"eslint": "8.
|
|
106
|
+
"eslint": "^8.8.0",
|
|
107
|
+
"eslint-config-prettier": "^8.3.0",
|
|
108
|
+
"eslint-import-resolver-typescript": "^2.5.0",
|
|
109
|
+
"eslint-plugin-import": "^2.25.4",
|
|
110
|
+
"eslint-plugin-jsdoc": "^37.8.2",
|
|
111
|
+
"eslint-plugin-node": "^11.1.0",
|
|
112
|
+
"eslint-plugin-unicorn": "^40.1.0",
|
|
104
113
|
"mime": "^3.0.0",
|
|
105
|
-
"mocha": "^9.
|
|
114
|
+
"mocha": "^9.2.0",
|
|
106
115
|
"npm-run-all": "^4.1.5",
|
|
107
116
|
"nyc": "^15.1.0",
|
|
108
117
|
"remark-cli": "^10.0.1",
|
|
109
118
|
"remark-preset-lint-recommended": "^6.1.2",
|
|
110
119
|
"source-map-support": "^0.5.21",
|
|
111
|
-
"ts-node": "^10.
|
|
112
|
-
"
|
|
113
|
-
"typescript": "^4.5.4"
|
|
120
|
+
"ts-node": "^10.5.0",
|
|
121
|
+
"typescript": "^4.5.5"
|
|
114
122
|
},
|
|
115
123
|
"engines": {
|
|
116
124
|
"node": ">=10"
|