music-metadata 11.2.2 → 11.3.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.
package/README.md CHANGED
@@ -751,7 +751,6 @@ graph TD;
751
751
  MMP-->UAE
752
752
  FTN("file-type (Node.js entry point)")-->FTP
753
753
  FTP("file-type (primary entry point)")-->S
754
- S(strtok3)-->P(peek-readable)
755
754
  S(strtok3)-->TO("@tokenizer/token")
756
755
  TY(token-types)-->TO
757
756
  TY-->IE("ieee754")
@@ -771,7 +770,6 @@ Dependency list:
771
770
  - [token-types](https://github.com/Borewit/token-types)
772
771
  - [file-type](https://github.com/sindresorhus/file-type)
773
772
  - [@tokenizer-token](https://github.com/Borewit/tokenizer-token)
774
- - [peek-readable](https://github.com/Borewit/peek-readable)
775
773
 
776
774
  ## CommonJS backward compatibility
777
775
 
@@ -71,7 +71,7 @@ export class ParserFactory {
71
71
  // Parser could not be determined on MIME-type or extension
72
72
  debug('Guess parser on content...');
73
73
  await tokenizer.peekBuffer(buf, { mayBeLess: true });
74
- const guessedType = await fileTypeFromBuffer(buf);
74
+ const guessedType = await fileTypeFromBuffer(buf, { mpegOffsetTolerance: 10 });
75
75
  if (!guessedType || !guessedType.mime) {
76
76
  throw new CouldNotDetermineFileTypeError('Failed to determine audio format');
77
77
  }
@@ -7,16 +7,25 @@ import { LyricsContentType, TimestampFormat } from '../type.js';
7
7
  export function parseLrc(lrcString) {
8
8
  const lines = lrcString.split('\n');
9
9
  const syncText = [];
10
- // Regular expression to match LRC timestamps (e.g., [00:45.52])
11
- const timestampRegex = /\[(\d{2}):(\d{2})\.(\d{2})\]/;
10
+ // Regular expression to match LRC timestamps (e.g., [00:45.52] or [00:45.520])
11
+ const timestampRegex = /\[(\d{2}):(\d{2})\.(\d{2,3})\]/;
12
12
  for (const line of lines) {
13
13
  const match = line.match(timestampRegex);
14
14
  if (match) {
15
15
  const minutes = Number.parseInt(match[1], 10);
16
16
  const seconds = Number.parseInt(match[2], 10);
17
- const hundredths = Number.parseInt(match[3], 10);
17
+ const millisecondsStr = match[3];
18
+ let milliseconds;
19
+ if (millisecondsStr.length === 3) {
20
+ // (e.g., .521 = 521 millseconds)
21
+ milliseconds = Number.parseInt(millisecondsStr, 10);
22
+ }
23
+ else {
24
+ // (e.g., .52 = 520 millseconds)
25
+ milliseconds = Number.parseInt(millisecondsStr, 10) * 10;
26
+ }
18
27
  // Convert the timestamp to milliseconds, as per TimestampFormat.milliseconds
19
- const timestamp = (minutes * 60 + seconds) * 1000 + hundredths * 10;
28
+ const timestamp = (minutes * 60 + seconds) * 1000 + milliseconds;
20
29
  // Get the text portion of the line (e.g., "あの蝶は自由になれたかな")
21
30
  const text = line.replace(timestampRegex, '').trim();
22
31
  syncText.push({ timestamp, text });
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": "11.2.2",
4
+ "version": "11.3.0",
5
5
  "author": {
6
6
  "name": "Borewit",
7
7
  "url": "https://github.com/Borewit"
@@ -107,9 +107,9 @@
107
107
  "@tokenizer/token": "^0.3.0",
108
108
  "content-type": "^1.0.5",
109
109
  "debug": "^4.4.1",
110
- "file-type": "^20.5.0",
110
+ "file-type": "^21.0.0",
111
111
  "media-typer": "^1.1.0",
112
- "strtok3": "^10.2.2",
112
+ "strtok3": "^10.3.1",
113
113
  "token-types": "^6.0.0",
114
114
  "uint8array-extras": "^1.4.0"
115
115
  },
@@ -117,17 +117,17 @@
117
117
  "@biomejs/biome": "1.9.4",
118
118
  "@types/chai": "^5.2.2",
119
119
  "@types/chai-as-promised": "^8.0.2",
120
- "@types/content-type": "^1.1.8",
120
+ "@types/content-type": "^1.1.9",
121
121
  "@types/debug": "^4.1.12",
122
122
  "@types/media-typer": "^1.1.3",
123
123
  "@types/mocha": "^10.0.10",
124
- "@types/node": "^22.15.12",
124
+ "@types/node": "^24.0.1",
125
125
  "c8": "^10.1.3",
126
126
  "chai": "^5.2.0",
127
127
  "chai-as-promised": "^8.0.1",
128
128
  "del-cli": "^6.0.0",
129
129
  "mime": "^4.0.7",
130
- "mocha": "^11.2.2",
130
+ "mocha": "^11.6.0",
131
131
  "node-readable-to-web-readable-stream": "^0.4.2",
132
132
  "remark-cli": "^12.0.1",
133
133
  "remark-preset-lint-consistent": "^6.0.1",
@@ -137,9 +137,7 @@
137
137
  "engines": {
138
138
  "node": ">=18"
139
139
  },
140
- "repository": {
141
- "type": "github:Borewit/music-metadata"
142
- },
140
+ "repository": "github:Borewit/music-metadata",
143
141
  "license": "MIT",
144
142
  "bugs": {
145
143
  "url": "https://github.com/Borewit/music-metadata/issues"