music-metadata 11.1.1 → 11.2.0

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.
@@ -462,6 +462,9 @@ export class MP4Parser extends BasicParser {
462
462
  }
463
463
  const chapters = [];
464
464
  for (let i = 0; i < chapterTrack.chunkOffsetTable.length && len > 0; ++i) {
465
+ const start = chapterTrack.timeToSampleTable
466
+ .slice(0, i)
467
+ .reduce((acc, cur) => acc + cur.duration, 0);
465
468
  const chunkOffset = chapterTrack.chunkOffsetTable[i];
466
469
  const nextChunkLen = chunkOffset - this.tokenizer.position;
467
470
  const sampleSize = chapterTrack.sampleSize > 0 ? chapterTrack.sampleSize : chapterTrack.sampleSizeTable[i];
@@ -473,6 +476,8 @@ export class MP4Parser extends BasicParser {
473
476
  debug(`Chapter ${i + 1}: ${title}`);
474
477
  const chapter = {
475
478
  title,
479
+ timeScale: chapterTrack.timeScale,
480
+ start,
476
481
  sampleOffset: this.findSampleOffset(track, this.tokenizer.position)
477
482
  };
478
483
  debug(`Chapter title=${chapter.title}, offset=${chapter.sampleOffset}/${this.tracks[0].duration}`);
package/lib/type.d.ts CHANGED
@@ -485,6 +485,15 @@ export interface IChapter {
485
485
  * Duration offset is sampleOffset / format.sampleRate
486
486
  */
487
487
  sampleOffset: number;
488
+ /**
489
+ * Timestamp where the chapter starts
490
+ * Chapter timestamp is start/timeScale in seconds.
491
+ */
492
+ start: number;
493
+ /**
494
+ * Time value that indicates the time scale for chapter tracks, the number of time units that pass per second in its time coordinate system.
495
+ */
496
+ timeScale: number;
488
497
  }
489
498
  /**
490
499
  * Flat list of tags
package/package.json CHANGED
@@ -1,149 +1,149 @@
1
- {
2
- "name": "music-metadata",
3
- "description": "Music metadata parser for Node.js, supporting virtual any audio and tag format.",
4
- "version": "11.1.1",
5
- "author": {
6
- "name": "Borewit",
7
- "url": "https://github.com/Borewit"
8
- },
9
- "funding": [
10
- {
11
- "type": "github",
12
- "url": "https://github.com/sponsors/Borewit"
13
- },
14
- {
15
- "type": "buymeacoffee",
16
- "url": "https://buymeacoffee.com/borewit"
17
- }
18
- ],
19
- "sideEffects": false,
20
- "type": "module",
21
- "exports": {
22
- "node": {
23
- "import": "./lib/index.js",
24
- "module-sync": "./lib/index.js",
25
- "types": "./lib/index.d.ts"
26
- },
27
- "default": {
28
- "import": "./lib/core.js",
29
- "module-sync": "./lib/core.js",
30
- "types": "./lib/core.d.ts"
31
- }
32
- },
33
- "types": "lib/index.d.ts",
34
- "files": [
35
- "lib/**/*.js",
36
- "lib/**/*.d.ts"
37
- ],
38
- "keywords": [
39
- "music",
40
- "metadata",
41
- "meta",
42
- "audio",
43
- "tag",
44
- "tags",
45
- "duration",
46
- "MusicBrainz",
47
- "Discogs",
48
- "Picard",
49
- "ID3",
50
- "ID3v1",
51
- "ID3v2",
52
- "m4a",
53
- "m4b",
54
- "mp3",
55
- "mp4",
56
- "Vorbis",
57
- "ogg",
58
- "flac",
59
- "Matroska",
60
- "WebM",
61
- "EBML",
62
- "asf",
63
- "wma",
64
- "wmv",
65
- "ape",
66
- "MonkeyAudio",
67
- "aiff",
68
- "wav",
69
- "WavPack",
70
- "Opus",
71
- "speex",
72
- "musepack",
73
- "mpc",
74
- "dsd",
75
- "dsf",
76
- "mpc",
77
- "dff",
78
- "dsdiff",
79
- "aac",
80
- "adts",
81
- "length",
82
- "chapter",
83
- "info",
84
- "parse",
85
- "parser",
86
- "bwf",
87
- "slt",
88
- "lyrics"
89
- ],
90
- "scripts": {
91
- "clean": "del-cli 'lib/**/*.js' 'lib/**/*.js.map' 'lib/**/*.d.ts' 'test/**/*.js' 'test/**/*.js.map' 'test/**/*.js' 'test/**/*.js.map' 'doc-gen/**/*.js' 'doc-gen/**/*.js.map'",
92
- "compile-src": "tsc -p lib",
93
- "compile-test": "tsc -p test",
94
- "compile-doc": "tsc -p doc-gen",
95
- "compile": "yarn run compile-src && yarn compile-test && yarn compile-doc",
96
- "lint-ts": "biome check",
97
- "lint-md": "yarn run remark -u remark-preset-lint-consistent .",
98
- "lint": "yarn run lint-ts && yarn run lint-md",
99
- "test": "mocha",
100
- "build": "yarn run clean && yarn compile && yarn run doc-gen",
101
- "test-coverage": "c8 yarn run test",
102
- "send-codacy": "c8 report --reporter=text-lcov | codacy-coverage",
103
- "doc-gen": "yarn node doc-gen/gen.js",
104
- "typecheck": "tsc --project ./lib/tsconfig.json --noEmit && tsc --project ./test/tsconfig.json --noEmit"
105
- },
106
- "dependencies": {
107
- "@tokenizer/token": "^0.3.0",
108
- "content-type": "^1.0.5",
109
- "debug": "^4.4.0",
110
- "file-type": "^19.6.0",
111
- "link": "^2.1.1",
112
- "media-typer": "^1.1.0",
113
- "strtok3": "^10.2.2",
114
- "token-types": "^6.0.0",
115
- "uint8array-extras": "^1.4.0"
116
- },
117
- "devDependencies": {
118
- "@biomejs/biome": "1.9.4",
119
- "@types/chai": "^5.2.1",
120
- "@types/chai-as-promised": "^8.0.2",
121
- "@types/content-type": "^1.1.8",
122
- "@types/debug": "^4.1.12",
123
- "@types/media-typer": "^1.1.3",
124
- "@types/mocha": "^10.0.10",
125
- "@types/node": "^22.14.0",
126
- "c8": "^10.1.3",
127
- "chai": "^5.2.0",
128
- "chai-as-promised": "^8.0.1",
129
- "del-cli": "^6.0.0",
130
- "mime": "^4.0.7",
131
- "mocha": "^11.1.0",
132
- "node-readable-to-web-readable-stream": "^0.4.2",
133
- "remark-cli": "^12.0.1",
134
- "remark-preset-lint-consistent": "^6.0.1",
135
- "ts-node": "^10.9.2",
136
- "typescript": "^5.8.2"
137
- },
138
- "engines": {
139
- "node": ">=18"
140
- },
141
- "repository": {
142
- "type": "github:Borewit/music-metadata"
143
- },
144
- "license": "MIT",
145
- "bugs": {
146
- "url": "https://github.com/Borewit/music-metadata/issues"
147
- },
148
- "packageManager": "yarn@4.8.1"
149
- }
1
+ {
2
+ "name": "music-metadata",
3
+ "description": "Music metadata parser for Node.js, supporting virtual any audio and tag format.",
4
+ "version": "11.2.0",
5
+ "author": {
6
+ "name": "Borewit",
7
+ "url": "https://github.com/Borewit"
8
+ },
9
+ "funding": [
10
+ {
11
+ "type": "github",
12
+ "url": "https://github.com/sponsors/Borewit"
13
+ },
14
+ {
15
+ "type": "buymeacoffee",
16
+ "url": "https://buymeacoffee.com/borewit"
17
+ }
18
+ ],
19
+ "sideEffects": false,
20
+ "type": "module",
21
+ "exports": {
22
+ "node": {
23
+ "import": "./lib/index.js",
24
+ "module-sync": "./lib/index.js",
25
+ "types": "./lib/index.d.ts"
26
+ },
27
+ "default": {
28
+ "import": "./lib/core.js",
29
+ "module-sync": "./lib/core.js",
30
+ "types": "./lib/core.d.ts"
31
+ }
32
+ },
33
+ "types": "lib/index.d.ts",
34
+ "files": [
35
+ "lib/**/*.js",
36
+ "lib/**/*.d.ts"
37
+ ],
38
+ "keywords": [
39
+ "music",
40
+ "metadata",
41
+ "meta",
42
+ "audio",
43
+ "tag",
44
+ "tags",
45
+ "duration",
46
+ "MusicBrainz",
47
+ "Discogs",
48
+ "Picard",
49
+ "ID3",
50
+ "ID3v1",
51
+ "ID3v2",
52
+ "m4a",
53
+ "m4b",
54
+ "mp3",
55
+ "mp4",
56
+ "Vorbis",
57
+ "ogg",
58
+ "flac",
59
+ "Matroska",
60
+ "WebM",
61
+ "EBML",
62
+ "asf",
63
+ "wma",
64
+ "wmv",
65
+ "ape",
66
+ "MonkeyAudio",
67
+ "aiff",
68
+ "wav",
69
+ "WavPack",
70
+ "Opus",
71
+ "speex",
72
+ "musepack",
73
+ "mpc",
74
+ "dsd",
75
+ "dsf",
76
+ "mpc",
77
+ "dff",
78
+ "dsdiff",
79
+ "aac",
80
+ "adts",
81
+ "length",
82
+ "chapter",
83
+ "info",
84
+ "parse",
85
+ "parser",
86
+ "bwf",
87
+ "slt",
88
+ "lyrics"
89
+ ],
90
+ "scripts": {
91
+ "clean": "del-cli 'lib/**/*.js' 'lib/**/*.js.map' 'lib/**/*.d.ts' 'test/**/*.js' 'test/**/*.js.map' 'test/**/*.js' 'test/**/*.js.map' 'doc-gen/**/*.js' 'doc-gen/**/*.js.map'",
92
+ "compile-src": "tsc -p lib",
93
+ "compile-test": "tsc -p test",
94
+ "compile-doc": "tsc -p doc-gen",
95
+ "compile": "yarn run compile-src && yarn compile-test && yarn compile-doc",
96
+ "lint-ts": "biome check",
97
+ "lint-md": "yarn run remark -u remark-preset-lint-consistent .",
98
+ "lint": "yarn run lint-ts && yarn run lint-md",
99
+ "test": "mocha",
100
+ "build": "yarn run clean && yarn compile && yarn run doc-gen",
101
+ "test-coverage": "c8 yarn run test",
102
+ "send-codacy": "c8 report --reporter=text-lcov | codacy-coverage",
103
+ "doc-gen": "yarn node doc-gen/gen.js",
104
+ "typecheck": "tsc --project ./lib/tsconfig.json --noEmit && tsc --project ./test/tsconfig.json --noEmit"
105
+ },
106
+ "dependencies": {
107
+ "@tokenizer/token": "^0.3.0",
108
+ "content-type": "^1.0.5",
109
+ "debug": "^4.4.0",
110
+ "file-type": "^20.4.1",
111
+ "link": "^2.1.1",
112
+ "media-typer": "^1.1.0",
113
+ "strtok3": "^10.2.2",
114
+ "token-types": "^6.0.0",
115
+ "uint8array-extras": "^1.4.0"
116
+ },
117
+ "devDependencies": {
118
+ "@biomejs/biome": "1.9.4",
119
+ "@types/chai": "^5.2.1",
120
+ "@types/chai-as-promised": "^8.0.2",
121
+ "@types/content-type": "^1.1.8",
122
+ "@types/debug": "^4.1.12",
123
+ "@types/media-typer": "^1.1.3",
124
+ "@types/mocha": "^10.0.10",
125
+ "@types/node": "^22.14.1",
126
+ "c8": "^10.1.3",
127
+ "chai": "^5.2.0",
128
+ "chai-as-promised": "^8.0.1",
129
+ "del-cli": "^6.0.0",
130
+ "mime": "^4.0.7",
131
+ "mocha": "^11.1.0",
132
+ "node-readable-to-web-readable-stream": "^0.4.2",
133
+ "remark-cli": "^12.0.1",
134
+ "remark-preset-lint-consistent": "^6.0.1",
135
+ "ts-node": "^10.9.2",
136
+ "typescript": "^5.8.3"
137
+ },
138
+ "engines": {
139
+ "node": ">=18"
140
+ },
141
+ "repository": {
142
+ "type": "github:Borewit/music-metadata"
143
+ },
144
+ "license": "MIT",
145
+ "bugs": {
146
+ "url": "https://github.com/Borewit/music-metadata/issues"
147
+ },
148
+ "packageManager": "yarn@4.8.1"
149
+ }