music-metadata 7.11.7 → 7.11.8
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 +433 -432
- package/lib/ParserFactory.d.ts +48 -49
- package/lib/ParserFactory.js +251 -251
- package/lib/aiff/AiffParser.d.ts +14 -15
- package/lib/aiff/AiffParser.js +84 -85
- package/lib/aiff/AiffToken.d.ts +22 -22
- package/lib/aiff/AiffToken.js +43 -43
- package/lib/apev2/APEv2Parser.d.ts +30 -30
- package/lib/apev2/APEv2Parser.js +161 -162
- package/lib/apev2/APEv2TagMapper.d.ts +4 -4
- package/lib/apev2/APEv2TagMapper.js +86 -86
- package/lib/apev2/APEv2Token.d.ts +100 -100
- package/lib/apev2/APEv2Token.js +126 -126
- package/lib/asf/AsfObject.d.ts +319 -319
- package/lib/asf/AsfObject.js +384 -384
- package/lib/asf/AsfParser.d.ts +17 -17
- package/lib/asf/AsfParser.js +135 -135
- package/lib/asf/AsfTagMapper.d.ts +7 -7
- package/lib/asf/AsfTagMapper.js +95 -95
- package/lib/asf/AsfUtil.d.ts +13 -13
- package/lib/asf/AsfUtil.js +40 -40
- package/lib/asf/GUID.d.ts +84 -86
- package/lib/asf/GUID.js +121 -123
- package/lib/common/BasicParser.d.ts +17 -17
- package/lib/common/BasicParser.js +18 -18
- package/lib/common/CaseInsensitiveTagMap.d.ts +10 -10
- package/lib/common/CaseInsensitiveTagMap.js +21 -21
- package/lib/common/CombinedTagMapper.d.ts +19 -19
- package/lib/common/CombinedTagMapper.js +51 -51
- package/lib/common/FourCC.d.ts +6 -6
- package/lib/common/FourCC.js +28 -28
- package/lib/common/GenericTagMapper.d.ts +51 -51
- package/lib/common/GenericTagMapper.js +55 -55
- package/lib/common/GenericTagTypes.d.ts +33 -33
- package/lib/common/GenericTagTypes.js +131 -131
- package/lib/common/MetadataCollector.d.ts +76 -76
- package/lib/common/MetadataCollector.js +275 -275
- package/lib/common/RandomFileReader.d.ts +20 -20
- package/lib/common/RandomFileReader.js +37 -37
- package/lib/common/RandomUint8ArrayReader.d.ts +18 -18
- package/lib/common/RandomUint8ArrayReader.js +25 -25
- package/lib/common/Util.d.ts +58 -58
- package/lib/common/Util.js +157 -162
- package/lib/core.d.ts +48 -48
- package/lib/core.js +90 -90
- package/lib/dsdiff/DsdiffParser.d.ts +14 -14
- package/lib/dsdiff/DsdiffParser.js +143 -143
- package/lib/dsdiff/DsdiffToken.d.ts +9 -9
- package/lib/dsdiff/DsdiffToken.js +21 -21
- package/lib/dsf/DsfChunk.d.ts +86 -86
- package/lib/dsf/DsfChunk.js +54 -54
- package/lib/dsf/DsfParser.d.ts +9 -9
- package/lib/dsf/DsfParser.js +56 -56
- package/lib/flac/FlacParser.d.ts +28 -28
- package/lib/flac/FlacParser.js +175 -175
- package/lib/id3v1/ID3v1Parser.d.ts +13 -13
- package/lib/id3v1/ID3v1Parser.js +134 -134
- package/lib/id3v1/ID3v1TagMap.d.ts +4 -4
- package/lib/id3v1/ID3v1TagMap.js +22 -22
- package/lib/id3v2/AbstractID3Parser.d.ts +17 -17
- package/lib/id3v2/AbstractID3Parser.js +60 -60
- package/lib/id3v2/FrameParser.d.ts +32 -32
- package/lib/id3v2/FrameParser.js +329 -329
- package/lib/id3v2/ID3v22TagMapper.d.ts +9 -9
- package/lib/id3v2/ID3v22TagMapper.js +55 -55
- package/lib/id3v2/ID3v24TagMapper.d.ts +14 -14
- package/lib/id3v2/ID3v24TagMapper.js +193 -193
- package/lib/id3v2/ID3v2Parser.d.ts +29 -29
- package/lib/id3v2/ID3v2Parser.js +184 -194
- package/lib/id3v2/ID3v2Token.d.ts +73 -73
- package/lib/id3v2/ID3v2Token.js +106 -106
- package/lib/iff/index.d.ts +33 -33
- package/lib/iff/index.js +19 -19
- package/lib/index.d.ts +45 -45
- package/lib/index.js +74 -74
- package/lib/lyrics3/Lyrics3.d.ts +3 -3
- package/lib/lyrics3/Lyrics3.js +17 -17
- package/lib/matroska/MatroskaDtd.d.ts +8 -8
- package/lib/matroska/MatroskaDtd.js +279 -279
- package/lib/matroska/MatroskaParser.d.ts +37 -37
- package/lib/matroska/MatroskaParser.js +235 -235
- package/lib/matroska/MatroskaTagMapper.d.ts +4 -4
- package/lib/matroska/MatroskaTagMapper.js +35 -35
- package/lib/matroska/types.d.ts +175 -175
- package/lib/matroska/types.js +33 -32
- package/lib/mp4/Atom.d.ts +16 -16
- package/lib/mp4/Atom.js +70 -70
- package/lib/mp4/AtomToken.d.ts +395 -395
- package/lib/mp4/AtomToken.js +406 -406
- package/lib/mp4/MP4Parser.d.ts +30 -30
- package/lib/mp4/MP4Parser.js +511 -511
- package/lib/mp4/MP4TagMapper.d.ts +5 -5
- package/lib/mp4/MP4TagMapper.js +115 -115
- package/lib/mpeg/ExtendedLameHeader.d.ts +27 -27
- package/lib/mpeg/ExtendedLameHeader.js +31 -31
- package/lib/mpeg/MpegParser.d.ts +49 -49
- package/lib/mpeg/MpegParser.js +524 -529
- package/lib/mpeg/ReplayGainDataFormat.d.ts +55 -55
- package/lib/mpeg/ReplayGainDataFormat.js +69 -69
- package/lib/mpeg/XingTag.d.ts +45 -45
- package/lib/mpeg/XingTag.js +69 -69
- package/lib/musepack/index.d.ts +5 -5
- package/lib/musepack/index.js +32 -32
- package/lib/musepack/sv7/BitReader.d.ts +13 -13
- package/lib/musepack/sv7/BitReader.js +54 -54
- package/lib/musepack/sv7/MpcSv7Parser.d.ts +8 -8
- package/lib/musepack/sv7/MpcSv7Parser.js +46 -46
- package/lib/musepack/sv7/StreamVersion7.d.ts +28 -28
- package/lib/musepack/sv7/StreamVersion7.js +41 -41
- package/lib/musepack/sv8/MpcSv8Parser.d.ts +6 -6
- package/lib/musepack/sv8/MpcSv8Parser.js +55 -55
- package/lib/musepack/sv8/StreamVersion8.d.ts +40 -40
- package/lib/musepack/sv8/StreamVersion8.js +80 -80
- package/lib/ogg/Ogg.d.ts +72 -72
- package/lib/ogg/Ogg.js +2 -2
- package/lib/ogg/OggParser.d.ts +23 -23
- package/lib/ogg/OggParser.js +126 -126
- package/lib/ogg/opus/Opus.d.ts +48 -48
- package/lib/ogg/opus/Opus.js +28 -28
- package/lib/ogg/opus/OpusParser.d.ts +25 -25
- package/lib/ogg/opus/OpusParser.js +56 -56
- package/lib/ogg/speex/Speex.d.ts +36 -36
- package/lib/ogg/speex/Speex.js +31 -31
- package/lib/ogg/speex/SpeexParser.d.ts +22 -22
- package/lib/ogg/speex/SpeexParser.js +35 -35
- package/lib/ogg/theora/Theora.d.ts +20 -20
- package/lib/ogg/theora/Theora.js +23 -23
- package/lib/ogg/theora/TheoraParser.d.ts +28 -28
- package/lib/ogg/theora/TheoraParser.js +44 -44
- package/lib/ogg/vorbis/Vorbis.d.ts +69 -79
- package/lib/ogg/vorbis/Vorbis.js +78 -78
- package/lib/ogg/vorbis/VorbisDecoder.d.ts +12 -12
- package/lib/ogg/vorbis/VorbisDecoder.js +32 -32
- package/lib/ogg/vorbis/VorbisParser.d.ts +36 -36
- package/lib/ogg/vorbis/VorbisParser.js +128 -128
- package/lib/ogg/vorbis/VorbisTagMapper.d.ts +7 -7
- package/lib/ogg/vorbis/VorbisTagMapper.js +132 -132
- package/lib/riff/RiffChunk.d.ts +16 -16
- package/lib/riff/RiffChunk.js +32 -32
- package/lib/riff/RiffInfoTagMap.d.ts +10 -10
- package/lib/riff/RiffInfoTagMap.js +37 -37
- package/lib/type.d.ts +592 -599
- package/lib/type.js +5 -13
- package/lib/wav/WaveChunk.d.ts +64 -64
- package/lib/wav/WaveChunk.js +65 -65
- package/lib/wav/WaveParser.d.ts +24 -24
- package/lib/wav/WaveParser.js +144 -144
- package/lib/wavpack/WavPackParser.d.ts +14 -14
- package/lib/wavpack/WavPackParser.js +99 -105
- package/lib/wavpack/WavPackToken.d.ts +64 -64
- package/lib/wavpack/WavPackToken.js +76 -76
- package/package.json +150 -142
package/lib/id3v2/ID3v2Token.js
CHANGED
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TextEncodingToken = exports.ExtendedHeader = exports.ID3v2Header = exports.UINT32SYNCSAFE = exports.AttachedPictureType = void 0;
|
|
4
|
-
const Token = require("token-types");
|
|
5
|
-
const util = require("../common/Util");
|
|
6
|
-
/**
|
|
7
|
-
* The picture type according to the ID3v2 APIC frame
|
|
8
|
-
* Ref: http://id3.org/id3v2.3.0#Attached_picture
|
|
9
|
-
*/
|
|
10
|
-
var AttachedPictureType;
|
|
11
|
-
(function (AttachedPictureType) {
|
|
12
|
-
AttachedPictureType[AttachedPictureType["Other"] = 0] = "Other";
|
|
13
|
-
AttachedPictureType[AttachedPictureType["32x32 pixels 'file icon' (PNG only)"] = 1] = "32x32 pixels 'file icon' (PNG only)";
|
|
14
|
-
AttachedPictureType[AttachedPictureType["Other file icon"] = 2] = "Other file icon";
|
|
15
|
-
AttachedPictureType[AttachedPictureType["Cover (front)"] = 3] = "Cover (front)";
|
|
16
|
-
AttachedPictureType[AttachedPictureType["Cover (back)"] = 4] = "Cover (back)";
|
|
17
|
-
AttachedPictureType[AttachedPictureType["Leaflet page"] = 5] = "Leaflet page";
|
|
18
|
-
AttachedPictureType[AttachedPictureType["Media (e.g. label side of CD)"] = 6] = "Media (e.g. label side of CD)";
|
|
19
|
-
AttachedPictureType[AttachedPictureType["Lead artist/lead performer/soloist"] = 7] = "Lead artist/lead performer/soloist";
|
|
20
|
-
AttachedPictureType[AttachedPictureType["Artist/performer"] = 8] = "Artist/performer";
|
|
21
|
-
AttachedPictureType[AttachedPictureType["Conductor"] = 9] = "Conductor";
|
|
22
|
-
AttachedPictureType[AttachedPictureType["Band/Orchestra"] = 10] = "Band/Orchestra";
|
|
23
|
-
AttachedPictureType[AttachedPictureType["Composer"] = 11] = "Composer";
|
|
24
|
-
AttachedPictureType[AttachedPictureType["Lyricist/text writer"] = 12] = "Lyricist/text writer";
|
|
25
|
-
AttachedPictureType[AttachedPictureType["Recording Location"] = 13] = "Recording Location";
|
|
26
|
-
AttachedPictureType[AttachedPictureType["During recording"] = 14] = "During recording";
|
|
27
|
-
AttachedPictureType[AttachedPictureType["During performance"] = 15] = "During performance";
|
|
28
|
-
AttachedPictureType[AttachedPictureType["Movie/video screen capture"] = 16] = "Movie/video screen capture";
|
|
29
|
-
AttachedPictureType[AttachedPictureType["A bright coloured fish"] = 17] = "A bright coloured fish";
|
|
30
|
-
AttachedPictureType[AttachedPictureType["Illustration"] = 18] = "Illustration";
|
|
31
|
-
AttachedPictureType[AttachedPictureType["Band/artist logotype"] = 19] = "Band/artist logotype";
|
|
32
|
-
AttachedPictureType[AttachedPictureType["Publisher/Studio logotype"] = 20] = "Publisher/Studio logotype";
|
|
33
|
-
})(AttachedPictureType = exports.AttachedPictureType || (exports.AttachedPictureType = {}));
|
|
34
|
-
/**
|
|
35
|
-
* 28 bits (representing up to 256MB) integer, the msb is 0 to avoid 'false syncsignals'.
|
|
36
|
-
* 4 * %0xxxxxxx
|
|
37
|
-
*/
|
|
38
|
-
exports.UINT32SYNCSAFE = {
|
|
39
|
-
get: (buf, off) => {
|
|
40
|
-
return buf[off + 3] & 0x7f | ((buf[off + 2]) << 7) |
|
|
41
|
-
((buf[off + 1]) << 14) | ((buf[off]) << 21);
|
|
42
|
-
},
|
|
43
|
-
len: 4
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* ID3v2 header
|
|
47
|
-
* Ref: http://id3.org/id3v2.3.0#ID3v2_header
|
|
48
|
-
* ToDo
|
|
49
|
-
*/
|
|
50
|
-
exports.ID3v2Header = {
|
|
51
|
-
len: 10,
|
|
52
|
-
get: (buf, off) => {
|
|
53
|
-
return {
|
|
54
|
-
// ID3v2/file identifier "ID3"
|
|
55
|
-
fileIdentifier: new Token.StringType(3, 'ascii').get(buf, off),
|
|
56
|
-
// ID3v2 versionIndex
|
|
57
|
-
version: {
|
|
58
|
-
major: Token.INT8.get(buf, off + 3),
|
|
59
|
-
revision: Token.INT8.get(buf, off + 4)
|
|
60
|
-
},
|
|
61
|
-
// ID3v2 flags
|
|
62
|
-
flags: {
|
|
63
|
-
// Unsynchronisation
|
|
64
|
-
unsynchronisation: util.getBit(buf, off + 5, 7),
|
|
65
|
-
// Extended header
|
|
66
|
-
isExtendedHeader: util.getBit(buf, off + 5, 6),
|
|
67
|
-
// Experimental indicator
|
|
68
|
-
expIndicator: util.getBit(buf, off + 5, 5),
|
|
69
|
-
footer: util.getBit(buf, off + 5, 4)
|
|
70
|
-
},
|
|
71
|
-
size: exports.UINT32SYNCSAFE.get(buf, off + 6)
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
exports.ExtendedHeader = {
|
|
76
|
-
len: 10,
|
|
77
|
-
get: (buf, off) => {
|
|
78
|
-
return {
|
|
79
|
-
// Extended header size
|
|
80
|
-
size: Token.UINT32_BE.get(buf, off),
|
|
81
|
-
// Extended Flags
|
|
82
|
-
extendedFlags: Token.UINT16_BE.get(buf, off + 4),
|
|
83
|
-
// Size of padding
|
|
84
|
-
sizeOfPadding: Token.UINT32_BE.get(buf, off + 6),
|
|
85
|
-
// CRC data present
|
|
86
|
-
crcDataPresent: util.getBit(buf, off + 4, 31)
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
exports.TextEncodingToken = {
|
|
91
|
-
len: 1,
|
|
92
|
-
get: (buf, off) => {
|
|
93
|
-
switch (buf.readUInt8(off)) {
|
|
94
|
-
case 0x00:
|
|
95
|
-
return { encoding: 'latin1' }; // binary
|
|
96
|
-
case 0x01:
|
|
97
|
-
return { encoding: 'utf16le', bom: true };
|
|
98
|
-
case 0x02:
|
|
99
|
-
return { encoding: 'utf16le', bom: false };
|
|
100
|
-
case 0x03:
|
|
101
|
-
return { encoding: 'utf8', bom: false };
|
|
102
|
-
default:
|
|
103
|
-
return { encoding: 'utf8', bom: false };
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextEncodingToken = exports.ExtendedHeader = exports.ID3v2Header = exports.UINT32SYNCSAFE = exports.AttachedPictureType = void 0;
|
|
4
|
+
const Token = require("token-types");
|
|
5
|
+
const util = require("../common/Util");
|
|
6
|
+
/**
|
|
7
|
+
* The picture type according to the ID3v2 APIC frame
|
|
8
|
+
* Ref: http://id3.org/id3v2.3.0#Attached_picture
|
|
9
|
+
*/
|
|
10
|
+
var AttachedPictureType;
|
|
11
|
+
(function (AttachedPictureType) {
|
|
12
|
+
AttachedPictureType[AttachedPictureType["Other"] = 0] = "Other";
|
|
13
|
+
AttachedPictureType[AttachedPictureType["32x32 pixels 'file icon' (PNG only)"] = 1] = "32x32 pixels 'file icon' (PNG only)";
|
|
14
|
+
AttachedPictureType[AttachedPictureType["Other file icon"] = 2] = "Other file icon";
|
|
15
|
+
AttachedPictureType[AttachedPictureType["Cover (front)"] = 3] = "Cover (front)";
|
|
16
|
+
AttachedPictureType[AttachedPictureType["Cover (back)"] = 4] = "Cover (back)";
|
|
17
|
+
AttachedPictureType[AttachedPictureType["Leaflet page"] = 5] = "Leaflet page";
|
|
18
|
+
AttachedPictureType[AttachedPictureType["Media (e.g. label side of CD)"] = 6] = "Media (e.g. label side of CD)";
|
|
19
|
+
AttachedPictureType[AttachedPictureType["Lead artist/lead performer/soloist"] = 7] = "Lead artist/lead performer/soloist";
|
|
20
|
+
AttachedPictureType[AttachedPictureType["Artist/performer"] = 8] = "Artist/performer";
|
|
21
|
+
AttachedPictureType[AttachedPictureType["Conductor"] = 9] = "Conductor";
|
|
22
|
+
AttachedPictureType[AttachedPictureType["Band/Orchestra"] = 10] = "Band/Orchestra";
|
|
23
|
+
AttachedPictureType[AttachedPictureType["Composer"] = 11] = "Composer";
|
|
24
|
+
AttachedPictureType[AttachedPictureType["Lyricist/text writer"] = 12] = "Lyricist/text writer";
|
|
25
|
+
AttachedPictureType[AttachedPictureType["Recording Location"] = 13] = "Recording Location";
|
|
26
|
+
AttachedPictureType[AttachedPictureType["During recording"] = 14] = "During recording";
|
|
27
|
+
AttachedPictureType[AttachedPictureType["During performance"] = 15] = "During performance";
|
|
28
|
+
AttachedPictureType[AttachedPictureType["Movie/video screen capture"] = 16] = "Movie/video screen capture";
|
|
29
|
+
AttachedPictureType[AttachedPictureType["A bright coloured fish"] = 17] = "A bright coloured fish";
|
|
30
|
+
AttachedPictureType[AttachedPictureType["Illustration"] = 18] = "Illustration";
|
|
31
|
+
AttachedPictureType[AttachedPictureType["Band/artist logotype"] = 19] = "Band/artist logotype";
|
|
32
|
+
AttachedPictureType[AttachedPictureType["Publisher/Studio logotype"] = 20] = "Publisher/Studio logotype";
|
|
33
|
+
})(AttachedPictureType = exports.AttachedPictureType || (exports.AttachedPictureType = {}));
|
|
34
|
+
/**
|
|
35
|
+
* 28 bits (representing up to 256MB) integer, the msb is 0 to avoid 'false syncsignals'.
|
|
36
|
+
* 4 * %0xxxxxxx
|
|
37
|
+
*/
|
|
38
|
+
exports.UINT32SYNCSAFE = {
|
|
39
|
+
get: (buf, off) => {
|
|
40
|
+
return buf[off + 3] & 0x7f | ((buf[off + 2]) << 7) |
|
|
41
|
+
((buf[off + 1]) << 14) | ((buf[off]) << 21);
|
|
42
|
+
},
|
|
43
|
+
len: 4
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* ID3v2 header
|
|
47
|
+
* Ref: http://id3.org/id3v2.3.0#ID3v2_header
|
|
48
|
+
* ToDo
|
|
49
|
+
*/
|
|
50
|
+
exports.ID3v2Header = {
|
|
51
|
+
len: 10,
|
|
52
|
+
get: (buf, off) => {
|
|
53
|
+
return {
|
|
54
|
+
// ID3v2/file identifier "ID3"
|
|
55
|
+
fileIdentifier: new Token.StringType(3, 'ascii').get(buf, off),
|
|
56
|
+
// ID3v2 versionIndex
|
|
57
|
+
version: {
|
|
58
|
+
major: Token.INT8.get(buf, off + 3),
|
|
59
|
+
revision: Token.INT8.get(buf, off + 4)
|
|
60
|
+
},
|
|
61
|
+
// ID3v2 flags
|
|
62
|
+
flags: {
|
|
63
|
+
// Unsynchronisation
|
|
64
|
+
unsynchronisation: util.getBit(buf, off + 5, 7),
|
|
65
|
+
// Extended header
|
|
66
|
+
isExtendedHeader: util.getBit(buf, off + 5, 6),
|
|
67
|
+
// Experimental indicator
|
|
68
|
+
expIndicator: util.getBit(buf, off + 5, 5),
|
|
69
|
+
footer: util.getBit(buf, off + 5, 4)
|
|
70
|
+
},
|
|
71
|
+
size: exports.UINT32SYNCSAFE.get(buf, off + 6)
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
exports.ExtendedHeader = {
|
|
76
|
+
len: 10,
|
|
77
|
+
get: (buf, off) => {
|
|
78
|
+
return {
|
|
79
|
+
// Extended header size
|
|
80
|
+
size: Token.UINT32_BE.get(buf, off),
|
|
81
|
+
// Extended Flags
|
|
82
|
+
extendedFlags: Token.UINT16_BE.get(buf, off + 4),
|
|
83
|
+
// Size of padding
|
|
84
|
+
sizeOfPadding: Token.UINT32_BE.get(buf, off + 6),
|
|
85
|
+
// CRC data present
|
|
86
|
+
crcDataPresent: util.getBit(buf, off + 4, 31)
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
exports.TextEncodingToken = {
|
|
91
|
+
len: 1,
|
|
92
|
+
get: (buf, off) => {
|
|
93
|
+
switch (buf.readUInt8(off)) {
|
|
94
|
+
case 0x00:
|
|
95
|
+
return { encoding: 'latin1' }; // binary
|
|
96
|
+
case 0x01:
|
|
97
|
+
return { encoding: 'utf16le', bom: true };
|
|
98
|
+
case 0x02:
|
|
99
|
+
return { encoding: 'utf16le', bom: false };
|
|
100
|
+
case 0x03:
|
|
101
|
+
return { encoding: 'utf8', bom: false };
|
|
102
|
+
default:
|
|
103
|
+
return { encoding: 'utf8', bom: false };
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
package/lib/iff/index.d.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { IGetToken } from 'strtok3/lib/core';
|
|
2
|
-
/**
|
|
3
|
-
* "EA IFF 85" Standard for Interchange Format Files
|
|
4
|
-
* Ref: http://www.martinreddy.net/gfx/2d/IFF.txt
|
|
5
|
-
*/
|
|
6
|
-
export interface IChunkHeader {
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
chunkID: string;
|
|
11
|
-
/**
|
|
12
|
-
* Number of data bytes following this data header
|
|
13
|
-
*/
|
|
14
|
-
chunkSize: number;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* "EA IFF 85" Standard for Interchange Format Files
|
|
18
|
-
* Ref: http://www.martinreddy.net/gfx/2d/IFF.txt
|
|
19
|
-
*/
|
|
20
|
-
export interface IChunkHeader64 {
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
|
-
chunkID: string;
|
|
25
|
-
/**
|
|
26
|
-
* Number of data bytes following this data header
|
|
27
|
-
*/
|
|
28
|
-
chunkSize: bigint;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Common AIFF chunk header
|
|
32
|
-
*/
|
|
33
|
-
export declare const Header: IGetToken<IChunkHeader>;
|
|
1
|
+
import { IGetToken } from 'strtok3/lib/core';
|
|
2
|
+
/**
|
|
3
|
+
* "EA IFF 85" Standard for Interchange Format Files
|
|
4
|
+
* Ref: http://www.martinreddy.net/gfx/2d/IFF.txt
|
|
5
|
+
*/
|
|
6
|
+
export interface IChunkHeader {
|
|
7
|
+
/**
|
|
8
|
+
* A chunk ID (ie, 4 ASCII bytes)
|
|
9
|
+
*/
|
|
10
|
+
chunkID: string;
|
|
11
|
+
/**
|
|
12
|
+
* Number of data bytes following this data header
|
|
13
|
+
*/
|
|
14
|
+
chunkSize: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* "EA IFF 85" Standard for Interchange Format Files
|
|
18
|
+
* Ref: http://www.martinreddy.net/gfx/2d/IFF.txt
|
|
19
|
+
*/
|
|
20
|
+
export interface IChunkHeader64 {
|
|
21
|
+
/**
|
|
22
|
+
* A chunk ID (ie, 4 ASCII bytes)
|
|
23
|
+
*/
|
|
24
|
+
chunkID: string;
|
|
25
|
+
/**
|
|
26
|
+
* Number of data bytes following this data header
|
|
27
|
+
*/
|
|
28
|
+
chunkSize: bigint;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Common AIFF chunk header
|
|
32
|
+
*/
|
|
33
|
+
export declare const Header: IGetToken<IChunkHeader>;
|
package/lib/iff/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Header = void 0;
|
|
4
|
-
const Token = require("token-types");
|
|
5
|
-
const FourCC_1 = require("../common/FourCC");
|
|
6
|
-
/**
|
|
7
|
-
* Common AIFF chunk header
|
|
8
|
-
*/
|
|
9
|
-
exports.Header = {
|
|
10
|
-
len: 8,
|
|
11
|
-
get: (buf, off) => {
|
|
12
|
-
return {
|
|
13
|
-
// Chunk type ID
|
|
14
|
-
chunkID: FourCC_1.FourCcToken.get(buf, off),
|
|
15
|
-
// Chunk size
|
|
16
|
-
chunkSize: Number(BigInt(Token.UINT32_BE.get(buf, off + 4)))
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Header = void 0;
|
|
4
|
+
const Token = require("token-types");
|
|
5
|
+
const FourCC_1 = require("../common/FourCC");
|
|
6
|
+
/**
|
|
7
|
+
* Common AIFF chunk header
|
|
8
|
+
*/
|
|
9
|
+
exports.Header = {
|
|
10
|
+
len: 8,
|
|
11
|
+
get: (buf, off) => {
|
|
12
|
+
return {
|
|
13
|
+
// Chunk type ID
|
|
14
|
+
chunkID: FourCC_1.FourCcToken.get(buf, off),
|
|
15
|
+
// Chunk size
|
|
16
|
+
chunkSize: Number(BigInt(Token.UINT32_BE.get(buf, off + 4)))
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
};
|
package/lib/index.d.ts
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import * as Stream from 'stream';
|
|
3
|
-
import * as strtok3 from 'strtok3';
|
|
4
|
-
import * as Core from './core';
|
|
5
|
-
import { IAudioMetadata, IOptions } from './type';
|
|
6
|
-
export { IAudioMetadata, IOptions, ITag, INativeTagDict, ICommonTagsResult, IFormat, IPicture, IRatio, IChapter } from './type';
|
|
7
|
-
export { parseFromTokenizer, parseBuffer, IFileInfo, selectCover } from './core';
|
|
8
|
-
/**
|
|
9
|
-
* Parse audio from Node Stream.Readable
|
|
10
|
-
* @param stream - Stream to read the audio track from
|
|
11
|
-
* @param fileInfo - File information object or MIME-type, e.g.: 'audio/mpeg'
|
|
12
|
-
* @param options - Parsing options
|
|
13
|
-
* @returns Metadata
|
|
14
|
-
*/
|
|
15
|
-
export declare function parseStream(stream: Stream.Readable, fileInfo?: strtok3.IFileInfo | string, options?: IOptions): Promise<IAudioMetadata>;
|
|
16
|
-
/**
|
|
17
|
-
* Parse audio from Node file
|
|
18
|
-
* @param filePath - Media file to read meta-data from
|
|
19
|
-
* @param options - Parsing options
|
|
20
|
-
* @returns Metadata
|
|
21
|
-
*/
|
|
22
|
-
export declare function parseFile(filePath: string, options?: IOptions): Promise<IAudioMetadata>;
|
|
23
|
-
/**
|
|
24
|
-
* Create a dictionary ordered by their tag id (key)
|
|
25
|
-
* @param nativeTags - List of tags
|
|
26
|
-
* @returns Tags indexed by id
|
|
27
|
-
*/
|
|
28
|
-
export declare const orderTags: typeof Core.orderTags;
|
|
29
|
-
/**
|
|
30
|
-
* Convert rating to 1-5 star rating
|
|
31
|
-
* @param rating - Normalized rating [0..1] (common.rating[n].rating)
|
|
32
|
-
* @returns Number of stars: 1, 2, 3, 4 or 5 stars
|
|
33
|
-
*/
|
|
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;
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import * as Stream from 'stream';
|
|
3
|
+
import * as strtok3 from 'strtok3';
|
|
4
|
+
import * as Core from './core';
|
|
5
|
+
import { IAudioMetadata, IOptions } from './type';
|
|
6
|
+
export { IAudioMetadata, IOptions, ITag, INativeTagDict, ICommonTagsResult, IFormat, IPicture, IRatio, IChapter } from './type';
|
|
7
|
+
export { parseFromTokenizer, parseBuffer, IFileInfo, selectCover } from './core';
|
|
8
|
+
/**
|
|
9
|
+
* Parse audio from Node Stream.Readable
|
|
10
|
+
* @param stream - Stream to read the audio track from
|
|
11
|
+
* @param fileInfo - File information object or MIME-type, e.g.: 'audio/mpeg'
|
|
12
|
+
* @param options - Parsing options
|
|
13
|
+
* @returns Metadata
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseStream(stream: Stream.Readable, fileInfo?: strtok3.IFileInfo | string, options?: IOptions): Promise<IAudioMetadata>;
|
|
16
|
+
/**
|
|
17
|
+
* Parse audio from Node file
|
|
18
|
+
* @param filePath - Media file to read meta-data from
|
|
19
|
+
* @param options - Parsing options
|
|
20
|
+
* @returns Metadata
|
|
21
|
+
*/
|
|
22
|
+
export declare function parseFile(filePath: string, options?: IOptions): Promise<IAudioMetadata>;
|
|
23
|
+
/**
|
|
24
|
+
* Create a dictionary ordered by their tag id (key)
|
|
25
|
+
* @param nativeTags - List of tags
|
|
26
|
+
* @returns Tags indexed by id
|
|
27
|
+
*/
|
|
28
|
+
export declare const orderTags: typeof Core.orderTags;
|
|
29
|
+
/**
|
|
30
|
+
* Convert rating to 1-5 star rating
|
|
31
|
+
* @param rating - Normalized rating [0..1] (common.rating[n].rating)
|
|
32
|
+
* @returns Number of stars: 1, 2, 3, 4 or 5 stars
|
|
33
|
+
*/
|
|
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
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ratingToStars = exports.orderTags = exports.parseFile = exports.parseStream = exports.selectCover = exports.parseBuffer = exports.parseFromTokenizer = void 0;
|
|
4
|
-
const strtok3 = require("strtok3");
|
|
5
|
-
const Core = require("./core");
|
|
6
|
-
const ParserFactory_1 = require("./ParserFactory");
|
|
7
|
-
const _debug = require("debug");
|
|
8
|
-
const RandomFileReader_1 = require("./common/RandomFileReader");
|
|
9
|
-
const debug = _debug("music-metadata:parser");
|
|
10
|
-
var core_1 = require("./core");
|
|
11
|
-
Object.defineProperty(exports, "parseFromTokenizer", { enumerable: true, get: function () { return core_1.parseFromTokenizer; } });
|
|
12
|
-
Object.defineProperty(exports, "parseBuffer", { enumerable: true, get: function () { return core_1.parseBuffer; } });
|
|
13
|
-
Object.defineProperty(exports, "selectCover", { enumerable: true, get: function () { return core_1.selectCover; } });
|
|
14
|
-
/**
|
|
15
|
-
* Parse audio from Node Stream.Readable
|
|
16
|
-
* @param stream - Stream to read the audio track from
|
|
17
|
-
* @param fileInfo - File information object or MIME-type, e.g.: 'audio/mpeg'
|
|
18
|
-
* @param options - Parsing options
|
|
19
|
-
* @returns Metadata
|
|
20
|
-
*/
|
|
21
|
-
async function parseStream(stream, fileInfo, options = {}) {
|
|
22
|
-
const tokenizer = await strtok3.fromStream(stream, typeof fileInfo === 'string' ? { mimeType: fileInfo } : fileInfo);
|
|
23
|
-
return Core.parseFromTokenizer(tokenizer, options);
|
|
24
|
-
}
|
|
25
|
-
exports.parseStream = parseStream;
|
|
26
|
-
/**
|
|
27
|
-
* Parse audio from Node file
|
|
28
|
-
* @param filePath - Media file to read meta-data from
|
|
29
|
-
* @param options - Parsing options
|
|
30
|
-
* @returns Metadata
|
|
31
|
-
*/
|
|
32
|
-
async function parseFile(filePath, options = {}) {
|
|
33
|
-
debug(`parseFile: ${filePath}`);
|
|
34
|
-
const fileTokenizer = await strtok3.fromFile(filePath);
|
|
35
|
-
const fileReader = new RandomFileReader_1.RandomFileReader(filePath, fileTokenizer.fileInfo.size);
|
|
36
|
-
try {
|
|
37
|
-
await Core.scanAppendingHeaders(fileReader, options);
|
|
38
|
-
}
|
|
39
|
-
finally {
|
|
40
|
-
fileReader.close();
|
|
41
|
-
}
|
|
42
|
-
try {
|
|
43
|
-
const parserName = ParserFactory_1.ParserFactory.getParserIdForExtension(filePath);
|
|
44
|
-
if (!parserName)
|
|
45
|
-
debug(' Parser could not be determined by file extension');
|
|
46
|
-
return await ParserFactory_1.ParserFactory.parse(fileTokenizer, parserName, options);
|
|
47
|
-
}
|
|
48
|
-
finally {
|
|
49
|
-
await fileTokenizer.close();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.parseFile = parseFile;
|
|
53
|
-
/**
|
|
54
|
-
* Create a dictionary ordered by their tag id (key)
|
|
55
|
-
* @param nativeTags - List of tags
|
|
56
|
-
* @returns Tags indexed by id
|
|
57
|
-
*/
|
|
58
|
-
exports.orderTags = Core.orderTags;
|
|
59
|
-
/**
|
|
60
|
-
* Convert rating to 1-5 star rating
|
|
61
|
-
* @param rating - Normalized rating [0..1] (common.rating[n].rating)
|
|
62
|
-
* @returns Number of stars: 1, 2, 3, 4 or 5 stars
|
|
63
|
-
*/
|
|
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
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ratingToStars = exports.orderTags = exports.parseFile = exports.parseStream = exports.selectCover = exports.parseBuffer = exports.parseFromTokenizer = void 0;
|
|
4
|
+
const strtok3 = require("strtok3");
|
|
5
|
+
const Core = require("./core");
|
|
6
|
+
const ParserFactory_1 = require("./ParserFactory");
|
|
7
|
+
const _debug = require("debug");
|
|
8
|
+
const RandomFileReader_1 = require("./common/RandomFileReader");
|
|
9
|
+
const debug = _debug("music-metadata:parser");
|
|
10
|
+
var core_1 = require("./core");
|
|
11
|
+
Object.defineProperty(exports, "parseFromTokenizer", { enumerable: true, get: function () { return core_1.parseFromTokenizer; } });
|
|
12
|
+
Object.defineProperty(exports, "parseBuffer", { enumerable: true, get: function () { return core_1.parseBuffer; } });
|
|
13
|
+
Object.defineProperty(exports, "selectCover", { enumerable: true, get: function () { return core_1.selectCover; } });
|
|
14
|
+
/**
|
|
15
|
+
* Parse audio from Node Stream.Readable
|
|
16
|
+
* @param stream - Stream to read the audio track from
|
|
17
|
+
* @param fileInfo - File information object or MIME-type, e.g.: 'audio/mpeg'
|
|
18
|
+
* @param options - Parsing options
|
|
19
|
+
* @returns Metadata
|
|
20
|
+
*/
|
|
21
|
+
async function parseStream(stream, fileInfo, options = {}) {
|
|
22
|
+
const tokenizer = await strtok3.fromStream(stream, typeof fileInfo === 'string' ? { mimeType: fileInfo } : fileInfo);
|
|
23
|
+
return Core.parseFromTokenizer(tokenizer, options);
|
|
24
|
+
}
|
|
25
|
+
exports.parseStream = parseStream;
|
|
26
|
+
/**
|
|
27
|
+
* Parse audio from Node file
|
|
28
|
+
* @param filePath - Media file to read meta-data from
|
|
29
|
+
* @param options - Parsing options
|
|
30
|
+
* @returns Metadata
|
|
31
|
+
*/
|
|
32
|
+
async function parseFile(filePath, options = {}) {
|
|
33
|
+
debug(`parseFile: ${filePath}`);
|
|
34
|
+
const fileTokenizer = await strtok3.fromFile(filePath);
|
|
35
|
+
const fileReader = new RandomFileReader_1.RandomFileReader(filePath, fileTokenizer.fileInfo.size);
|
|
36
|
+
try {
|
|
37
|
+
await Core.scanAppendingHeaders(fileReader, options);
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
fileReader.close();
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
const parserName = ParserFactory_1.ParserFactory.getParserIdForExtension(filePath);
|
|
44
|
+
if (!parserName)
|
|
45
|
+
debug(' Parser could not be determined by file extension');
|
|
46
|
+
return await ParserFactory_1.ParserFactory.parse(fileTokenizer, parserName, options);
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
await fileTokenizer.close();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.parseFile = parseFile;
|
|
53
|
+
/**
|
|
54
|
+
* Create a dictionary ordered by their tag id (key)
|
|
55
|
+
* @param nativeTags - List of tags
|
|
56
|
+
* @returns Tags indexed by id
|
|
57
|
+
*/
|
|
58
|
+
exports.orderTags = Core.orderTags;
|
|
59
|
+
/**
|
|
60
|
+
* Convert rating to 1-5 star rating
|
|
61
|
+
* @param rating - Normalized rating [0..1] (common.rating[n].rating)
|
|
62
|
+
* @returns Number of stars: 1, 2, 3, 4 or 5 stars
|
|
63
|
+
*/
|
|
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
|
+
};
|
package/lib/lyrics3/Lyrics3.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IRandomReader } from '../type';
|
|
2
|
-
export declare const endTag2 = "LYRICS200";
|
|
3
|
-
export declare function getLyricsHeaderLength(reader: IRandomReader): Promise<number>;
|
|
1
|
+
import { IRandomReader } from '../type';
|
|
2
|
+
export declare const endTag2 = "LYRICS200";
|
|
3
|
+
export declare function getLyricsHeaderLength(reader: IRandomReader): Promise<number>;
|
package/lib/lyrics3/Lyrics3.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getLyricsHeaderLength = exports.endTag2 = void 0;
|
|
4
|
-
exports.endTag2 = 'LYRICS200';
|
|
5
|
-
async function getLyricsHeaderLength(reader) {
|
|
6
|
-
if (reader.fileSize >= 143) {
|
|
7
|
-
const buf = Buffer.alloc(15);
|
|
8
|
-
await reader.randomRead(buf, 0, buf.length, reader.fileSize - 143);
|
|
9
|
-
const txt = buf.toString('binary');
|
|
10
|
-
const tag = txt.substr(6);
|
|
11
|
-
if (tag === exports.endTag2) {
|
|
12
|
-
return parseInt(txt.substr(0, 6), 10) + 15;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return 0;
|
|
16
|
-
}
|
|
17
|
-
exports.getLyricsHeaderLength = getLyricsHeaderLength;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLyricsHeaderLength = exports.endTag2 = void 0;
|
|
4
|
+
exports.endTag2 = 'LYRICS200';
|
|
5
|
+
async function getLyricsHeaderLength(reader) {
|
|
6
|
+
if (reader.fileSize >= 143) {
|
|
7
|
+
const buf = Buffer.alloc(15);
|
|
8
|
+
await reader.randomRead(buf, 0, buf.length, reader.fileSize - 143);
|
|
9
|
+
const txt = buf.toString('binary');
|
|
10
|
+
const tag = txt.substr(6);
|
|
11
|
+
if (tag === exports.endTag2) {
|
|
12
|
+
return parseInt(txt.substr(0, 6), 10) + 15;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return 0;
|
|
16
|
+
}
|
|
17
|
+
exports.getLyricsHeaderLength = getLyricsHeaderLength;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IContainerType } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Elements of document type description
|
|
4
|
-
* Derived from https://github.com/tungol/EBML/blob/master/doctypes/matroska.dtd
|
|
5
|
-
* Extended with:
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
export declare const elements: IContainerType;
|
|
1
|
+
import { IContainerType } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Elements of document type description
|
|
4
|
+
* Derived from https://github.com/tungol/EBML/blob/master/doctypes/matroska.dtd
|
|
5
|
+
* Extended with:
|
|
6
|
+
* - https://www.matroska.org/technical/specs/index.html
|
|
7
|
+
*/
|
|
8
|
+
export declare const elements: IContainerType;
|