music-metadata 8.1.2 → 8.1.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.
@@ -93,7 +93,7 @@ export class IgnoreObjectState extends State {
93
93
  * Token for: 3.2: File Properties Object (mandatory, one only)
94
94
  * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_2
95
95
  */
96
- export class FilePropertiesObject extends State {
96
+ class FilePropertiesObject extends State {
97
97
  constructor(header) {
98
98
  super(header);
99
99
  }
@@ -118,11 +118,12 @@ export class FilePropertiesObject extends State {
118
118
  }
119
119
  }
120
120
  FilePropertiesObject.guid = GUID.FilePropertiesObject;
121
+ export { FilePropertiesObject };
121
122
  /**
122
123
  * Token for: 3.3 Stream Properties Object (mandatory, one per stream)
123
124
  * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_3
124
125
  */
125
- export class StreamPropertiesObject extends State {
126
+ class StreamPropertiesObject extends State {
126
127
  constructor(header) {
127
128
  super(header);
128
129
  }
@@ -135,11 +136,12 @@ export class StreamPropertiesObject extends State {
135
136
  }
136
137
  }
137
138
  StreamPropertiesObject.guid = GUID.StreamPropertiesObject;
139
+ export { StreamPropertiesObject };
138
140
  /**
139
141
  * 3.4: Header Extension Object (mandatory, one only)
140
142
  * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_4
141
143
  */
142
- export class HeaderExtensionObject {
144
+ class HeaderExtensionObject {
143
145
  constructor() {
144
146
  this.len = 22;
145
147
  }
@@ -152,6 +154,7 @@ export class HeaderExtensionObject {
152
154
  }
153
155
  }
154
156
  HeaderExtensionObject.guid = GUID.HeaderExtensionObject;
157
+ export { HeaderExtensionObject };
155
158
  /**
156
159
  * 3.5: The Codec List Object provides user-friendly information about the codecs and formats used to encode the content found in the ASF file.
157
160
  * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_5
@@ -206,7 +209,7 @@ async function readCodecEntry(tokenizer) {
206
209
  * 3.10 Content Description Object (optional, one only)
207
210
  * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_10
208
211
  */
209
- export class ContentDescriptionObjectState extends State {
212
+ class ContentDescriptionObjectState extends State {
210
213
  constructor(header) {
211
214
  super(header);
212
215
  }
@@ -227,11 +230,12 @@ export class ContentDescriptionObjectState extends State {
227
230
  }
228
231
  ContentDescriptionObjectState.guid = GUID.ContentDescriptionObject;
229
232
  ContentDescriptionObjectState.contentDescTags = ['Title', 'Author', 'Copyright', 'Description', 'Rating'];
233
+ export { ContentDescriptionObjectState };
230
234
  /**
231
235
  * 3.11 Extended Content Description Object (optional, one only)
232
236
  * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_11
233
237
  */
234
- export class ExtendedContentDescriptionObjectState extends State {
238
+ class ExtendedContentDescriptionObjectState extends State {
235
239
  constructor(header) {
236
240
  super(header);
237
241
  }
@@ -256,11 +260,12 @@ export class ExtendedContentDescriptionObjectState extends State {
256
260
  }
257
261
  }
258
262
  ExtendedContentDescriptionObjectState.guid = GUID.ExtendedContentDescriptionObject;
263
+ export { ExtendedContentDescriptionObjectState };
259
264
  /**
260
265
  * 4.1 Extended Stream Properties Object (optional, 1 per media stream)
261
266
  * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/04_objects_in_the_asf_header_extension_object.html#4_1
262
267
  */
263
- export class ExtendedStreamPropertiesObjectState extends State {
268
+ class ExtendedStreamPropertiesObjectState extends State {
264
269
  constructor(header) {
265
270
  super(header);
266
271
  }
@@ -292,11 +297,12 @@ export class ExtendedStreamPropertiesObjectState extends State {
292
297
  }
293
298
  }
294
299
  ExtendedStreamPropertiesObjectState.guid = GUID.ExtendedStreamPropertiesObject;
300
+ export { ExtendedStreamPropertiesObjectState };
295
301
  /**
296
302
  * 4.7 Metadata Object (optional, 0 or 1)
297
303
  * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/04_objects_in_the_asf_header_extension_object.html#4_7
298
304
  */
299
- export class MetadataObjectState extends State {
305
+ class MetadataObjectState extends State {
300
306
  constructor(header) {
301
307
  super(header);
302
308
  }
@@ -323,13 +329,15 @@ export class MetadataObjectState extends State {
323
329
  }
324
330
  }
325
331
  MetadataObjectState.guid = GUID.MetadataObject;
332
+ export { MetadataObjectState };
326
333
  // 4.8 Metadata Library Object (optional, 0 or 1)
327
- export class MetadataLibraryObjectState extends MetadataObjectState {
334
+ class MetadataLibraryObjectState extends MetadataObjectState {
328
335
  constructor(header) {
329
336
  super(header);
330
337
  }
331
338
  }
332
339
  MetadataLibraryObjectState.guid = GUID.MetadataLibraryObject;
340
+ export { MetadataLibraryObjectState };
333
341
  /**
334
342
  * Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/dd757977(v=vs.85).aspx
335
343
  */
@@ -1,7 +1,7 @@
1
1
  import * as Token from 'token-types';
2
2
  import { Buffer } from 'node:buffer';
3
3
  import * as util from '../common/Util.js';
4
- export class AsfUtil {
4
+ class AsfUtil {
5
5
  static getParserForAttr(i) {
6
6
  return AsfUtil.attributeParsers[i];
7
7
  }
@@ -33,3 +33,4 @@ AsfUtil.attributeParsers = [
33
33
  AsfUtil.parseWordAttr,
34
34
  AsfUtil.parseByteArrayAttr
35
35
  ];
36
+ export { AsfUtil };
package/lib/asf/GUID.js CHANGED
@@ -12,7 +12,7 @@
12
12
  * - http://drang.s4.xrea.com/program/tips/id3tag/wmp/10_asf_guids.html
13
13
  * - https://github.com/dji-sdk/FFmpeg/blob/master/libavformat/asf.c
14
14
  */
15
- export default class GUID {
15
+ class GUID {
16
16
  static fromBin(bin, offset = 0) {
17
17
  return new GUID(this.decode(bin, offset));
18
18
  }
@@ -116,3 +116,4 @@ GUID.Degradable_JPEG_Media = new GUID("35907DE0-E415-11CF-A917-00805F5C442B");
116
116
  GUID.FileTransferMedia = new GUID("91BD222C-F21C-497A-8B6D-5AA86BFC0185");
117
117
  GUID.BinaryMedia = new GUID("3AFB65E2-47EF-40F2-AC2C-70A90D71D343");
118
118
  GUID.ASF_Index_Placeholder_Object = new GUID("D9AADE20-7C17-4F9C-BC28-8555DD98E2A2");
119
+ export default GUID;
@@ -1,4 +1,4 @@
1
- export class CommonTagMapper {
1
+ class CommonTagMapper {
2
2
  static toIntOrNull(str) {
3
3
  const cleaned = parseInt(str, 10);
4
4
  return isNaN(cleaned) ? null : cleaned;
@@ -49,4 +49,5 @@ export class CommonTagMapper {
49
49
  }
50
50
  }
51
51
  CommonTagMapper.maxRatingScore = 1;
52
+ export { CommonTagMapper };
52
53
  //# sourceMappingURL=GenericTagMapper.js.map
package/lib/mp4/Atom.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import initDebug from 'debug';
2
2
  import * as AtomToken from './AtomToken.js';
3
+ import { Header } from './AtomToken.js';
3
4
  const debug = initDebug('music-metadata:parser:MP4:Atom');
4
5
  export class Atom {
5
6
  static async readAtom(tokenizer, dataHandler, parent, remaining) {
@@ -52,8 +53,10 @@ export class Atom {
52
53
  return this.readAtoms(tokenizer, dataHandler, this.getPayloadLength(remaining));
53
54
  case 'meta': // Metadata Atom, ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW8
54
55
  // meta has 4 bytes of padding, ignore
55
- await tokenizer.ignore(4);
56
- return this.readAtoms(tokenizer, dataHandler, this.getPayloadLength(remaining) - 4);
56
+ const peekHeader = await tokenizer.peekToken(Header);
57
+ const paddingLength = peekHeader.name === 'hdlr' ? 0 : 4;
58
+ await tokenizer.ignore(paddingLength);
59
+ return this.readAtoms(tokenizer, dataHandler, this.getPayloadLength(remaining) - paddingLength);
57
60
  case 'mdhd': // Media header atom
58
61
  case 'mvhd': // 'movie' => 'mvhd': movie header atom; child of Movie Atom
59
62
  case 'tkhd':
@@ -29,7 +29,7 @@ export class SegmentTable {
29
29
  /**
30
30
  * Parser for Ogg logical bitstream framing
31
31
  */
32
- export class OggParser extends BasicParser {
32
+ class OggParser extends BasicParser {
33
33
  /**
34
34
  * Parse page
35
35
  * @returns {Promise<void>}
@@ -119,3 +119,4 @@ OggParser.Header = {
119
119
  };
120
120
  }
121
121
  };
122
+ export { OggParser };
@@ -10,6 +10,7 @@ export const riffInfoTagMap = {
10
10
  TITL: 'title',
11
11
  IPRD: 'album',
12
12
  ITRK: 'track',
13
+ IPRT: 'track',
13
14
  COMM: 'comment',
14
15
  ICMT: 'comment',
15
16
  ICNT: 'releasecountry',
@@ -2,7 +2,7 @@ import * as Token from 'token-types';
2
2
  import { FourCcToken } from '../common/FourCC.js';
3
3
  const SampleRates = [6000, 8000, 9600, 11025, 12000, 16000, 22050, 24000, 32000, 44100,
4
4
  48000, 64000, 88200, 96000, 192000, -1];
5
- export class WavPack {
5
+ class WavPack {
6
6
  static isBitSet(flags, bitOffset) {
7
7
  return WavPack.getBitAllignedNumber(flags, bitOffset, 1) === 1;
8
8
  }
@@ -70,3 +70,4 @@ WavPack.MetadataIdToken = {
70
70
  };
71
71
  }
72
72
  };
73
+ export { WavPack };
package/package.json CHANGED
@@ -1,140 +1,140 @@
1
- {
2
- "name": "music-metadata",
3
- "description": "Music metadata parser for Node.js, supporting virtual any audio and tag format.",
4
- "version": "8.1.2",
5
- "author": {
6
- "name": "Borewit",
7
- "url": "https://github.com/Borewit"
8
- },
9
- "funding": {
10
- "type": "github",
11
- "url": "https://github.com/sponsors/Borewit"
12
- },
13
- "type": "module",
14
- "exports": {
15
- ".": {
16
- "node": "./lib/index.js",
17
- "default": "./lib/core.js"
18
- }
19
- },
20
- "types": "lib/index.d.ts",
21
- "files": [
22
- "lib/**/*.js",
23
- "lib/**/*.d.ts"
24
- ],
25
- "keywords": [
26
- "music",
27
- "metadata",
28
- "meta",
29
- "audio",
30
- "tag",
31
- "tags",
32
- "duration",
33
- "MusicBrainz",
34
- "Discogs",
35
- "Picard",
36
- "ID3",
37
- "ID3v1",
38
- "ID3v2",
39
- "m4a",
40
- "m4b",
41
- "mp3",
42
- "mp4",
43
- "Vorbis",
44
- "ogg",
45
- "flac",
46
- "Matroska",
47
- "WebM",
48
- "EBML",
49
- "asf",
50
- "wma",
51
- "wmv",
52
- "ape",
53
- "MonkeyAudio",
54
- "aiff",
55
- "wav",
56
- "WavPack",
57
- "Opus",
58
- "speex",
59
- "musepack",
60
- "mpc",
61
- "dsd",
62
- "dsf",
63
- "mpc",
64
- "dff",
65
- "dsdiff",
66
- "aac",
67
- "adts",
68
- "length",
69
- "chapter",
70
- "info",
71
- "parse",
72
- "parser",
73
- "bwf"
74
- ],
75
- "scripts": {
76
- "clean": "del-cli lib/**/*.js lib/**/*.js.map lib/**/*.d.ts src/**/*.d.ts test/**/*.js test/**/*.js.map test/**/*.js test/**/*.js.map doc-gen/**/*.js doc-gen/**/*.js.map",
77
- "compile-src": "tsc -p lib",
78
- "compile-test": "tsc -p test",
79
- "compile-doc": "tsc -p doc-gen",
80
- "compile": "npm run compile-src && npm run compile-test && npm run compile-doc",
81
- "eslint": "eslint lib/**/*.ts --ignore-pattern lib/**/*.d.ts example/typescript/**/*.ts test/**/*.ts doc-gen/**/*.ts",
82
- "lint-md": "remark -u preset-lint-recommended .",
83
- "lint": "npm run lint-md && npm run eslint",
84
- "test": "mocha",
85
- "build": "npm run clean && npm run compile && npm run doc-gen",
86
- "start": "npm-run-all compile lint cover-test",
87
- "test-coverage": "c8 npm run test",
88
- "send-codacy": "c8 report --reporter=text-lcov | codacy-coverage",
89
- "doc-gen": "node doc-gen/gen.js"
90
- },
91
- "dependencies": {
92
- "@tokenizer/token": "^0.3.0",
93
- "content-type": "^1.0.4",
94
- "debug": "^4.3.4",
95
- "file-type": "^18.0.0",
96
- "media-typer": "^1.1.0",
97
- "strtok3": "^7.0.0",
98
- "token-types": "^5.0.1"
99
- },
100
- "devDependencies": {
101
- "@types/chai": "^4.3.4",
102
- "@types/chai-as-promised": "^7.1.5",
103
- "@types/debug": "^4.1.7",
104
- "@types/file-type": "^10.9.1",
105
- "@types/mocha": "^10.0.0",
106
- "@types/node": "^18.11.18",
107
- "@typescript-eslint/eslint-plugin": "^5.48.0",
108
- "@typescript-eslint/parser": "^5.48.0",
109
- "c8": "^7.12.0",
110
- "chai": "^4.3.7",
111
- "chai-as-promised": "^7.1.1",
112
- "del-cli": "5.0.0",
113
- "eslint": "^8.31.0",
114
- "eslint-config-prettier": "^8.6.0",
115
- "eslint-import-resolver-typescript": "^3.5.2",
116
- "eslint-plugin-import": "^2.26.0",
117
- "eslint-plugin-jsdoc": "^39.6.4",
118
- "eslint-plugin-node": "^11.1.0",
119
- "eslint-plugin-unicorn": "^45.0.2",
120
- "mime": "^3.0.0",
121
- "mocha": "^10.1.0",
122
- "npm-run-all": "^4.1.5",
123
- "prettier": "^2.8.2",
124
- "remark-cli": "^11.0.0",
125
- "remark-preset-lint-recommended": "^6.1.2",
126
- "ts-node": "^10.9.1",
127
- "typescript": "^4.9.4"
128
- },
129
- "engines": {
130
- "node": "^14.13.1 || >=16.0.0"
131
- },
132
- "repository": {
133
- "type": "git",
134
- "url": "git+https://github.com/borewit/music-metadata.git"
135
- },
136
- "license": "MIT",
137
- "bugs": {
138
- "url": "https://github.com/Borewit/music-metadata/issues"
139
- }
140
- }
1
+ {
2
+ "name": "music-metadata",
3
+ "description": "Music metadata parser for Node.js, supporting virtual any audio and tag format.",
4
+ "version": "8.1.4",
5
+ "author": {
6
+ "name": "Borewit",
7
+ "url": "https://github.com/Borewit"
8
+ },
9
+ "funding": {
10
+ "type": "github",
11
+ "url": "https://github.com/sponsors/Borewit"
12
+ },
13
+ "type": "module",
14
+ "exports": {
15
+ ".": {
16
+ "node": "./lib/index.js",
17
+ "default": "./lib/core.js"
18
+ }
19
+ },
20
+ "types": "lib/index.d.ts",
21
+ "files": [
22
+ "lib/**/*.js",
23
+ "lib/**/*.d.ts"
24
+ ],
25
+ "keywords": [
26
+ "music",
27
+ "metadata",
28
+ "meta",
29
+ "audio",
30
+ "tag",
31
+ "tags",
32
+ "duration",
33
+ "MusicBrainz",
34
+ "Discogs",
35
+ "Picard",
36
+ "ID3",
37
+ "ID3v1",
38
+ "ID3v2",
39
+ "m4a",
40
+ "m4b",
41
+ "mp3",
42
+ "mp4",
43
+ "Vorbis",
44
+ "ogg",
45
+ "flac",
46
+ "Matroska",
47
+ "WebM",
48
+ "EBML",
49
+ "asf",
50
+ "wma",
51
+ "wmv",
52
+ "ape",
53
+ "MonkeyAudio",
54
+ "aiff",
55
+ "wav",
56
+ "WavPack",
57
+ "Opus",
58
+ "speex",
59
+ "musepack",
60
+ "mpc",
61
+ "dsd",
62
+ "dsf",
63
+ "mpc",
64
+ "dff",
65
+ "dsdiff",
66
+ "aac",
67
+ "adts",
68
+ "length",
69
+ "chapter",
70
+ "info",
71
+ "parse",
72
+ "parser",
73
+ "bwf"
74
+ ],
75
+ "scripts": {
76
+ "clean": "del-cli lib/**/*.js lib/**/*.js.map lib/**/*.d.ts src/**/*.d.ts test/**/*.js test/**/*.js.map test/**/*.js test/**/*.js.map doc-gen/**/*.js doc-gen/**/*.js.map",
77
+ "compile-src": "tsc -p lib",
78
+ "compile-test": "tsc -p test",
79
+ "compile-doc": "tsc -p doc-gen",
80
+ "compile": "npm run compile-src && npm run compile-test && npm run compile-doc",
81
+ "eslint": "eslint lib/**/*.ts --ignore-pattern lib/**/*.d.ts example/typescript/**/*.ts test/**/*.ts doc-gen/**/*.ts",
82
+ "lint-md": "remark -u preset-lint-recommended .",
83
+ "lint": "npm run lint-md && npm run eslint",
84
+ "test": "mocha",
85
+ "build": "npm run clean && npm run compile && npm run doc-gen",
86
+ "start": "npm-run-all compile lint cover-test",
87
+ "test-coverage": "c8 npm run test",
88
+ "send-codacy": "c8 report --reporter=text-lcov | codacy-coverage",
89
+ "doc-gen": "node doc-gen/gen.js"
90
+ },
91
+ "dependencies": {
92
+ "@tokenizer/token": "^0.3.0",
93
+ "content-type": "^1.0.5",
94
+ "debug": "^4.3.4",
95
+ "file-type": "^18.2.1",
96
+ "media-typer": "^1.1.0",
97
+ "strtok3": "^7.0.0",
98
+ "token-types": "^5.0.1"
99
+ },
100
+ "devDependencies": {
101
+ "@types/chai": "^4.3.4",
102
+ "@types/chai-as-promised": "^7.1.5",
103
+ "@types/debug": "^4.1.7",
104
+ "@types/file-type": "^10.9.1",
105
+ "@types/mocha": "^10.0.1",
106
+ "@types/node": "^18.15.11",
107
+ "@typescript-eslint/eslint-plugin": "^5.57.0",
108
+ "@typescript-eslint/parser": "^5.57.0",
109
+ "c8": "^7.13.0",
110
+ "chai": "^4.3.7",
111
+ "chai-as-promised": "^7.1.1",
112
+ "del-cli": "5.0.0",
113
+ "eslint": "^8.37.0",
114
+ "eslint-config-prettier": "^8.8.0",
115
+ "eslint-import-resolver-typescript": "^3.5.3",
116
+ "eslint-plugin-import": "^2.27.5",
117
+ "eslint-plugin-jsdoc": "^40.1.0",
118
+ "eslint-plugin-node": "^11.1.0",
119
+ "eslint-plugin-unicorn": "^46.0.0",
120
+ "mime": "^3.0.0",
121
+ "mocha": "^10.2.0",
122
+ "npm-run-all": "^4.1.5",
123
+ "prettier": "^2.8.7",
124
+ "remark-cli": "^11.0.0",
125
+ "remark-preset-lint-recommended": "^6.1.2",
126
+ "ts-node": "^10.9.1",
127
+ "typescript": "^5.0.2"
128
+ },
129
+ "engines": {
130
+ "node": "^14.13.1 || >=16.0.0"
131
+ },
132
+ "repository": {
133
+ "type": "git",
134
+ "url": "git+https://github.com/borewit/music-metadata.git"
135
+ },
136
+ "license": "MIT",
137
+ "bugs": {
138
+ "url": "https://github.com/Borewit/music-metadata/issues"
139
+ }
140
+ }