music-metadata 7.12.1 → 7.12.4
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/LICENSE.txt +9 -9
- package/README.md +434 -434
- package/lib/ParserFactory.d.ts +48 -48
- package/lib/ParserFactory.js +252 -252
- package/lib/aiff/AiffParser.d.ts +14 -14
- package/lib/aiff/AiffParser.js +84 -84
- 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 +164 -161
- 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 +381 -381
- 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 +38 -38
- package/lib/asf/GUID.d.ts +84 -84
- package/lib/asf/GUID.js +121 -121
- 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 +22 -22
- package/lib/common/RandomFileReader.js +34 -34
- package/lib/common/RandomUint8ArrayReader.d.ts +18 -18
- package/lib/common/RandomUint8ArrayReader.js +25 -25
- package/lib/common/Util.d.ts +57 -57
- package/lib/common/Util.js +157 -157
- 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 +31 -31
- 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 +28 -28
- package/lib/id3v2/ID3v2Parser.js +182 -182
- 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 +32 -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 -524
- 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 -69
- 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 -592
- package/lib/type.js +5 -5
- package/lib/wav/BwfChunk.d.ts +17 -17
- package/lib/wav/BwfChunk.js +29 -28
- 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 +158 -156
- package/lib/wavpack/WavPackParser.d.ts +14 -14
- package/lib/wavpack/WavPackParser.js +99 -99
- package/lib/wavpack/WavPackToken.d.ts +64 -64
- package/lib/wavpack/WavPackToken.js +76 -76
- package/package.json +150 -150
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CombinedTagMapper = void 0;
|
|
4
|
-
const ID3v1TagMap_1 = require("../id3v1/ID3v1TagMap");
|
|
5
|
-
const ID3v24TagMapper_1 = require("../id3v2/ID3v24TagMapper");
|
|
6
|
-
const AsfTagMapper_1 = require("../asf/AsfTagMapper");
|
|
7
|
-
const ID3v22TagMapper_1 = require("../id3v2/ID3v22TagMapper");
|
|
8
|
-
const APEv2TagMapper_1 = require("../apev2/APEv2TagMapper");
|
|
9
|
-
const MP4TagMapper_1 = require("../mp4/MP4TagMapper");
|
|
10
|
-
const VorbisTagMapper_1 = require("../ogg/vorbis/VorbisTagMapper");
|
|
11
|
-
const RiffInfoTagMap_1 = require("../riff/RiffInfoTagMap");
|
|
12
|
-
const MatroskaTagMapper_1 = require("../matroska/MatroskaTagMapper");
|
|
13
|
-
class CombinedTagMapper {
|
|
14
|
-
constructor() {
|
|
15
|
-
this.tagMappers = {};
|
|
16
|
-
[
|
|
17
|
-
new ID3v1TagMap_1.ID3v1TagMapper(),
|
|
18
|
-
new ID3v22TagMapper_1.ID3v22TagMapper(),
|
|
19
|
-
new ID3v24TagMapper_1.ID3v24TagMapper(),
|
|
20
|
-
new MP4TagMapper_1.MP4TagMapper(),
|
|
21
|
-
new MP4TagMapper_1.MP4TagMapper(),
|
|
22
|
-
new VorbisTagMapper_1.VorbisTagMapper(),
|
|
23
|
-
new APEv2TagMapper_1.APEv2TagMapper(),
|
|
24
|
-
new AsfTagMapper_1.AsfTagMapper(),
|
|
25
|
-
new RiffInfoTagMap_1.RiffInfoTagMapper(),
|
|
26
|
-
new MatroskaTagMapper_1.MatroskaTagMapper()
|
|
27
|
-
].forEach(mapper => {
|
|
28
|
-
this.registerTagMapper(mapper);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Convert native to generic (common) tags
|
|
33
|
-
* @param tagType Originating tag format
|
|
34
|
-
* @param tag Native tag to map to a generic tag id
|
|
35
|
-
* @param warnings
|
|
36
|
-
* @return Generic tag result (output of this function)
|
|
37
|
-
*/
|
|
38
|
-
mapTag(tagType, tag, warnings) {
|
|
39
|
-
const tagMapper = this.tagMappers[tagType];
|
|
40
|
-
if (tagMapper) {
|
|
41
|
-
return this.tagMappers[tagType].mapGenericTag(tag, warnings);
|
|
42
|
-
}
|
|
43
|
-
throw new Error('No generic tag mapper defined for tag-format: ' + tagType);
|
|
44
|
-
}
|
|
45
|
-
registerTagMapper(genericTagMapper) {
|
|
46
|
-
for (const tagType of genericTagMapper.tagTypes) {
|
|
47
|
-
this.tagMappers[tagType] = genericTagMapper;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.CombinedTagMapper = CombinedTagMapper;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CombinedTagMapper = void 0;
|
|
4
|
+
const ID3v1TagMap_1 = require("../id3v1/ID3v1TagMap");
|
|
5
|
+
const ID3v24TagMapper_1 = require("../id3v2/ID3v24TagMapper");
|
|
6
|
+
const AsfTagMapper_1 = require("../asf/AsfTagMapper");
|
|
7
|
+
const ID3v22TagMapper_1 = require("../id3v2/ID3v22TagMapper");
|
|
8
|
+
const APEv2TagMapper_1 = require("../apev2/APEv2TagMapper");
|
|
9
|
+
const MP4TagMapper_1 = require("../mp4/MP4TagMapper");
|
|
10
|
+
const VorbisTagMapper_1 = require("../ogg/vorbis/VorbisTagMapper");
|
|
11
|
+
const RiffInfoTagMap_1 = require("../riff/RiffInfoTagMap");
|
|
12
|
+
const MatroskaTagMapper_1 = require("../matroska/MatroskaTagMapper");
|
|
13
|
+
class CombinedTagMapper {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.tagMappers = {};
|
|
16
|
+
[
|
|
17
|
+
new ID3v1TagMap_1.ID3v1TagMapper(),
|
|
18
|
+
new ID3v22TagMapper_1.ID3v22TagMapper(),
|
|
19
|
+
new ID3v24TagMapper_1.ID3v24TagMapper(),
|
|
20
|
+
new MP4TagMapper_1.MP4TagMapper(),
|
|
21
|
+
new MP4TagMapper_1.MP4TagMapper(),
|
|
22
|
+
new VorbisTagMapper_1.VorbisTagMapper(),
|
|
23
|
+
new APEv2TagMapper_1.APEv2TagMapper(),
|
|
24
|
+
new AsfTagMapper_1.AsfTagMapper(),
|
|
25
|
+
new RiffInfoTagMap_1.RiffInfoTagMapper(),
|
|
26
|
+
new MatroskaTagMapper_1.MatroskaTagMapper()
|
|
27
|
+
].forEach(mapper => {
|
|
28
|
+
this.registerTagMapper(mapper);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Convert native to generic (common) tags
|
|
33
|
+
* @param tagType Originating tag format
|
|
34
|
+
* @param tag Native tag to map to a generic tag id
|
|
35
|
+
* @param warnings
|
|
36
|
+
* @return Generic tag result (output of this function)
|
|
37
|
+
*/
|
|
38
|
+
mapTag(tagType, tag, warnings) {
|
|
39
|
+
const tagMapper = this.tagMappers[tagType];
|
|
40
|
+
if (tagMapper) {
|
|
41
|
+
return this.tagMappers[tagType].mapGenericTag(tag, warnings);
|
|
42
|
+
}
|
|
43
|
+
throw new Error('No generic tag mapper defined for tag-format: ' + tagType);
|
|
44
|
+
}
|
|
45
|
+
registerTagMapper(genericTagMapper) {
|
|
46
|
+
for (const tagType of genericTagMapper.tagTypes) {
|
|
47
|
+
this.tagMappers[tagType] = genericTagMapper;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.CombinedTagMapper = CombinedTagMapper;
|
|
52
52
|
//# sourceMappingURL=CombinedTagMapper.js.map
|
package/lib/common/FourCC.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IToken } from 'strtok3/lib/core';
|
|
2
|
-
/**
|
|
3
|
-
* Token for read FourCC
|
|
4
|
-
* Ref: https://en.wikipedia.org/wiki/FourCC
|
|
5
|
-
*/
|
|
6
|
-
export declare const FourCcToken: IToken<string>;
|
|
1
|
+
import { IToken } from 'strtok3/lib/core';
|
|
2
|
+
/**
|
|
3
|
+
* Token for read FourCC
|
|
4
|
+
* Ref: https://en.wikipedia.org/wiki/FourCC
|
|
5
|
+
*/
|
|
6
|
+
export declare const FourCcToken: IToken<string>;
|
package/lib/common/FourCC.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FourCcToken = void 0;
|
|
4
|
-
const util = require("./Util");
|
|
5
|
-
const validFourCC = /^[\x21-\x7e©][\x20-\x7e\x00()]{3}/;
|
|
6
|
-
/**
|
|
7
|
-
* Token for read FourCC
|
|
8
|
-
* Ref: https://en.wikipedia.org/wiki/FourCC
|
|
9
|
-
*/
|
|
10
|
-
exports.FourCcToken = {
|
|
11
|
-
len: 4,
|
|
12
|
-
get: (buf, off) => {
|
|
13
|
-
const id = buf.toString('binary', off, off + exports.FourCcToken.len);
|
|
14
|
-
switch (id) {
|
|
15
|
-
default:
|
|
16
|
-
if (!id.match(validFourCC)) {
|
|
17
|
-
throw new Error(`FourCC contains invalid characters: ${util.a2hex(id)} "${id}"`);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return id;
|
|
21
|
-
},
|
|
22
|
-
put: (buffer, offset, id) => {
|
|
23
|
-
const str = Buffer.from(id, 'binary');
|
|
24
|
-
if (str.length !== 4)
|
|
25
|
-
throw new Error('Invalid length');
|
|
26
|
-
return str.copy(buffer, offset);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FourCcToken = void 0;
|
|
4
|
+
const util = require("./Util");
|
|
5
|
+
const validFourCC = /^[\x21-\x7e©][\x20-\x7e\x00()]{3}/;
|
|
6
|
+
/**
|
|
7
|
+
* Token for read FourCC
|
|
8
|
+
* Ref: https://en.wikipedia.org/wiki/FourCC
|
|
9
|
+
*/
|
|
10
|
+
exports.FourCcToken = {
|
|
11
|
+
len: 4,
|
|
12
|
+
get: (buf, off) => {
|
|
13
|
+
const id = buf.toString('binary', off, off + exports.FourCcToken.len);
|
|
14
|
+
switch (id) {
|
|
15
|
+
default:
|
|
16
|
+
if (!id.match(validFourCC)) {
|
|
17
|
+
throw new Error(`FourCC contains invalid characters: ${util.a2hex(id)} "${id}"`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return id;
|
|
21
|
+
},
|
|
22
|
+
put: (buffer, offset, id) => {
|
|
23
|
+
const str = Buffer.from(id, 'binary');
|
|
24
|
+
if (str.length !== 4)
|
|
25
|
+
throw new Error('Invalid length');
|
|
26
|
+
return str.copy(buffer, offset);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
29
|
//# sourceMappingURL=FourCC.js.map
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import * as generic from './GenericTagTypes';
|
|
2
|
-
import { ITag } from '../type';
|
|
3
|
-
import { INativeMetadataCollector, IWarningCollector } from './MetadataCollector';
|
|
4
|
-
export interface IGenericTagMapper {
|
|
5
|
-
/**
|
|
6
|
-
* Which tagType it able to map to the generic mapping format
|
|
7
|
-
*/
|
|
8
|
-
tagTypes: generic.TagType[];
|
|
9
|
-
/**
|
|
10
|
-
* Basic tag map
|
|
11
|
-
*/
|
|
12
|
-
tagMap: generic.INativeTagMap;
|
|
13
|
-
/**
|
|
14
|
-
* Map native tag to generic tag
|
|
15
|
-
* @param tag Native tag
|
|
16
|
-
* @param warnings Register warnings
|
|
17
|
-
* @return Generic tag, if native tag could be mapped
|
|
18
|
-
*/
|
|
19
|
-
mapGenericTag(tag: ITag, warnings: INativeMetadataCollector): generic.IGenericTag;
|
|
20
|
-
}
|
|
21
|
-
export declare class CommonTagMapper implements IGenericTagMapper {
|
|
22
|
-
tagTypes: generic.TagType[];
|
|
23
|
-
tagMap: generic.INativeTagMap;
|
|
24
|
-
static maxRatingScore: number;
|
|
25
|
-
static toIntOrNull(str: string): number;
|
|
26
|
-
static normalizeTrack(origVal: number | string): {
|
|
27
|
-
no: number;
|
|
28
|
-
of: number;
|
|
29
|
-
};
|
|
30
|
-
constructor(tagTypes: generic.TagType[], tagMap: generic.INativeTagMap);
|
|
31
|
-
/**
|
|
32
|
-
* Process and set common tags
|
|
33
|
-
* write common tags to
|
|
34
|
-
* @param tag Native tag
|
|
35
|
-
* @param warnings Register warnings
|
|
36
|
-
* @return common name
|
|
37
|
-
*/
|
|
38
|
-
mapGenericTag(tag: ITag, warnings: IWarningCollector): generic.IGenericTag;
|
|
39
|
-
/**
|
|
40
|
-
* Convert native tag key to common tag key
|
|
41
|
-
* @tag Native header tag
|
|
42
|
-
* @return common tag name (alias)
|
|
43
|
-
*/
|
|
44
|
-
protected getCommonName(tag: string): generic.GenericTagId;
|
|
45
|
-
/**
|
|
46
|
-
* Handle post mapping exceptions / correction
|
|
47
|
-
* @param tag Tag e.g. {"©alb", "Buena Vista Social Club")
|
|
48
|
-
* @param warnings Used to register warnings
|
|
49
|
-
*/
|
|
50
|
-
protected postMap(tag: ITag, warnings: IWarningCollector): void;
|
|
51
|
-
}
|
|
1
|
+
import * as generic from './GenericTagTypes';
|
|
2
|
+
import { ITag } from '../type';
|
|
3
|
+
import { INativeMetadataCollector, IWarningCollector } from './MetadataCollector';
|
|
4
|
+
export interface IGenericTagMapper {
|
|
5
|
+
/**
|
|
6
|
+
* Which tagType it able to map to the generic mapping format
|
|
7
|
+
*/
|
|
8
|
+
tagTypes: generic.TagType[];
|
|
9
|
+
/**
|
|
10
|
+
* Basic tag map
|
|
11
|
+
*/
|
|
12
|
+
tagMap: generic.INativeTagMap;
|
|
13
|
+
/**
|
|
14
|
+
* Map native tag to generic tag
|
|
15
|
+
* @param tag Native tag
|
|
16
|
+
* @param warnings Register warnings
|
|
17
|
+
* @return Generic tag, if native tag could be mapped
|
|
18
|
+
*/
|
|
19
|
+
mapGenericTag(tag: ITag, warnings: INativeMetadataCollector): generic.IGenericTag;
|
|
20
|
+
}
|
|
21
|
+
export declare class CommonTagMapper implements IGenericTagMapper {
|
|
22
|
+
tagTypes: generic.TagType[];
|
|
23
|
+
tagMap: generic.INativeTagMap;
|
|
24
|
+
static maxRatingScore: number;
|
|
25
|
+
static toIntOrNull(str: string): number;
|
|
26
|
+
static normalizeTrack(origVal: number | string): {
|
|
27
|
+
no: number;
|
|
28
|
+
of: number;
|
|
29
|
+
};
|
|
30
|
+
constructor(tagTypes: generic.TagType[], tagMap: generic.INativeTagMap);
|
|
31
|
+
/**
|
|
32
|
+
* Process and set common tags
|
|
33
|
+
* write common tags to
|
|
34
|
+
* @param tag Native tag
|
|
35
|
+
* @param warnings Register warnings
|
|
36
|
+
* @return common name
|
|
37
|
+
*/
|
|
38
|
+
mapGenericTag(tag: ITag, warnings: IWarningCollector): generic.IGenericTag;
|
|
39
|
+
/**
|
|
40
|
+
* Convert native tag key to common tag key
|
|
41
|
+
* @tag Native header tag
|
|
42
|
+
* @return common tag name (alias)
|
|
43
|
+
*/
|
|
44
|
+
protected getCommonName(tag: string): generic.GenericTagId;
|
|
45
|
+
/**
|
|
46
|
+
* Handle post mapping exceptions / correction
|
|
47
|
+
* @param tag Tag e.g. {"©alb", "Buena Vista Social Club")
|
|
48
|
+
* @param warnings Used to register warnings
|
|
49
|
+
*/
|
|
50
|
+
protected postMap(tag: ITag, warnings: IWarningCollector): void;
|
|
51
|
+
}
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CommonTagMapper = void 0;
|
|
4
|
-
class CommonTagMapper {
|
|
5
|
-
constructor(tagTypes, tagMap) {
|
|
6
|
-
this.tagTypes = tagTypes;
|
|
7
|
-
this.tagMap = tagMap;
|
|
8
|
-
}
|
|
9
|
-
static toIntOrNull(str) {
|
|
10
|
-
const cleaned = parseInt(str, 10);
|
|
11
|
-
return isNaN(cleaned) ? null : cleaned;
|
|
12
|
-
}
|
|
13
|
-
// TODO: a string of 1of1 would fail to be converted
|
|
14
|
-
// converts 1/10 to no : 1, of : 10
|
|
15
|
-
// or 1 to no : 1, of : 0
|
|
16
|
-
static normalizeTrack(origVal) {
|
|
17
|
-
const split = origVal.toString().split('/');
|
|
18
|
-
return {
|
|
19
|
-
no: parseInt(split[0], 10) || null,
|
|
20
|
-
of: parseInt(split[1], 10) || null
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Process and set common tags
|
|
25
|
-
* write common tags to
|
|
26
|
-
* @param tag Native tag
|
|
27
|
-
* @param warnings Register warnings
|
|
28
|
-
* @return common name
|
|
29
|
-
*/
|
|
30
|
-
mapGenericTag(tag, warnings) {
|
|
31
|
-
tag = { id: tag.id, value: tag.value }; // clone object
|
|
32
|
-
this.postMap(tag, warnings);
|
|
33
|
-
// Convert native tag event to generic 'alias' tag
|
|
34
|
-
const id = this.getCommonName(tag.id);
|
|
35
|
-
return id ? { id, value: tag.value } : null;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Convert native tag key to common tag key
|
|
39
|
-
* @tag Native header tag
|
|
40
|
-
* @return common tag name (alias)
|
|
41
|
-
*/
|
|
42
|
-
getCommonName(tag) {
|
|
43
|
-
return this.tagMap[tag];
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Handle post mapping exceptions / correction
|
|
47
|
-
* @param tag Tag e.g. {"©alb", "Buena Vista Social Club")
|
|
48
|
-
* @param warnings Used to register warnings
|
|
49
|
-
*/
|
|
50
|
-
postMap(tag, warnings) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.CommonTagMapper = CommonTagMapper;
|
|
55
|
-
CommonTagMapper.maxRatingScore = 1;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommonTagMapper = void 0;
|
|
4
|
+
class CommonTagMapper {
|
|
5
|
+
constructor(tagTypes, tagMap) {
|
|
6
|
+
this.tagTypes = tagTypes;
|
|
7
|
+
this.tagMap = tagMap;
|
|
8
|
+
}
|
|
9
|
+
static toIntOrNull(str) {
|
|
10
|
+
const cleaned = parseInt(str, 10);
|
|
11
|
+
return isNaN(cleaned) ? null : cleaned;
|
|
12
|
+
}
|
|
13
|
+
// TODO: a string of 1of1 would fail to be converted
|
|
14
|
+
// converts 1/10 to no : 1, of : 10
|
|
15
|
+
// or 1 to no : 1, of : 0
|
|
16
|
+
static normalizeTrack(origVal) {
|
|
17
|
+
const split = origVal.toString().split('/');
|
|
18
|
+
return {
|
|
19
|
+
no: parseInt(split[0], 10) || null,
|
|
20
|
+
of: parseInt(split[1], 10) || null
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Process and set common tags
|
|
25
|
+
* write common tags to
|
|
26
|
+
* @param tag Native tag
|
|
27
|
+
* @param warnings Register warnings
|
|
28
|
+
* @return common name
|
|
29
|
+
*/
|
|
30
|
+
mapGenericTag(tag, warnings) {
|
|
31
|
+
tag = { id: tag.id, value: tag.value }; // clone object
|
|
32
|
+
this.postMap(tag, warnings);
|
|
33
|
+
// Convert native tag event to generic 'alias' tag
|
|
34
|
+
const id = this.getCommonName(tag.id);
|
|
35
|
+
return id ? { id, value: tag.value } : null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Convert native tag key to common tag key
|
|
39
|
+
* @tag Native header tag
|
|
40
|
+
* @return common tag name (alias)
|
|
41
|
+
*/
|
|
42
|
+
getCommonName(tag) {
|
|
43
|
+
return this.tagMap[tag];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Handle post mapping exceptions / correction
|
|
47
|
+
* @param tag Tag e.g. {"©alb", "Buena Vista Social Club")
|
|
48
|
+
* @param warnings Used to register warnings
|
|
49
|
+
*/
|
|
50
|
+
postMap(tag, warnings) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.CommonTagMapper = CommonTagMapper;
|
|
55
|
+
CommonTagMapper.maxRatingScore = 1;
|
|
56
56
|
//# sourceMappingURL=GenericTagMapper.js.map
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
export declare type TagType = 'vorbis' | 'ID3v1' | 'ID3v2.2' | 'ID3v2.3' | 'ID3v2.4' | 'APEv2' | 'asf' | 'iTunes' | 'exif' | 'matroska';
|
|
2
|
-
export interface IGenericTag {
|
|
3
|
-
id: GenericTagId;
|
|
4
|
-
value: any;
|
|
5
|
-
}
|
|
6
|
-
export declare type GenericTagId = 'track' | 'disk' | 'year' | 'title' | 'artist' | 'artists' | 'albumartist' | 'album' | 'date' | 'originaldate' | 'originalyear' | 'comment' | 'genre' | 'picture' | 'composer' | 'lyrics' | 'albumsort' | 'titlesort' | 'work' | 'artistsort' | 'albumartistsort' | 'composersort' | 'lyricist' | 'writer' | 'conductor' | 'remixer' | 'arranger' | 'engineer' | 'technician' | 'producer' | 'djmixer' | 'mixer' | 'publisher' | 'label' | 'grouping' | 'subtitle' | 'discsubtitle' | 'totaltracks' | 'totaldiscs' | 'compilation' | 'rating' | 'bpm' | 'mood' | 'media' | 'catalognumber' | 'tvShow' | 'tvShowSort' | 'tvEpisode' | 'tvEpisodeId' | 'tvNetwork' | 'tvSeason' | 'podcast' | 'podcasturl' | 'releasestatus' | 'releasetype' | 'releasecountry' | 'script' | 'language' | 'copyright' | 'license' | 'encodedby' | 'encodersettings' | 'gapless' | 'barcode' | 'isrc' | 'asin' | 'musicbrainz_recordingid' | 'musicbrainz_trackid' | 'musicbrainz_albumid' | 'musicbrainz_artistid' | 'musicbrainz_albumartistid' | 'musicbrainz_releasegroupid' | 'musicbrainz_workid' | 'musicbrainz_trmid' | 'musicbrainz_discid' | 'acoustid_id' | 'acoustid_fingerprint' | 'musicip_puid' | 'musicip_fingerprint' | 'website' | 'performer:instrument' | 'peakLevel' | 'averageLevel' | 'notes' | 'key' | 'originalalbum' | 'originalartist' | 'discogs_artist_id' | 'discogs_label_id' | 'discogs_master_release_id' | 'discogs_rating' | 'discogs_release_id' | 'discogs_votes' | 'replaygain_track_gain' | 'replaygain_track_peak' | 'replaygain_album_gain' | 'replaygain_album_peak' | 'replaygain_track_minmax' | 'replaygain_album_minmax' | 'replaygain_undo' | 'description' | 'longDescription' | 'category' | 'hdVideo' | 'keywords' | 'movement' | 'movementIndex' | 'movementTotal' | 'podcastId' | 'showMovement' | 'stik';
|
|
7
|
-
export interface INativeTagMap {
|
|
8
|
-
[index: string]: GenericTagId;
|
|
9
|
-
}
|
|
10
|
-
export interface ITagInfo {
|
|
11
|
-
/**
|
|
12
|
-
* True if result is an array
|
|
13
|
-
*/
|
|
14
|
-
multiple: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* True if the result is an array and each value in the array should be unique
|
|
17
|
-
*/
|
|
18
|
-
unique?: boolean;
|
|
19
|
-
}
|
|
20
|
-
export interface ITagInfoMap {
|
|
21
|
-
[index: string]: ITagInfo;
|
|
22
|
-
}
|
|
23
|
-
export declare const commonTags: ITagInfoMap;
|
|
24
|
-
/**
|
|
25
|
-
* @param alias Name of common tag
|
|
26
|
-
* @returns {boolean|*} true if given alias is mapped as a singleton', otherwise false
|
|
27
|
-
*/
|
|
28
|
-
export declare function isSingleton(alias: GenericTagId): boolean;
|
|
29
|
-
/**
|
|
30
|
-
* @param alias Common (generic) tag
|
|
31
|
-
* @returns {boolean|*} true if given alias is a singleton or explicitly marked as unique
|
|
32
|
-
*/
|
|
33
|
-
export declare function isUnique(alias: GenericTagId): boolean;
|
|
1
|
+
export declare type TagType = 'vorbis' | 'ID3v1' | 'ID3v2.2' | 'ID3v2.3' | 'ID3v2.4' | 'APEv2' | 'asf' | 'iTunes' | 'exif' | 'matroska';
|
|
2
|
+
export interface IGenericTag {
|
|
3
|
+
id: GenericTagId;
|
|
4
|
+
value: any;
|
|
5
|
+
}
|
|
6
|
+
export declare type GenericTagId = 'track' | 'disk' | 'year' | 'title' | 'artist' | 'artists' | 'albumartist' | 'album' | 'date' | 'originaldate' | 'originalyear' | 'comment' | 'genre' | 'picture' | 'composer' | 'lyrics' | 'albumsort' | 'titlesort' | 'work' | 'artistsort' | 'albumartistsort' | 'composersort' | 'lyricist' | 'writer' | 'conductor' | 'remixer' | 'arranger' | 'engineer' | 'technician' | 'producer' | 'djmixer' | 'mixer' | 'publisher' | 'label' | 'grouping' | 'subtitle' | 'discsubtitle' | 'totaltracks' | 'totaldiscs' | 'compilation' | 'rating' | 'bpm' | 'mood' | 'media' | 'catalognumber' | 'tvShow' | 'tvShowSort' | 'tvEpisode' | 'tvEpisodeId' | 'tvNetwork' | 'tvSeason' | 'podcast' | 'podcasturl' | 'releasestatus' | 'releasetype' | 'releasecountry' | 'script' | 'language' | 'copyright' | 'license' | 'encodedby' | 'encodersettings' | 'gapless' | 'barcode' | 'isrc' | 'asin' | 'musicbrainz_recordingid' | 'musicbrainz_trackid' | 'musicbrainz_albumid' | 'musicbrainz_artistid' | 'musicbrainz_albumartistid' | 'musicbrainz_releasegroupid' | 'musicbrainz_workid' | 'musicbrainz_trmid' | 'musicbrainz_discid' | 'acoustid_id' | 'acoustid_fingerprint' | 'musicip_puid' | 'musicip_fingerprint' | 'website' | 'performer:instrument' | 'peakLevel' | 'averageLevel' | 'notes' | 'key' | 'originalalbum' | 'originalartist' | 'discogs_artist_id' | 'discogs_label_id' | 'discogs_master_release_id' | 'discogs_rating' | 'discogs_release_id' | 'discogs_votes' | 'replaygain_track_gain' | 'replaygain_track_peak' | 'replaygain_album_gain' | 'replaygain_album_peak' | 'replaygain_track_minmax' | 'replaygain_album_minmax' | 'replaygain_undo' | 'description' | 'longDescription' | 'category' | 'hdVideo' | 'keywords' | 'movement' | 'movementIndex' | 'movementTotal' | 'podcastId' | 'showMovement' | 'stik';
|
|
7
|
+
export interface INativeTagMap {
|
|
8
|
+
[index: string]: GenericTagId;
|
|
9
|
+
}
|
|
10
|
+
export interface ITagInfo {
|
|
11
|
+
/**
|
|
12
|
+
* True if result is an array
|
|
13
|
+
*/
|
|
14
|
+
multiple: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* True if the result is an array and each value in the array should be unique
|
|
17
|
+
*/
|
|
18
|
+
unique?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface ITagInfoMap {
|
|
21
|
+
[index: string]: ITagInfo;
|
|
22
|
+
}
|
|
23
|
+
export declare const commonTags: ITagInfoMap;
|
|
24
|
+
/**
|
|
25
|
+
* @param alias Name of common tag
|
|
26
|
+
* @returns {boolean|*} true if given alias is mapped as a singleton', otherwise false
|
|
27
|
+
*/
|
|
28
|
+
export declare function isSingleton(alias: GenericTagId): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* @param alias Common (generic) tag
|
|
31
|
+
* @returns {boolean|*} true if given alias is a singleton or explicitly marked as unique
|
|
32
|
+
*/
|
|
33
|
+
export declare function isUnique(alias: GenericTagId): boolean;
|