music-metadata 7.11.2 → 7.11.6
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/lib/aiff/AiffToken.d.ts +1 -1
- package/lib/apev2/APEv2Parser.js +1 -1
- package/lib/apev2/APEv2TagMapper.js +1 -0
- package/lib/apev2/APEv2Token.js +1 -0
- package/lib/asf/AsfObject.d.ts +1 -1
- package/lib/asf/AsfParser.js +1 -1
- package/lib/asf/AsfTagMapper.js +1 -0
- package/lib/asf/AsfUtil.d.ts +1 -1
- package/lib/asf/AsfUtil.js +1 -1
- package/lib/common/CaseInsensitiveTagMap.js +1 -0
- package/lib/common/CombinedTagMapper.js +1 -0
- package/lib/common/FourCC.d.ts +1 -1
- package/lib/common/FourCC.js +2 -1
- package/lib/common/GenericTagMapper.js +1 -0
- package/lib/common/GenericTagTypes.js +1 -0
- package/lib/common/MetadataCollector.d.ts +4 -4
- package/lib/common/MetadataCollector.js +6 -4
- package/lib/common/Util.js +1 -0
- package/lib/core.js +2 -2
- package/lib/dsdiff/DsdiffParser.js +2 -2
- package/lib/dsdiff/DsdiffToken.d.ts +1 -1
- package/lib/dsf/DsfParser.js +2 -2
- package/lib/flac/FlacParser.d.ts +1 -1
- package/lib/flac/FlacParser.js +3 -3
- package/lib/id3v1/ID3v1Parser.js +1 -1
- package/lib/id3v1/ID3v1TagMap.d.ts +1 -1
- package/lib/id3v1/ID3v1TagMap.js +1 -0
- package/lib/id3v2/AbstractID3Parser.js +4 -4
- package/lib/id3v2/ID3v22TagMapper.js +3 -1
- package/lib/id3v2/ID3v24TagMapper.d.ts +1 -1
- package/lib/id3v2/ID3v24TagMapper.js +2 -1
- package/lib/id3v2/ID3v2Token.d.ts +1 -1
- package/lib/iff/index.d.ts +3 -3
- package/lib/iff/index.js +1 -1
- package/lib/index.d.ts +11 -0
- package/lib/index.js +10 -0
- package/lib/matroska/MatroskaParser.d.ts +1 -1
- package/lib/matroska/MatroskaParser.js +2 -1
- package/lib/matroska/MatroskaTagMapper.js +1 -0
- package/lib/mp4/AtomToken.js +1 -1
- package/lib/mp4/MP4Parser.d.ts +1 -2
- package/lib/mp4/MP4Parser.js +10 -14
- package/lib/mp4/MP4TagMapper.js +1 -0
- package/lib/mpeg/MpegParser.js +1 -1
- package/lib/mpeg/XingTag.d.ts +1 -1
- package/lib/musepack/index.js +1 -1
- package/lib/musepack/sv7/MpcSv7Parser.js +2 -2
- package/lib/musepack/sv8/MpcSv8Parser.js +1 -1
- package/lib/musepack/sv8/StreamVersion8.js +1 -1
- package/lib/ogg/OggParser.d.ts +2 -2
- package/lib/ogg/OggParser.js +2 -2
- package/lib/ogg/opus/OpusParser.js +1 -1
- package/lib/ogg/speex/SpeexParser.js +1 -1
- package/lib/ogg/vorbis/Vorbis.d.ts +1 -1
- package/lib/ogg/vorbis/VorbisTagMapper.js +1 -0
- package/lib/riff/RiffChunk.d.ts +1 -1
- package/lib/riff/RiffInfoTagMap.js +1 -0
- package/lib/type.d.ts +1 -1
- package/lib/type.js +1 -0
- package/lib/wav/WaveChunk.d.ts +1 -1
- package/package.json +12 -12
package/lib/aiff/AiffToken.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import { IGetToken } from 'strtok3';
|
|
2
3
|
import * as iff from '../iff';
|
|
3
|
-
import { IGetToken } from "strtok3";
|
|
4
4
|
/**
|
|
5
5
|
* The Common Chunk.
|
|
6
6
|
* Describes fundamental parameters of the waveform data such as sample rate, bit resolution, and how many channels of
|
package/lib/apev2/APEv2Parser.js
CHANGED
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.APEv2Parser = void 0;
|
|
4
4
|
const initDebug = require("debug");
|
|
5
5
|
const strtok3 = require("strtok3/lib/core");
|
|
6
|
+
const token_types_1 = require("token-types");
|
|
6
7
|
const util = require("../common/Util");
|
|
7
8
|
const BasicParser_1 = require("../common/BasicParser");
|
|
8
9
|
const APEv2Token_1 = require("./APEv2Token");
|
|
9
|
-
const token_types_1 = require("token-types");
|
|
10
10
|
const debug = initDebug('music-metadata:parser:APEv2');
|
|
11
11
|
const tagFormat = 'APEv2';
|
|
12
12
|
const preamble = 'APETAGEX';
|
package/lib/apev2/APEv2Token.js
CHANGED
package/lib/asf/AsfObject.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import { IGetToken, ITokenizer } from 'strtok3/lib/core';
|
|
2
3
|
import { IPicture, ITag } from '../type';
|
|
3
4
|
import GUID from './GUID';
|
|
4
|
-
import { IGetToken, ITokenizer } from 'strtok3/lib/core';
|
|
5
5
|
/**
|
|
6
6
|
* Data Type: Specifies the type of information being stored. The following values are recognized.
|
|
7
7
|
*/
|
package/lib/asf/AsfParser.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AsfParser = void 0;
|
|
4
|
+
const _debug = require("debug");
|
|
4
5
|
const type_1 = require("../type");
|
|
5
6
|
const GUID_1 = require("./GUID");
|
|
6
7
|
const AsfObject = require("./AsfObject");
|
|
7
|
-
const _debug = require("debug");
|
|
8
8
|
const BasicParser_1 = require("../common/BasicParser");
|
|
9
9
|
const debug = _debug('music-metadata:parser:ASF');
|
|
10
10
|
const headerType = 'asf';
|
package/lib/asf/AsfTagMapper.js
CHANGED
package/lib/asf/AsfUtil.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { DataType } from
|
|
2
|
+
import { DataType } from './AsfObject';
|
|
3
3
|
export declare type AttributeParser = (buf: Buffer) => boolean | string | number | bigint | Buffer;
|
|
4
4
|
export declare class AsfUtil {
|
|
5
5
|
static getParserForAttr(i: DataType): AttributeParser;
|
package/lib/asf/AsfUtil.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AsfUtil = void 0;
|
|
4
|
-
const util = require("../common/Util");
|
|
5
4
|
const Token = require("token-types");
|
|
5
|
+
const util = require("../common/Util");
|
|
6
6
|
class AsfUtil {
|
|
7
7
|
static getParserForAttr(i) {
|
|
8
8
|
return AsfUtil.attributeParsers[i];
|
package/lib/common/FourCC.d.ts
CHANGED
package/lib/common/FourCC.js
CHANGED
|
@@ -22,7 +22,8 @@ exports.FourCcToken = {
|
|
|
22
22
|
put: (buffer, offset, id) => {
|
|
23
23
|
const str = Buffer.from(id, 'binary');
|
|
24
24
|
if (str.length !== 4)
|
|
25
|
-
throw new Error(
|
|
25
|
+
throw new Error('Invalid length');
|
|
26
26
|
return str.copy(buffer, offset);
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
+
//# sourceMappingURL=FourCC.js.map
|
|
@@ -21,9 +21,9 @@ export interface INativeMetadataCollector extends IWarningCollector {
|
|
|
21
21
|
* @returns {boolean} true if one or more tags have been found
|
|
22
22
|
*/
|
|
23
23
|
hasAny(): boolean;
|
|
24
|
-
setFormat(key: FormatId, value: any):
|
|
25
|
-
addTag(tagType: TagType, tagId: string, value: any):
|
|
26
|
-
addStreamInfo(streamInfo: ITrackInfo):
|
|
24
|
+
setFormat(key: FormatId, value: any): void;
|
|
25
|
+
addTag(tagType: TagType, tagId: string, value: any): void;
|
|
26
|
+
addStreamInfo(streamInfo: ITrackInfo): void;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Provided to the parser to uodate the metadata result.
|
|
@@ -61,7 +61,7 @@ export declare class MetadataCollector implements INativeMetadataCollector {
|
|
|
61
61
|
toCommonMetadata(): IAudioMetadata;
|
|
62
62
|
/**
|
|
63
63
|
* Fix some common issues with picture object
|
|
64
|
-
* @param
|
|
64
|
+
* @param picture Picture
|
|
65
65
|
*/
|
|
66
66
|
private postFixPicture;
|
|
67
67
|
/**
|
|
@@ -126,6 +126,7 @@ class MetadataCollector {
|
|
|
126
126
|
this.common[tag.id] = GenericTagMapper_1.CommonTagMapper.normalizeTrack(tag.value);
|
|
127
127
|
this.common[tag.id].of = of != null ? of : this.common[tag.id].of;
|
|
128
128
|
return;
|
|
129
|
+
case 'bpm':
|
|
129
130
|
case 'year':
|
|
130
131
|
case 'originalyear':
|
|
131
132
|
tag.value = parseInt(tag.value, 10);
|
|
@@ -148,7 +149,7 @@ class MetadataCollector {
|
|
|
148
149
|
case 'replaygain_track_peak':
|
|
149
150
|
case 'replaygain_album_gain':
|
|
150
151
|
case 'replaygain_album_peak':
|
|
151
|
-
tag.value = Util_1.toRatio(tag.value);
|
|
152
|
+
tag.value = (0, Util_1.toRatio)(tag.value);
|
|
152
153
|
break;
|
|
153
154
|
case 'replaygain_track_minmax':
|
|
154
155
|
tag.value = tag.value.split(',').map(v => parseInt(v, 10));
|
|
@@ -191,7 +192,7 @@ class MetadataCollector {
|
|
|
191
192
|
}
|
|
192
193
|
/**
|
|
193
194
|
* Fix some common issues with picture object
|
|
194
|
-
* @param
|
|
195
|
+
* @param picture Picture
|
|
195
196
|
*/
|
|
196
197
|
async postFixPicture(picture) {
|
|
197
198
|
if (picture.data && picture.data.length > 0) {
|
|
@@ -231,7 +232,7 @@ class MetadataCollector {
|
|
|
231
232
|
debug(`common.${tag.id} = ${tag.value}`);
|
|
232
233
|
const prio0 = this.commonOrigin[tag.id] || 1000;
|
|
233
234
|
const prio1 = this.originPriority[tagType];
|
|
234
|
-
if (GenericTagTypes_1.isSingleton(tag.id)) {
|
|
235
|
+
if ((0, GenericTagTypes_1.isSingleton)(tag.id)) {
|
|
235
236
|
if (prio1 <= prio0) {
|
|
236
237
|
this.common[tag.id] = tag.value;
|
|
237
238
|
this.commonOrigin[tag.id] = prio1;
|
|
@@ -242,7 +243,7 @@ class MetadataCollector {
|
|
|
242
243
|
}
|
|
243
244
|
else {
|
|
244
245
|
if (prio1 === prio0) {
|
|
245
|
-
if (!GenericTagTypes_1.isUnique(tag.id) || this.common[tag.id].indexOf(tag.value) === -1) {
|
|
246
|
+
if (!(0, GenericTagTypes_1.isUnique)(tag.id) || this.common[tag.id].indexOf(tag.value) === -1) {
|
|
246
247
|
this.common[tag.id].push(tag.value);
|
|
247
248
|
}
|
|
248
249
|
else {
|
|
@@ -272,3 +273,4 @@ function joinArtists(artists) {
|
|
|
272
273
|
return artists.join(' & ');
|
|
273
274
|
}
|
|
274
275
|
exports.joinArtists = joinArtists;
|
|
276
|
+
//# sourceMappingURL=MetadataCollector.js.map
|
package/lib/common/Util.js
CHANGED
package/lib/core.js
CHANGED
|
@@ -80,9 +80,9 @@ function selectCover(pictures) {
|
|
|
80
80
|
exports.selectCover = selectCover;
|
|
81
81
|
async function scanAppendingHeaders(randomReader, options = {}) {
|
|
82
82
|
let apeOffset = randomReader.fileSize;
|
|
83
|
-
if (await ID3v1Parser_1.hasID3v1Header(randomReader)) {
|
|
83
|
+
if (await (0, ID3v1Parser_1.hasID3v1Header)(randomReader)) {
|
|
84
84
|
apeOffset -= 128;
|
|
85
|
-
const lyricsLen = await Lyrics3_1.getLyricsHeaderLength(randomReader);
|
|
85
|
+
const lyricsLen = await (0, Lyrics3_1.getLyricsHeaderLength)(randomReader);
|
|
86
86
|
apeOffset -= lyricsLen;
|
|
87
87
|
}
|
|
88
88
|
options.apeHeader = await APEv2Parser_1.APEv2Parser.findApeFooterOffset(randomReader, apeOffset);
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DsdiffParser = void 0;
|
|
4
4
|
const Token = require("token-types");
|
|
5
5
|
const initDebug = require("debug");
|
|
6
|
+
const strtok3 = require("strtok3/lib/core");
|
|
6
7
|
const FourCC_1 = require("../common/FourCC");
|
|
7
8
|
const BasicParser_1 = require("../common/BasicParser");
|
|
8
|
-
const DsdiffToken_1 = require("./DsdiffToken");
|
|
9
|
-
const strtok3 = require("strtok3/lib/core");
|
|
10
9
|
const ID3v2Parser_1 = require("../id3v2/ID3v2Parser");
|
|
10
|
+
const DsdiffToken_1 = require("./DsdiffToken");
|
|
11
11
|
const debug = initDebug('music-metadata:parser:aiff');
|
|
12
12
|
/**
|
|
13
13
|
* DSDIFF - Direct Stream Digital Interchange File Format (Phillips)
|
package/lib/dsf/DsfParser.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DsfParser = void 0;
|
|
4
|
-
const AbstractID3Parser_1 = require("../id3v2/AbstractID3Parser");
|
|
5
4
|
const _debug = require("debug");
|
|
5
|
+
const AbstractID3Parser_1 = require("../id3v2/AbstractID3Parser");
|
|
6
6
|
const DsfChunk_1 = require("./DsfChunk");
|
|
7
7
|
const ID3v2Parser_1 = require("../id3v2/ID3v2Parser");
|
|
8
8
|
const debug = _debug('music-metadata:parser:DSF');
|
package/lib/flac/FlacParser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ITokenizer } from 'strtok3/lib/core';
|
|
1
2
|
import { AbstractID3Parser } from '../id3v2/AbstractID3Parser';
|
|
2
3
|
import { INativeMetadataCollector } from '../common/MetadataCollector';
|
|
3
|
-
import { ITokenizer } from 'strtok3/lib/core';
|
|
4
4
|
import { IOptions } from '../type';
|
|
5
5
|
import { ITokenParser } from '../ParserFactory';
|
|
6
6
|
export declare class FlacParser extends AbstractID3Parser {
|
package/lib/flac/FlacParser.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FlacParser = void 0;
|
|
4
|
-
const util = require("../common/Util");
|
|
5
4
|
const Token = require("token-types");
|
|
5
|
+
const _debug = require("debug");
|
|
6
|
+
const util = require("../common/Util");
|
|
6
7
|
const Vorbis_1 = require("../ogg/vorbis/Vorbis");
|
|
7
8
|
const AbstractID3Parser_1 = require("../id3v2/AbstractID3Parser");
|
|
8
9
|
const FourCC_1 = require("../common/FourCC");
|
|
9
|
-
const _debug = require("debug");
|
|
10
10
|
const VorbisParser_1 = require("../ogg/vorbis/VorbisParser");
|
|
11
11
|
const VorbisDecoder_1 = require("../ogg/vorbis/VorbisDecoder");
|
|
12
12
|
const debug = _debug('music-metadata:parser:FLAC');
|
package/lib/id3v1/ID3v1Parser.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hasID3v1Header = exports.ID3v1Parser = exports.Genres = void 0;
|
|
4
4
|
const initDebug = require("debug");
|
|
5
|
-
const util = require("../common/Util");
|
|
6
5
|
const Token = require("token-types");
|
|
6
|
+
const util = require("../common/Util");
|
|
7
7
|
const BasicParser_1 = require("../common/BasicParser");
|
|
8
8
|
const APEv2Parser_1 = require("../apev2/APEv2Parser");
|
|
9
9
|
const debug = initDebug('music-metadata:parser:ID3v1');
|
package/lib/id3v1/ID3v1TagMap.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AbstractID3Parser = void 0;
|
|
4
4
|
const core_1 = require("strtok3/lib/core");
|
|
5
|
+
const _debug = require("debug");
|
|
5
6
|
const ID3v2Token_1 = require("./ID3v2Token");
|
|
6
7
|
const ID3v2Parser_1 = require("./ID3v2Parser");
|
|
7
8
|
const ID3v1Parser_1 = require("../id3v1/ID3v1Parser");
|
|
8
|
-
const _debug = require("debug");
|
|
9
9
|
const BasicParser_1 = require("../common/BasicParser");
|
|
10
10
|
const debug = _debug('music-metadata:parser:ID3');
|
|
11
11
|
/**
|
|
@@ -37,7 +37,7 @@ class AbstractID3Parser extends BasicParser_1.BasicParser {
|
|
|
37
37
|
}
|
|
38
38
|
async parseID3v2() {
|
|
39
39
|
await this.tryReadId3v2Headers();
|
|
40
|
-
debug(
|
|
40
|
+
debug('End of ID3v2 header, go to MPEG-parser: pos=%s', this.tokenizer.position);
|
|
41
41
|
await this._parse();
|
|
42
42
|
if (this.options.skipPostHeaders && this.metadata.hasAny()) {
|
|
43
43
|
this.finalize();
|
|
@@ -50,8 +50,8 @@ class AbstractID3Parser extends BasicParser_1.BasicParser {
|
|
|
50
50
|
}
|
|
51
51
|
async tryReadId3v2Headers() {
|
|
52
52
|
const id3Header = await this.tokenizer.peekToken(ID3v2Token_1.ID3v2Header);
|
|
53
|
-
if (id3Header.fileIdentifier ===
|
|
54
|
-
debug(
|
|
53
|
+
if (id3Header.fileIdentifier === 'ID3') {
|
|
54
|
+
debug('Found ID3v2 header, pos=%s', this.tokenizer.position);
|
|
55
55
|
await this.id3parser.parse(this.metadata, this.tokenizer, this.options);
|
|
56
56
|
return this.tryReadId3v2Headers();
|
|
57
57
|
}
|
|
@@ -44,7 +44,8 @@ exports.id3v22TagMap = {
|
|
|
44
44
|
TSC: 'composersort',
|
|
45
45
|
TSP: 'artistsort',
|
|
46
46
|
TST: 'titlesort',
|
|
47
|
-
WFD: 'podcasturl'
|
|
47
|
+
WFD: 'podcasturl',
|
|
48
|
+
TBP: 'bpm'
|
|
48
49
|
};
|
|
49
50
|
class ID3v22TagMapper extends CaseInsensitiveTagMap_1.CaseInsensitiveTagMap {
|
|
50
51
|
constructor() {
|
|
@@ -52,3 +53,4 @@ class ID3v22TagMapper extends CaseInsensitiveTagMap_1.CaseInsensitiveTagMap {
|
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
exports.ID3v22TagMapper = ID3v22TagMapper;
|
|
56
|
+
//# sourceMappingURL=ID3v22TagMapper.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IRating, ITag } from '../type';
|
|
2
1
|
import { INativeMetadataCollector } from '../common/MetadataCollector';
|
|
3
2
|
import { CaseInsensitiveTagMap } from '../common/CaseInsensitiveTagMap';
|
|
3
|
+
import { IRating, ITag } from '../type';
|
|
4
4
|
export declare class ID3v24TagMapper extends CaseInsensitiveTagMap {
|
|
5
5
|
static toRating(popm: any): IRating;
|
|
6
6
|
constructor();
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ID3v24TagMapper = void 0;
|
|
4
4
|
const GenericTagMapper_1 = require("../common/GenericTagMapper");
|
|
5
|
-
const util = require("../common/Util");
|
|
6
5
|
const CaseInsensitiveTagMap_1 = require("../common/CaseInsensitiveTagMap");
|
|
6
|
+
const util = require("../common/Util");
|
|
7
7
|
/**
|
|
8
8
|
* ID3v2.3/ID3v2.4 tag mappings
|
|
9
9
|
*/
|
|
@@ -191,3 +191,4 @@ class ID3v24TagMapper extends CaseInsensitiveTagMap_1.CaseInsensitiveTagMap {
|
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
exports.ID3v24TagMapper = ID3v24TagMapper;
|
|
194
|
+
//# sourceMappingURL=ID3v24TagMapper.js.map
|
package/lib/iff/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { IGetToken } from
|
|
1
|
+
import { IGetToken } from 'strtok3/lib/core';
|
|
2
2
|
/**
|
|
3
3
|
* "EA IFF 85" Standard for Interchange Format Files
|
|
4
4
|
* Ref: http://www.martinreddy.net/gfx/2d/IFF.txt
|
|
5
5
|
*/
|
|
6
6
|
export interface IChunkHeader {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* A chunk ID (ie, 4 ASCII bytes)
|
|
9
9
|
*/
|
|
10
10
|
chunkID: string;
|
|
11
11
|
/**
|
|
@@ -19,7 +19,7 @@ export interface IChunkHeader {
|
|
|
19
19
|
*/
|
|
20
20
|
export interface IChunkHeader64 {
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* A chunk ID (ie, 4 ASCII bytes)
|
|
23
23
|
*/
|
|
24
24
|
chunkID: string;
|
|
25
25
|
/**
|
package/lib/iff/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Header = void 0;
|
|
4
|
-
const FourCC_1 = require("../common/FourCC");
|
|
5
4
|
const Token = require("token-types");
|
|
5
|
+
const FourCC_1 = require("../common/FourCC");
|
|
6
6
|
/**
|
|
7
7
|
* Common AIFF chunk header
|
|
8
8
|
*/
|
package/lib/index.d.ts
CHANGED
|
@@ -32,3 +32,14 @@ export declare const orderTags: typeof Core.orderTags;
|
|
|
32
32
|
* @returns Number of stars: 1, 2, 3, 4 or 5 stars
|
|
33
33
|
*/
|
|
34
34
|
export declare const ratingToStars: typeof Core.ratingToStars;
|
|
35
|
+
declare const _default: {
|
|
36
|
+
parseStream: typeof parseStream;
|
|
37
|
+
parseFile: typeof parseFile;
|
|
38
|
+
parseFromTokenizer: typeof Core.parseFromTokenizer;
|
|
39
|
+
parseBuffer: typeof Core.parseBuffer;
|
|
40
|
+
selectCover: typeof Core.selectCover;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Define default module exports
|
|
44
|
+
*/
|
|
45
|
+
export default _default;
|
package/lib/index.js
CHANGED
|
@@ -62,3 +62,13 @@ exports.orderTags = Core.orderTags;
|
|
|
62
62
|
* @returns Number of stars: 1, 2, 3, 4 or 5 stars
|
|
63
63
|
*/
|
|
64
64
|
exports.ratingToStars = Core.ratingToStars;
|
|
65
|
+
/**
|
|
66
|
+
* Define default module exports
|
|
67
|
+
*/
|
|
68
|
+
exports.default = {
|
|
69
|
+
parseStream,
|
|
70
|
+
parseFile,
|
|
71
|
+
parseFromTokenizer: Core.parseFromTokenizer,
|
|
72
|
+
parseBuffer: Core.parseBuffer,
|
|
73
|
+
selectCover: Core.selectCover
|
|
74
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { INativeMetadataCollector } from '../common/MetadataCollector';
|
|
2
1
|
import { ITokenizer } from 'strtok3/lib/core';
|
|
2
|
+
import { INativeMetadataCollector } from '../common/MetadataCollector';
|
|
3
3
|
import { IOptions } from '../type';
|
|
4
4
|
import { ITokenParser } from '../ParserFactory';
|
|
5
5
|
import { BasicParser } from '../common/BasicParser';
|
|
@@ -220,7 +220,8 @@ class MatroskaParser extends BasicParser_1.BasicParser {
|
|
|
220
220
|
return buf.readUIntBE(e.len - nrLen, nrLen);
|
|
221
221
|
}
|
|
222
222
|
async readString(e) {
|
|
223
|
-
|
|
223
|
+
const rawString = await this.tokenizer.readToken(new Token.StringType(e.len, 'utf-8'));
|
|
224
|
+
return rawString.replace(/\00.*$/g, '');
|
|
224
225
|
}
|
|
225
226
|
async readBuffer(e) {
|
|
226
227
|
const buf = Buffer.alloc(e.len);
|
package/lib/mp4/AtomToken.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ChapterText = exports.StcoAtom = exports.StszAtom = exports.StscAtom = exports.SampleToChunkToken = exports.SttsAtom = exports.TimeToSampleToken = exports.SoundSampleDescriptionV0 = exports.SoundSampleDescriptionVersion = exports.StsdAtom = exports.TrackHeaderAtom = exports.NameAtom = exports.DataAtom = exports.MvhdAtom = exports.MdhdAtom = exports.FixedLengthAtom = exports.mhdr = exports.tkhd = exports.ftyp = exports.ExtendedSize = exports.Header = void 0;
|
|
4
4
|
const Token = require("token-types");
|
|
5
|
-
const FourCC_1 = require("../common/FourCC");
|
|
6
5
|
const initDebug = require("debug");
|
|
6
|
+
const FourCC_1 = require("../common/FourCC");
|
|
7
7
|
const debug = initDebug('music-metadata:parser:MP4:atom');
|
|
8
8
|
exports.Header = {
|
|
9
9
|
len: 8,
|
package/lib/mp4/MP4Parser.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { BasicParser } from '../common/BasicParser';
|
|
2
2
|
import { Atom } from './Atom';
|
|
3
3
|
export declare class MP4Parser extends BasicParser {
|
|
4
|
-
private static
|
|
5
|
-
private static read_BE_Unsigned_Integer;
|
|
4
|
+
private static read_BE_Integer;
|
|
6
5
|
private audioLengthInBytes;
|
|
7
6
|
private tracks;
|
|
8
7
|
parse(): Promise<void>;
|
package/lib/mp4/MP4Parser.js
CHANGED
|
@@ -4,10 +4,10 @@ exports.MP4Parser = void 0;
|
|
|
4
4
|
const initDebug = require("debug");
|
|
5
5
|
const Token = require("token-types");
|
|
6
6
|
const BasicParser_1 = require("../common/BasicParser");
|
|
7
|
-
const Atom_1 = require("./Atom");
|
|
8
|
-
const AtomToken = require("./AtomToken");
|
|
9
7
|
const ID3v1Parser_1 = require("../id3v1/ID3v1Parser");
|
|
10
8
|
const type_1 = require("../type");
|
|
9
|
+
const Atom_1 = require("./Atom");
|
|
10
|
+
const AtomToken = require("./AtomToken");
|
|
11
11
|
const debug = initDebug('music-metadata:parser:MP4');
|
|
12
12
|
const tagFormat = 'iTunes';
|
|
13
13
|
const encoderDict = {
|
|
@@ -206,17 +206,13 @@ class MP4Parser extends BasicParser_1.BasicParser {
|
|
|
206
206
|
}
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
|
-
static
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
static read_BE_Unsigned_Integer(value) {
|
|
216
|
-
if (value.length === 8) {
|
|
217
|
-
return Number(value.readBigUInt64BE(0));
|
|
209
|
+
static read_BE_Integer(array, signed) {
|
|
210
|
+
const integerType = (signed ? 'INT' : 'UINT') + array.length * 8 + (array.length > 1 ? '_BE' : '');
|
|
211
|
+
const token = Token[integerType];
|
|
212
|
+
if (!token) {
|
|
213
|
+
throw new Error('Token for integer type not found: "' + integerType + '"');
|
|
218
214
|
}
|
|
219
|
-
return
|
|
215
|
+
return Number(token.get(array, 0));
|
|
220
216
|
}
|
|
221
217
|
async parse() {
|
|
222
218
|
this.tracks = [];
|
|
@@ -402,10 +398,10 @@ class MP4Parser extends BasicParser_1.BasicParser {
|
|
|
402
398
|
});
|
|
403
399
|
break;
|
|
404
400
|
case 21: // BE Signed Integer
|
|
405
|
-
this.addTag(tagKey, MP4Parser.
|
|
401
|
+
this.addTag(tagKey, MP4Parser.read_BE_Integer(dataAtom.value, true));
|
|
406
402
|
break;
|
|
407
403
|
case 22: // BE Unsigned Integer
|
|
408
|
-
this.addTag(tagKey, MP4Parser.
|
|
404
|
+
this.addTag(tagKey, MP4Parser.read_BE_Integer(dataAtom.value, false));
|
|
409
405
|
break;
|
|
410
406
|
case 65: // An 8-bit signed integer
|
|
411
407
|
this.addTag(tagKey, dataAtom.value.readInt8(0));
|
package/lib/mp4/MP4TagMapper.js
CHANGED
package/lib/mpeg/MpegParser.js
CHANGED
|
@@ -486,7 +486,7 @@ class MpegParser extends AbstractID3Parser_1.AbstractID3Parser {
|
|
|
486
486
|
*/
|
|
487
487
|
async readXingInfoHeader() {
|
|
488
488
|
const _offset = this.tokenizer.position;
|
|
489
|
-
const infoTag = await XingTag_1.readXingHeader(this.tokenizer);
|
|
489
|
+
const infoTag = await (0, XingTag_1.readXingHeader)(this.tokenizer);
|
|
490
490
|
this.offset += this.tokenizer.position - _offset;
|
|
491
491
|
if (infoTag.lame) {
|
|
492
492
|
this.metadata.setFormat('tool', 'LAME ' + common.stripNulls(infoTag.lame.version));
|
package/lib/mpeg/XingTag.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import * as Token from
|
|
2
|
+
import * as Token from 'token-types';
|
|
3
3
|
import { IGetToken, ITokenizer } from 'strtok3/lib/core';
|
|
4
4
|
import { IExtendedLameHeader } from './ExtendedLameHeader';
|
|
5
5
|
export interface IXingHeaderFlags {
|
package/lib/musepack/index.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const initDebug = require("debug");
|
|
4
4
|
const Token = require("token-types");
|
|
5
|
+
const AbstractID3Parser_1 = require("../id3v2/AbstractID3Parser");
|
|
5
6
|
const MpcSv8Parser_1 = require("./sv8/MpcSv8Parser");
|
|
6
7
|
const MpcSv7Parser_1 = require("./sv7/MpcSv7Parser");
|
|
7
|
-
const AbstractID3Parser_1 = require("../id3v2/AbstractID3Parser");
|
|
8
8
|
const debug = initDebug('music-metadata:parser:musepack');
|
|
9
9
|
class MusepackParser extends AbstractID3Parser_1.AbstractID3Parser {
|
|
10
10
|
async _parse() {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MpcSv7Parser = void 0;
|
|
4
4
|
const initDebug = require("debug");
|
|
5
5
|
const BasicParser_1 = require("../../common/BasicParser");
|
|
6
|
-
const SV7 = require("./StreamVersion7");
|
|
7
6
|
const APEv2Parser_1 = require("../../apev2/APEv2Parser");
|
|
8
7
|
const BitReader_1 = require("./BitReader");
|
|
8
|
+
const SV7 = require("./StreamVersion7");
|
|
9
9
|
const debug = initDebug('music-metadata:parser:musepack');
|
|
10
10
|
class MpcSv7Parser extends BasicParser_1.BasicParser {
|
|
11
11
|
constructor() {
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.MpcSv8Parser = void 0;
|
|
4
4
|
const initDebug = require("debug");
|
|
5
5
|
const BasicParser_1 = require("../../common/BasicParser");
|
|
6
|
-
const SV8 = require("./StreamVersion8");
|
|
7
6
|
const APEv2Parser_1 = require("../../apev2/APEv2Parser");
|
|
8
7
|
const FourCC_1 = require("../../common/FourCC");
|
|
8
|
+
const SV8 = require("./StreamVersion8");
|
|
9
9
|
const debug = initDebug('music-metadata:parser:musepack');
|
|
10
10
|
class MpcSv8Parser extends BasicParser_1.BasicParser {
|
|
11
11
|
constructor() {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StreamReader = void 0;
|
|
4
4
|
const Token = require("token-types");
|
|
5
|
-
const util = require("../../common/Util");
|
|
6
5
|
const initDebug = require("debug");
|
|
6
|
+
const util = require("../../common/Util");
|
|
7
7
|
const debug = initDebug('music-metadata:parser:musepack:sv8');
|
|
8
8
|
const PacketKey = new Token.StringType(2, 'binary');
|
|
9
9
|
/**
|
package/lib/ogg/OggParser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as Ogg from './Ogg';
|
|
2
|
-
import { BasicParser } from '../common/BasicParser';
|
|
3
1
|
import { IGetToken } from 'strtok3/lib/core';
|
|
2
|
+
import { BasicParser } from '../common/BasicParser';
|
|
3
|
+
import * as Ogg from './Ogg';
|
|
4
4
|
export declare class SegmentTable implements IGetToken<Ogg.ISegmentTable> {
|
|
5
5
|
private static sum;
|
|
6
6
|
len: number;
|
package/lib/ogg/OggParser.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OggParser = exports.SegmentTable = void 0;
|
|
4
4
|
const Token = require("token-types");
|
|
5
|
+
const core_1 = require("strtok3/lib/core");
|
|
5
6
|
const initDebug = require("debug");
|
|
6
7
|
const util = require("../common/Util");
|
|
7
8
|
const FourCC_1 = require("../common/FourCC");
|
|
9
|
+
const BasicParser_1 = require("../common/BasicParser");
|
|
8
10
|
const VorbisParser_1 = require("./vorbis/VorbisParser");
|
|
9
11
|
const OpusParser_1 = require("./opus/OpusParser");
|
|
10
12
|
const SpeexParser_1 = require("./speex/SpeexParser");
|
|
11
|
-
const BasicParser_1 = require("../common/BasicParser");
|
|
12
13
|
const TheoraParser_1 = require("./theora/TheoraParser");
|
|
13
|
-
const core_1 = require("strtok3/lib/core");
|
|
14
14
|
const debug = initDebug('music-metadata:parser:ogg');
|
|
15
15
|
class SegmentTable {
|
|
16
16
|
constructor(header) {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OpusParser = void 0;
|
|
4
4
|
const Token = require("token-types");
|
|
5
|
-
const Opus = require("./Opus");
|
|
6
5
|
const VorbisParser_1 = require("../vorbis/VorbisParser");
|
|
6
|
+
const Opus = require("./Opus");
|
|
7
7
|
/**
|
|
8
8
|
* Opus parser
|
|
9
9
|
* Internet Engineering Task Force (IETF) - RFC 6716
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SpeexParser = void 0;
|
|
4
4
|
const initDebug = require("debug");
|
|
5
|
-
const Speex = require("./Speex");
|
|
6
5
|
const VorbisParser_1 = require("../vorbis/VorbisParser");
|
|
6
|
+
const Speex = require("./Speex");
|
|
7
7
|
const debug = initDebug('music-metadata:parser:ogg:speex');
|
|
8
8
|
/**
|
|
9
9
|
* Speex, RFC 5574
|
package/lib/riff/RiffChunk.d.ts
CHANGED
package/lib/type.d.ts
CHANGED
package/lib/type.js
CHANGED
package/lib/wav/WaveChunk.d.ts
CHANGED
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.6",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Borewit",
|
|
7
7
|
"url": "https://github.com/Borewit"
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
86
|
"content-type": "^1.0.4",
|
|
87
|
-
"debug": "^4.3.
|
|
87
|
+
"debug": "^4.3.3",
|
|
88
88
|
"file-type": "16.5.3",
|
|
89
89
|
"media-typer": "^1.1.0",
|
|
90
90
|
"strtok3": "^6.2.4",
|
|
@@ -92,25 +92,25 @@
|
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"@tokenizer/token": "^0.3.0",
|
|
95
|
-
"@types/chai": "^4.
|
|
95
|
+
"@types/chai": "^4.3.0",
|
|
96
96
|
"@types/debug": "^4.1.7",
|
|
97
97
|
"@types/file-type": "^10.9.1",
|
|
98
98
|
"@types/mocha": "^9.0.0",
|
|
99
|
-
"@types/node": "^
|
|
99
|
+
"@types/node": "^17.0.8",
|
|
100
100
|
"chai": "^4.3.4",
|
|
101
101
|
"coveralls": "^3.1.1",
|
|
102
102
|
"del-cli": "4.0.1",
|
|
103
|
-
"eslint": "
|
|
104
|
-
"mime": "^
|
|
105
|
-
"mocha": "^9.
|
|
103
|
+
"eslint": "8.6.0",
|
|
104
|
+
"mime": "^3.0.0",
|
|
105
|
+
"mocha": "^9.1.3",
|
|
106
106
|
"npm-run-all": "^4.1.5",
|
|
107
107
|
"nyc": "^15.1.0",
|
|
108
|
-
"remark-cli": "^10.0.
|
|
109
|
-
"remark-preset-lint-recommended": "^
|
|
110
|
-
"source-map-support": "^0.5.
|
|
111
|
-
"ts-node": "^10.
|
|
108
|
+
"remark-cli": "^10.0.1",
|
|
109
|
+
"remark-preset-lint-recommended": "^6.1.2",
|
|
110
|
+
"source-map-support": "^0.5.21",
|
|
111
|
+
"ts-node": "^10.3.0",
|
|
112
112
|
"tslint": "^6.1.3",
|
|
113
|
-
"typescript": "^4.
|
|
113
|
+
"typescript": "^4.5.4"
|
|
114
114
|
},
|
|
115
115
|
"engines": {
|
|
116
116
|
"node": ">=10"
|