@openclaw/whatsapp 2026.9.34 → 2026.9.36

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.
Files changed (105) hide show
  1. package/dist/.source-module-urls/c3803b0fa58e9b1fe1f7418a46193ebc53b9c744f6359f04d40d05af48c1dce2.json +1 -0
  2. package/node_modules/baileys/node_modules/music-metadata/README.md +35 -32
  3. package/node_modules/baileys/node_modules/music-metadata/lib/ParserFactory.d.ts +1 -1
  4. package/node_modules/baileys/node_modules/music-metadata/lib/ParserFactory.js +17 -13
  5. package/node_modules/baileys/node_modules/music-metadata/lib/aiff/AiffParser.js +19 -12
  6. package/node_modules/baileys/node_modules/music-metadata/lib/aiff/AiffToken.d.ts +1 -1
  7. package/node_modules/baileys/node_modules/music-metadata/lib/aiff/AiffToken.js +2 -1
  8. package/node_modules/baileys/node_modules/music-metadata/lib/apev2/APEv2Parser.d.ts +4 -3
  9. package/node_modules/baileys/node_modules/music-metadata/lib/apev2/APEv2Parser.js +59 -16
  10. package/node_modules/baileys/node_modules/music-metadata/lib/apev2/APEv2TagMapper.js +1 -0
  11. package/node_modules/baileys/node_modules/music-metadata/lib/apev2/APEv2Token.d.ts +1 -1
  12. package/node_modules/baileys/node_modules/music-metadata/lib/apev2/APEv2Token.js +1 -1
  13. package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfGuid.js +56 -50
  14. package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfObject.d.ts +1 -1
  15. package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfObject.js +3 -2
  16. package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfParser.js +15 -7
  17. package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfTagMapper.d.ts +3 -2
  18. package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfTagMapper.js +21 -4
  19. package/node_modules/baileys/node_modules/music-metadata/lib/common/CaseInsensitiveTagMap.d.ts +1 -1
  20. package/node_modules/baileys/node_modules/music-metadata/lib/common/CombinedTagMapper.d.ts +2 -2
  21. package/node_modules/baileys/node_modules/music-metadata/lib/common/CombinedTagMapper.js +6 -6
  22. package/node_modules/baileys/node_modules/music-metadata/lib/common/FourCC.js +3 -2
  23. package/node_modules/baileys/node_modules/music-metadata/lib/common/GenericTagMapper.d.ts +1 -1
  24. package/node_modules/baileys/node_modules/music-metadata/lib/common/GenericTagTypes.js +1 -1
  25. package/node_modules/baileys/node_modules/music-metadata/lib/common/MetadataCollector.d.ts +3 -1
  26. package/node_modules/baileys/node_modules/music-metadata/lib/common/MetadataCollector.js +28 -9
  27. package/node_modules/baileys/node_modules/music-metadata/lib/common/Util.js +25 -17
  28. package/node_modules/baileys/node_modules/music-metadata/lib/core.d.ts +4 -4
  29. package/node_modules/baileys/node_modules/music-metadata/lib/core.js +18 -11
  30. package/node_modules/baileys/node_modules/music-metadata/lib/dsdiff/DsdiffParser.js +29 -16
  31. package/node_modules/baileys/node_modules/music-metadata/lib/dsf/DsfChunk.d.ts +1 -1
  32. package/node_modules/baileys/node_modules/music-metadata/lib/dsf/DsfParser.js +3 -5
  33. package/node_modules/baileys/node_modules/music-metadata/lib/ebml/EbmlIterator.d.ts +1 -1
  34. package/node_modules/baileys/node_modules/music-metadata/lib/ebml/EbmlIterator.js +35 -6
  35. package/node_modules/baileys/node_modules/music-metadata/lib/ebml/types.d.ts +1 -1
  36. package/node_modules/baileys/node_modules/music-metadata/lib/ebml/types.js +1 -1
  37. package/node_modules/baileys/node_modules/music-metadata/lib/flac/FlacParser.d.ts +1 -1
  38. package/node_modules/baileys/node_modules/music-metadata/lib/flac/FlacParser.js +6 -5
  39. package/node_modules/baileys/node_modules/music-metadata/lib/flac/FlacToken.d.ts +1 -1
  40. package/node_modules/baileys/node_modules/music-metadata/lib/flac/FlacToken.js +1 -1
  41. package/node_modules/baileys/node_modules/music-metadata/lib/id3v1/ID3v1Parser.d.ts +1 -1
  42. package/node_modules/baileys/node_modules/music-metadata/lib/id3v1/ID3v1Parser.js +212 -42
  43. package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/AbstractID3Parser.js +5 -5
  44. package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/FrameHeader.d.ts +1 -1
  45. package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/FrameHeader.js +8 -5
  46. package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/FrameParser.d.ts +2 -1
  47. package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/FrameParser.js +53 -22
  48. package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/ID3v22TagMapper.d.ts +1 -1
  49. package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/ID3v22TagMapper.js +1 -1
  50. package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/ID3v24TagMapper.js +3 -3
  51. package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/ID3v2ChapterToken.js +2 -2
  52. package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/ID3v2Parser.d.ts +1 -1
  53. package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/ID3v2Parser.js +32 -16
  54. package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/ID3v2Token.d.ts +2 -2
  55. package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/ID3v2Token.js +2 -3
  56. package/node_modules/baileys/node_modules/music-metadata/lib/index.js +6 -3
  57. package/node_modules/baileys/node_modules/music-metadata/lib/lrc/LyricsParser.js +3 -5
  58. package/node_modules/baileys/node_modules/music-metadata/lib/matroska/MatroskaDtd.js +7 -3
  59. package/node_modules/baileys/node_modules/music-metadata/lib/matroska/MatroskaParser.js +22 -11
  60. package/node_modules/baileys/node_modules/music-metadata/lib/matroska/types.d.ts +2 -2
  61. package/node_modules/baileys/node_modules/music-metadata/lib/mp4/Atom.d.ts +4 -3
  62. package/node_modules/baileys/node_modules/music-metadata/lib/mp4/Atom.js +44 -11
  63. package/node_modules/baileys/node_modules/music-metadata/lib/mp4/AtomToken.d.ts +1 -1
  64. package/node_modules/baileys/node_modules/music-metadata/lib/mp4/AtomToken.js +30 -8
  65. package/node_modules/baileys/node_modules/music-metadata/lib/mp4/MP4Parser.d.ts +2 -0
  66. package/node_modules/baileys/node_modules/music-metadata/lib/mp4/MP4Parser.js +79 -54
  67. package/node_modules/baileys/node_modules/music-metadata/lib/mp4/MP4TagMapper.d.ts +2 -2
  68. package/node_modules/baileys/node_modules/music-metadata/lib/mpeg/MpegLoader.js +1 -1
  69. package/node_modules/baileys/node_modules/music-metadata/lib/mpeg/MpegParser.js +41 -19
  70. package/node_modules/baileys/node_modules/music-metadata/lib/mpeg/ReplayGainDataFormat.d.ts +2 -2
  71. package/node_modules/baileys/node_modules/music-metadata/lib/mpeg/ReplayGainDataFormat.js +1 -1
  72. package/node_modules/baileys/node_modules/music-metadata/lib/mpeg/XingTag.d.ts +1 -1
  73. package/node_modules/baileys/node_modules/music-metadata/lib/musepack/MusepackParser.js +2 -2
  74. package/node_modules/baileys/node_modules/music-metadata/lib/musepack/sv7/BitReader.js +1 -1
  75. package/node_modules/baileys/node_modules/music-metadata/lib/musepack/sv7/MpcSv7Parser.js +4 -3
  76. package/node_modules/baileys/node_modules/music-metadata/lib/musepack/sv7/StreamVersion7.js +3 -3
  77. package/node_modules/baileys/node_modules/music-metadata/lib/musepack/sv8/MpcSv8Parser.js +7 -5
  78. package/node_modules/baileys/node_modules/music-metadata/lib/musepack/sv8/StreamVersion8.js +2 -2
  79. package/node_modules/baileys/node_modules/music-metadata/lib/ogg/OggParser.js +16 -12
  80. package/node_modules/baileys/node_modules/music-metadata/lib/ogg/OggToken.js +1 -1
  81. package/node_modules/baileys/node_modules/music-metadata/lib/ogg/flac/FlacStream.d.ts +2 -2
  82. package/node_modules/baileys/node_modules/music-metadata/lib/ogg/flac/FlacStream.js +2 -2
  83. package/node_modules/baileys/node_modules/music-metadata/lib/ogg/opus/OpusStream.d.ts +2 -2
  84. package/node_modules/baileys/node_modules/music-metadata/lib/ogg/opus/OpusStream.js +8 -4
  85. package/node_modules/baileys/node_modules/music-metadata/lib/ogg/speex/SpeexStream.d.ts +2 -2
  86. package/node_modules/baileys/node_modules/music-metadata/lib/ogg/speex/SpeexStream.js +2 -1
  87. package/node_modules/baileys/node_modules/music-metadata/lib/ogg/theora/TheoraStream.d.ts +2 -2
  88. package/node_modules/baileys/node_modules/music-metadata/lib/ogg/vorbis/Vorbis.d.ts +1 -1
  89. package/node_modules/baileys/node_modules/music-metadata/lib/ogg/vorbis/VorbisDecoder.js +1 -1
  90. package/node_modules/baileys/node_modules/music-metadata/lib/ogg/vorbis/VorbisStream.d.ts +3 -3
  91. package/node_modules/baileys/node_modules/music-metadata/lib/ogg/vorbis/VorbisStream.js +14 -9
  92. package/node_modules/baileys/node_modules/music-metadata/lib/ogg/vorbis/VorbisTagMapper.js +4 -0
  93. package/node_modules/baileys/node_modules/music-metadata/lib/riff/RiffChunk.d.ts +3 -1
  94. package/node_modules/baileys/node_modules/music-metadata/lib/riff/RiffChunk.js +3 -2
  95. package/node_modules/baileys/node_modules/music-metadata/lib/riff/RiffInfoTagMap.d.ts +1 -1
  96. package/node_modules/baileys/node_modules/music-metadata/lib/type.d.ts +3 -3
  97. package/node_modules/baileys/node_modules/music-metadata/lib/type.js +1 -1
  98. package/node_modules/baileys/node_modules/music-metadata/lib/wav/WaveChunk.d.ts +1 -1
  99. package/node_modules/baileys/node_modules/music-metadata/lib/wav/WaveChunk.js +3 -2
  100. package/node_modules/baileys/node_modules/music-metadata/lib/wav/WaveParser.d.ts +6 -2
  101. package/node_modules/baileys/node_modules/music-metadata/lib/wav/WaveParser.js +75 -22
  102. package/node_modules/baileys/node_modules/music-metadata/lib/wavpack/WavPackParser.js +22 -13
  103. package/node_modules/baileys/node_modules/music-metadata/lib/wavpack/WavPackToken.js +3 -2
  104. package/node_modules/baileys/node_modules/music-metadata/package.json +3 -2
  105. package/package.json +4 -4
@@ -1,9 +1,9 @@
1
1
  import initDebug from 'debug';
2
- import { BasicParser } from '../../common/BasicParser.js';
3
2
  import { tryParseApeHeader } from '../../apev2/APEv2Parser.js';
3
+ import { BasicParser } from '../../common/BasicParser.js';
4
4
  import { FourCcToken } from '../../common/FourCC.js';
5
- import * as SV8 from './StreamVersion8.js';
6
5
  import { MusepackContentError } from '../MusepackConentError.js';
6
+ import * as SV8 from './StreamVersion8.js';
7
7
  const debug = initDebug('music-metadata:parser:musepack');
8
8
  export class MpcSv8Parser extends BasicParser {
9
9
  constructor() {
@@ -12,8 +12,9 @@ export class MpcSv8Parser extends BasicParser {
12
12
  }
13
13
  async parse() {
14
14
  const signature = await this.tokenizer.readToken(FourCcToken);
15
- if (signature !== 'MPCK')
15
+ if (signature !== 'MPCK') {
16
16
  throw new MusepackContentError('Invalid Magic number');
17
+ }
17
18
  this.metadata.setFormat('container', 'Musepack, SV8');
18
19
  return this.parsePacket();
19
20
  }
@@ -23,7 +24,8 @@ export class MpcSv8Parser extends BasicParser {
23
24
  const header = await sv8reader.readPacketHeader();
24
25
  debug(`packet-header key=${header.key}, payloadLength=${header.payloadLength}`);
25
26
  switch (header.key) {
26
- case 'SH': { // Stream Header
27
+ case 'SH': {
28
+ // Stream Header
27
29
  const sh = await sv8reader.readStreamHeader(header.payloadLength);
28
30
  this.metadata.setFormat('numberOfSamples', sh.sampleCount);
29
31
  this.metadata.setFormat('sampleRate', sh.sampleFrequency);
@@ -44,7 +46,7 @@ export class MpcSv8Parser extends BasicParser {
44
46
  break;
45
47
  case 'SE': // Stream End
46
48
  if (this.metadata.format.duration) {
47
- this.metadata.setFormat('bitrate', this.audioLength * 8 / this.metadata.format.duration);
49
+ this.metadata.setFormat('bitrate', (this.audioLength * 8) / this.metadata.format.duration);
48
50
  }
49
51
  return tryParseApeHeader(this.metadata, this.tokenizer, this.options);
50
52
  default:
@@ -1,5 +1,5 @@
1
- import * as Token from 'token-types';
2
1
  import initDebug from 'debug';
2
+ import * as Token from 'token-types';
3
3
  import * as util from '../../common/Util.js';
4
4
  const debug = initDebug('music-metadata:parser:musepack:sv8');
5
5
  const PacketKey = new Token.StringType(2, 'latin1');
@@ -75,7 +75,7 @@ export class StreamReader {
75
75
  if ((n & 0x80) === 0) {
76
76
  return { len, value: hb + n };
77
77
  }
78
- n &= 0x7F;
78
+ n &= 0x7f;
79
79
  n += hb;
80
80
  return this.readVariableSizeField(len + 1, n << 7);
81
81
  }
@@ -1,14 +1,14 @@
1
- import * as Token from 'token-types';
2
- import { EndOfStreamError } from 'strtok3';
3
1
  import initDebug from 'debug';
2
+ import { EndOfStreamError } from 'strtok3';
3
+ import * as Token from 'token-types';
4
4
  import { BasicParser } from '../common/BasicParser.js';
5
- import { VorbisStream } from './vorbis/VorbisStream.js';
5
+ import { makeUnexpectedFileContentError } from '../ParseError.js';
6
+ import { FlacStream } from './flac/FlacStream.js';
7
+ import { PageHeader, SegmentTable } from './OggToken.js';
6
8
  import { OpusStream } from './opus/OpusStream.js';
7
9
  import { SpeexStream } from './speex/SpeexStream.js';
8
10
  import { TheoraStream } from './theora/TheoraStream.js';
9
- import { makeUnexpectedFileContentError } from '../ParseError.js';
10
- import { PageHeader, SegmentTable } from './OggToken.js';
11
- import { FlacStream } from './flac/FlacStream.js';
11
+ import { VorbisStream } from './vorbis/VorbisStream.js';
12
12
  export class OggContentError extends makeUnexpectedFileContentError('Ogg') {
13
13
  }
14
14
  const debug = initDebug('music-metadata:parser:ogg');
@@ -66,8 +66,9 @@ class OggStream {
66
66
  if (this.pageConsumer) {
67
67
  await this.pageConsumer.parsePage(header, pageData);
68
68
  }
69
- else
69
+ else {
70
70
  throw new Error('pageConsumer should be initialized');
71
+ }
71
72
  }
72
73
  }
73
74
  /**
@@ -89,30 +90,33 @@ export class OggParser extends BasicParser {
89
90
  try {
90
91
  do {
91
92
  header = await this.tokenizer.readToken(PageHeader);
92
- if (header.capturePattern !== 'OggS')
93
+ if (header.capturePattern !== 'OggS') {
93
94
  throw new OggContentError('Invalid Ogg capture pattern');
95
+ }
94
96
  let stream = this.streams.get(header.streamSerialNumber);
95
97
  if (!stream) {
96
98
  stream = new OggStream(this.metadata, header.streamSerialNumber, this.options);
97
99
  this.streams.set(header.streamSerialNumber, stream);
98
100
  }
99
101
  await stream.parsePage(this.tokenizer, header);
100
- if (stream.pageNumber > 12 && !(this.options.duration && [...this.streams.values()].find(stream => stream.pageConsumer?.durationOnLastPage))) {
101
- debug("Stop processing Ogg stream");
102
+ if (stream.pageNumber > 12 &&
103
+ !(this.options.duration && [...this.streams.values()].find(stream => stream.pageConsumer?.durationOnLastPage))) {
104
+ debug('Stop processing Ogg stream');
102
105
  break;
103
106
  }
104
107
  } while (![...this.streams.values()].every(item => item.closed));
105
108
  }
106
109
  catch (err) {
107
110
  if (err instanceof EndOfStreamError) {
108
- debug("Reached end-of-stream");
111
+ debug('Reached end-of-stream');
109
112
  enfOfStream = true;
110
113
  }
111
114
  else if (err instanceof OggContentError) {
112
115
  this.metadata.addWarning(`Corrupt Ogg content at ${this.tokenizer.position}`);
113
116
  }
114
- else
117
+ else {
115
118
  throw err;
119
+ }
116
120
  }
117
121
  for (const stream of this.streams.values()) {
118
122
  if (!stream.closed) {
@@ -1,6 +1,6 @@
1
1
  import * as Token from 'token-types';
2
- import * as util from '../common/Util.js';
3
2
  import { StringType } from 'token-types';
3
+ import * as util from '../common/Util.js';
4
4
  export const PageHeader = {
5
5
  len: 27,
6
6
  get: (buf, off) => {
@@ -1,7 +1,7 @@
1
1
  import type { ITokenizer } from 'strtok3';
2
- import type * as Ogg from '../OggToken.js';
3
- import type { IOptions } from '../../type.js';
4
2
  import type { INativeMetadataCollector } from '../../common/MetadataCollector.js';
3
+ import type { IOptions } from '../../type.js';
4
+ import type * as Ogg from '../OggToken.js';
5
5
  /**
6
6
  * Ref:
7
7
  * - https://xiph.org/flac/ogg_mapping.html
@@ -1,7 +1,7 @@
1
1
  import initDebug from 'debug';
2
- import * as Flac from '../../flac/FlacToken.js';
3
- import { FlacParser } from '../../flac/FlacParser.js';
4
2
  import { FourCcToken } from '../../common/FourCC.js';
3
+ import { FlacParser } from '../../flac/FlacParser.js';
4
+ import * as Flac from '../../flac/FlacToken.js';
5
5
  import { VorbisPictureToken } from '../vorbis/Vorbis.js';
6
6
  const debug = initDebug('music-metadata:parser:ogg:theora');
7
7
  /**
@@ -1,8 +1,8 @@
1
1
  import type { ITokenizer } from 'strtok3';
2
+ import type { INativeMetadataCollector } from '../../common/MetadataCollector.js';
3
+ import type { IOptions } from '../../type.js';
2
4
  import type { IPageHeader } from '../OggToken.js';
3
5
  import { VorbisStream } from '../vorbis/VorbisStream.js';
4
- import type { IOptions } from '../../type.js';
5
- import type { INativeMetadataCollector } from '../../common/MetadataCollector.js';
6
6
  /**
7
7
  * Opus parser
8
8
  * Internet Engineering Task Force (IETF) - RFC 6716
@@ -24,8 +24,9 @@ export class OpusStream extends VorbisStream {
24
24
  this.metadata.setFormat('codec', 'Opus');
25
25
  // Parse Opus ID Header
26
26
  this.idHeader = new Opus.IdHeader(pageData.length).get(pageData, 0);
27
- if (this.idHeader.magicSignature !== "OpusHead")
28
- throw new OpusContentError("Illegal ogg/Opus magic-signature");
27
+ if (this.idHeader.magicSignature !== 'OpusHead') {
28
+ throw new OpusContentError('Illegal ogg/Opus magic-signature');
29
+ }
29
30
  this.metadata.setFormat('sampleRate', this.idHeader.inputSampleRate);
30
31
  this.metadata.setFormat('numberOfChannels', this.idHeader.channelCount);
31
32
  this.metadata.setAudioOnly();
@@ -42,14 +43,17 @@ export class OpusStream extends VorbisStream {
42
43
  }
43
44
  }
44
45
  calculateDuration(enfOfStream) {
45
- if (this.lastPageHeader && (enfOfStream || this.lastPageHeader.headerType.lastPage) && this.metadata.format.sampleRate && this.lastPageHeader.absoluteGranulePosition >= 0) {
46
+ if (this.lastPageHeader &&
47
+ (enfOfStream || this.lastPageHeader.headerType.lastPage) &&
48
+ this.metadata.format.sampleRate &&
49
+ this.lastPageHeader.absoluteGranulePosition >= 0) {
46
50
  // Calculate duration
47
51
  const pos_48bit = this.lastPageHeader.absoluteGranulePosition - this.idHeader.preSkip;
48
52
  this.metadata.setFormat('numberOfSamples', pos_48bit);
49
53
  this.metadata.setFormat('duration', pos_48bit / 48000);
50
54
  if (this.lastPos !== -1 && this.tokenizer.fileInfo.size && this.metadata.format.duration) {
51
55
  const dataSize = this.tokenizer.fileInfo.size - this.lastPos;
52
- this.metadata.setFormat('bitrate', 8 * dataSize / this.metadata.format.duration);
56
+ this.metadata.setFormat('bitrate', (8 * dataSize) / this.metadata.format.duration);
53
57
  }
54
58
  }
55
59
  }
@@ -1,8 +1,8 @@
1
1
  import type { ITokenizer } from 'strtok3';
2
+ import type { INativeMetadataCollector } from '../../common/MetadataCollector.js';
3
+ import type { IOptions } from '../../type.js';
2
4
  import type { IPageHeader } from '../OggToken.js';
3
5
  import { VorbisStream } from '../vorbis/VorbisStream.js';
4
- import type { IOptions } from '../../type.js';
5
- import type { INativeMetadataCollector } from '../../common/MetadataCollector.js';
6
6
  /**
7
7
  * Speex, RFC 5574
8
8
  * Ref:
@@ -35,8 +35,9 @@ export class SpeexStream extends VorbisStream {
35
35
  * Ref: https://tools.ietf.org/html/rfc5574#section-3
36
36
  */
37
37
  async parseFullPage(pageData) {
38
- if (this.commentHeaderParsed)
38
+ if (this.commentHeaderParsed) {
39
39
  return;
40
+ }
40
41
  this.commentHeaderParsed = true;
41
42
  debug('Parse Ogg/Speex comment header');
42
43
  await this.parseUserCommentList(pageData, 0);
@@ -1,7 +1,7 @@
1
1
  import type { ITokenizer } from 'strtok3';
2
- import type * as Ogg from '../OggToken.js';
3
- import type { IOptions } from '../../type.js';
4
2
  import type { INativeMetadataCollector } from '../../common/MetadataCollector.js';
3
+ import type { IOptions } from '../../type.js';
4
+ import type * as Ogg from '../OggToken.js';
5
5
  /**
6
6
  * Ref:
7
7
  * - https://theora.org/doc/Theora.pdf
@@ -1,5 +1,5 @@
1
- import type { IPicture } from '../../type.js';
2
1
  import type { IGetToken } from 'strtok3';
2
+ import type { IPicture } from '../../type.js';
3
3
  /**
4
4
  * Interface to parsed result of METADATA_BLOCK_PICTURE
5
5
  * Ref: https://wiki.xiph.org/VorbisComment#METADATA_BLOCK_PICTURE
@@ -1,5 +1,5 @@
1
- import * as Token from 'token-types';
2
1
  import { textDecode } from '@borewit/text-codec';
2
+ import * as Token from 'token-types';
3
3
  export class VorbisDecoder {
4
4
  constructor(data, offset) {
5
5
  this.data = data;
@@ -1,7 +1,7 @@
1
- import { type IVorbisPicture } from './Vorbis.js';
2
- import type { IPageConsumer, IPageHeader } from '../OggToken.js';
3
- import type { IOptions } from '../../type.js';
4
1
  import type { INativeMetadataCollector } from '../../common/MetadataCollector.js';
2
+ import type { IOptions } from '../../type.js';
3
+ import type { IPageConsumer, IPageHeader } from '../OggToken.js';
4
+ import { type IVorbisPicture } from './Vorbis.js';
5
5
  declare const VorbisContentError_base: {
6
6
  new (message: string): {
7
7
  readonly fileType: string;
@@ -1,8 +1,8 @@
1
- import * as Token from 'token-types';
2
1
  import debugInit from 'debug';
3
- import { VorbisDecoder } from './VorbisDecoder.js';
4
- import { CommonHeader, IdentificationHeader, VorbisPictureToken } from './Vorbis.js';
2
+ import * as Token from 'token-types';
5
3
  import { makeUnexpectedFileContentError } from '../../ParseError.js';
4
+ import { CommonHeader, IdentificationHeader, VorbisPictureToken } from './Vorbis.js';
5
+ import { VorbisDecoder } from './VorbisDecoder.js';
6
6
  const debug = debugInit('music-metadata:parser:ogg:vorbis1');
7
7
  export class VorbisContentError extends makeUnexpectedFileContentError('Vorbis') {
8
8
  }
@@ -64,9 +64,9 @@ export class VorbisStream {
64
64
  return tag.len;
65
65
  }
66
66
  async addTag(id, value) {
67
- if (id === 'METADATA_BLOCK_PICTURE' && (typeof value === 'string')) {
67
+ if (id === 'METADATA_BLOCK_PICTURE' && typeof value === 'string') {
68
68
  if (this.options.skipCovers) {
69
- debug("Ignore picture");
69
+ debug('Ignore picture');
70
70
  return;
71
71
  }
72
72
  value = VorbisPictureToken.fromBase64(value);
@@ -78,7 +78,10 @@ export class VorbisStream {
78
78
  await this.metadata.addTag('vorbis', id, value);
79
79
  }
80
80
  calculateDuration(enfOfStream) {
81
- if (this.lastPageHeader && (enfOfStream || this.lastPageHeader.headerType.lastPage) && this.metadata.format.sampleRate && this.lastPageHeader.absoluteGranulePosition >= 0) {
81
+ if (this.lastPageHeader &&
82
+ (enfOfStream || this.lastPageHeader.headerType.lastPage) &&
83
+ this.metadata.format.sampleRate &&
84
+ this.lastPageHeader.absoluteGranulePosition >= 0) {
82
85
  // Calculate duration
83
86
  this.metadata.setFormat('numberOfSamples', this.lastPageHeader.absoluteGranulePosition);
84
87
  this.metadata.setFormat('duration', this.lastPageHeader.absoluteGranulePosition / this.metadata.format.sampleRate);
@@ -95,8 +98,9 @@ export class VorbisStream {
95
98
  debug('Parse first page');
96
99
  // Parse Vorbis common header
97
100
  const commonHeader = CommonHeader.get(pageData, 0);
98
- if (commonHeader.vorbis !== 'vorbis')
101
+ if (commonHeader.vorbis !== 'vorbis') {
99
102
  throw new VorbisContentError('Metadata does not look like Vorbis');
103
+ }
100
104
  if (commonHeader.packetType === 1) {
101
105
  const idHeader = IdentificationHeader.get(pageData, CommonHeader.len);
102
106
  this.metadata.setFormat('sampleRate', idHeader.sampleRate);
@@ -104,8 +108,9 @@ export class VorbisStream {
104
108
  this.metadata.setFormat('numberOfChannels', idHeader.channelMode);
105
109
  debug('sample-rate=%s[hz], bitrate=%s[b/s], channel-mode=%s', idHeader.sampleRate, idHeader.bitrateNominal, idHeader.channelMode);
106
110
  }
107
- else
111
+ else {
108
112
  throw new VorbisContentError('First Ogg page should be type 1: the identification header');
113
+ }
109
114
  }
110
115
  async parseFullPage(pageData) {
111
116
  // New page
@@ -130,7 +135,7 @@ export class VorbisStream {
130
135
  let userCommentListLength = Token.UINT32_LE.get(pageData, offset);
131
136
  offset += 4;
132
137
  while (userCommentListLength-- > 0) {
133
- offset += (await this.parseUserComment(pageData, offset));
138
+ offset += await this.parseUserComment(pageData, offset);
134
139
  }
135
140
  }
136
141
  }
@@ -18,12 +18,14 @@ const vorbisTagMap = {
18
18
  ORIGINALYEAR: 'originalyear',
19
19
  RELEASEDATE: 'releasedate',
20
20
  COMMENT: 'comment',
21
+ DESCRIPTION: 'comment',
21
22
  TRACKNUMBER: 'track',
22
23
  DISCNUMBER: 'disk',
23
24
  GENRE: 'genre',
24
25
  METADATA_BLOCK_PICTURE: 'picture',
25
26
  COMPOSER: 'composer',
26
27
  LYRICS: 'lyrics',
28
+ UNSYNCEDLYRICS: 'lyrics',
27
29
  ALBUMSORT: 'albumsort',
28
30
  TITLESORT: 'titlesort',
29
31
  WORK: 'work',
@@ -41,6 +43,8 @@ const vorbisTagMap = {
41
43
  DJMIXER: 'djmixer',
42
44
  MIXER: 'mixer',
43
45
  LABEL: 'label',
46
+ ORGANIZATION: 'label',
47
+ PUBLISHER: 'label',
44
48
  GROUPING: 'grouping',
45
49
  SUBTITLE: 'subtitle',
46
50
  DISCSUBTITLE: 'discsubtitle',
@@ -1,3 +1,4 @@
1
+ import type { SupportedEncoding } from '@borewit/text-codec';
1
2
  import type { IGetToken } from 'strtok3';
2
3
  import type { IChunkHeader } from '../iff/index.js';
3
4
  export type { IChunkHeader } from '../iff/index.js';
@@ -9,8 +10,9 @@ export declare const Header: IGetToken<IChunkHeader>;
9
10
  * Token to parse RIFF-INFO tag value
10
11
  */
11
12
  export declare class ListInfoTagValue implements IGetToken<string> {
13
+ private readonly encoding;
12
14
  len: number;
13
15
  private tagHeader;
14
- constructor(tagHeader: IChunkHeader);
16
+ constructor(tagHeader: IChunkHeader, encoding?: SupportedEncoding);
15
17
  get(buf: Uint8Array, off: number): string;
16
18
  }
@@ -17,12 +17,13 @@ export const Header = {
17
17
  * Token to parse RIFF-INFO tag value
18
18
  */
19
19
  export class ListInfoTagValue {
20
- constructor(tagHeader) {
20
+ constructor(tagHeader, encoding = 'latin1') {
21
+ this.encoding = encoding;
21
22
  this.tagHeader = tagHeader;
22
23
  this.len = tagHeader.chunkSize;
23
24
  this.len += this.len & 1; // if it is an odd length, round up to even
24
25
  }
25
26
  get(buf, off) {
26
- return new Token.StringType(this.tagHeader.chunkSize, 'utf8').get(buf, off);
27
+ return new Token.StringType(this.tagHeader.chunkSize, this.encoding).get(buf, off).split('\0', 1)[0];
27
28
  }
28
29
  }
@@ -1,5 +1,5 @@
1
- import type { INativeTagMap } from '../common/GenericTagTypes.js';
2
1
  import { CommonTagMapper } from '../common/GenericTagMapper.js';
2
+ import type { INativeTagMap } from '../common/GenericTagTypes.js';
3
3
  /**
4
4
  * RIFF Info Tags; part of the EXIF 2.3
5
5
  * Ref: http://owl.phy.queensu.ca/~phil/exiftool/TagNames/RIFF.html#Info
@@ -1,9 +1,9 @@
1
- import type { TagType } from './common/GenericTagTypes.js';
2
1
  import type { IFooter } from './apev2/APEv2Token.js';
3
- import type { TrackType } from './matroska/types.js';
2
+ import type { TagType } from './common/GenericTagTypes.js';
4
3
  import type { LyricsContentType, TimestampFormat } from './id3v2/ID3v2Token.js';
5
- export { TrackType, TrackTypeValueToKeyMap } from './matroska/types.js';
4
+ import type { TrackType } from './matroska/types.js';
6
5
  export { LyricsContentType, TimestampFormat } from './id3v2/ID3v2Token.js';
6
+ export { TrackType, TrackTypeValueToKeyMap } from './matroska/types.js';
7
7
  export type AnyTagValue = unknown;
8
8
  /**
9
9
  * Attached picture, typically used for cover art
@@ -1,2 +1,2 @@
1
- export { TrackType, TrackTypeValueToKeyMap } from './matroska/types.js';
2
1
  export { LyricsContentType, TimestampFormat } from './id3v2/ID3v2Token.js';
2
+ export { TrackType, TrackTypeValueToKeyMap } from './matroska/types.js';
@@ -37,7 +37,7 @@ export declare const WaveFormat: {
37
37
  MPEG: number;
38
38
  MPEGLAYER3: number;
39
39
  };
40
- export type WaveFormat = typeof WaveFormat[keyof typeof WaveFormat];
40
+ export type WaveFormat = (typeof WaveFormat)[keyof typeof WaveFormat];
41
41
  export declare const WaveFormatNameMap: {
42
42
  [WaveFormat.PCM]: string;
43
43
  [WaveFormat.ADPCM]: string;
@@ -16,7 +16,7 @@ export const WaveFormat = {
16
16
  // MPEG-4 and AAC Audio Types
17
17
  MPEG_ADTS_AAC: 0x1600,
18
18
  MPEG_LOAS: 0x1602,
19
- RAW_AAC1: 0x00FF,
19
+ RAW_AAC1: 0x00ff,
20
20
  // Dolby Audio Types
21
21
  DOLBY_AC3_SPDIF: 0x0092,
22
22
  DVM: 0x2000,
@@ -53,8 +53,9 @@ export const WaveFormatNameMap = {
53
53
  */
54
54
  export class Format {
55
55
  constructor(header) {
56
- if (header.chunkSize < 16)
56
+ if (header.chunkSize < 16) {
57
57
  throw new WaveContentError('Invalid chunk size');
58
+ }
58
59
  this.len = header.chunkSize;
59
60
  }
60
61
  get(buf, off) {
@@ -1,5 +1,5 @@
1
- import * as riff from '../riff/RiffChunk.js';
2
1
  import { BasicParser } from '../common/BasicParser.js';
2
+ import * as riff from '../riff/RiffChunk.js';
3
3
  /**
4
4
  * Resource Interchange File Format (RIFF) Parser
5
5
  *
@@ -12,6 +12,8 @@ import { BasicParser } from '../common/BasicParser.js';
12
12
  * ToDo: Split WAVE part from RIFF parser
13
13
  */
14
14
  export declare class WaveParser extends BasicParser {
15
+ private codePage;
16
+ private readonly pendingInfoTags;
15
17
  private fact;
16
18
  private blockAlign;
17
19
  private avgBytesPerSec;
@@ -21,5 +23,7 @@ export declare class WaveParser extends BasicParser {
21
23
  readWaveChunk(remaining: number): Promise<void>;
22
24
  parseListTag(listHeader: riff.IChunkHeader): Promise<void>;
23
25
  private parseRiffInfoTags;
24
- private addTag;
26
+ private addInfoTag;
27
+ private flushInfoTags;
28
+ private getInfoEncoding;
25
29
  }