taglib-wasm 1.0.7 → 1.0.8

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 (32) hide show
  1. package/dist/index.browser.js +258 -39
  2. package/dist/index.d.ts +1 -1
  3. package/dist/simple.browser.js +238 -18
  4. package/dist/src/constants/additional-properties.d.ts +242 -0
  5. package/dist/src/constants/additional-properties.d.ts.map +1 -0
  6. package/dist/src/constants/additional-properties.js +204 -0
  7. package/dist/src/constants/general-extended-properties.d.ts +7 -3
  8. package/dist/src/constants/general-extended-properties.d.ts.map +1 -1
  9. package/dist/src/constants/general-extended-properties.js +5 -3
  10. package/dist/src/constants/properties.d.ts +239 -3
  11. package/dist/src/constants/properties.d.ts.map +1 -1
  12. package/dist/src/constants/properties.js +3 -1
  13. package/dist/src/constants/tags.d.ts +20 -21
  14. package/dist/src/constants/tags.d.ts.map +1 -1
  15. package/dist/src/constants/tags.js +20 -21
  16. package/dist/src/simple/tag-operations.d.ts.map +1 -1
  17. package/dist/src/simple/tag-operations.js +8 -4
  18. package/dist/src/simple/with-audio-file.d.ts +3 -2
  19. package/dist/src/simple/with-audio-file.d.ts.map +1 -1
  20. package/dist/src/simple/with-audio-file.js +11 -4
  21. package/dist/src/taglib/taglib-class.d.ts.map +1 -1
  22. package/dist/src/taglib/taglib-class.js +8 -7
  23. package/dist/src/types/config.d.ts +1 -1
  24. package/dist/src/types/metadata-mappings.d.ts.map +1 -1
  25. package/dist/src/types/metadata-mappings.js +20 -1
  26. package/dist/src/types/tags.d.ts +24 -0
  27. package/dist/src/types/tags.d.ts.map +1 -1
  28. package/dist/src/version.d.ts +1 -1
  29. package/dist/src/version.js +1 -1
  30. package/dist/taglib-web.wasm +0 -0
  31. package/dist/taglib-wrapper.js +1 -1
  32. package/package.json +1 -1
@@ -461,6 +461,215 @@ var init_write = __esm({
461
461
  }
462
462
  });
463
463
 
464
+ // src/constants/additional-properties.ts
465
+ var ADDITIONAL_PROPERTIES;
466
+ var init_additional_properties = __esm({
467
+ "src/constants/additional-properties.ts"() {
468
+ "use strict";
469
+ ADDITIONAL_PROPERTIES = {
470
+ albumArtistSort: {
471
+ key: "ALBUMARTISTSORT",
472
+ description: "Sort name for album artist (for alphabetization)",
473
+ type: "string",
474
+ supportedFormats: ["ID3v2", "MP4", "Vorbis"],
475
+ mappings: {
476
+ id3v2: { frame: "TSO2" },
477
+ vorbis: "ALBUMARTISTSORT",
478
+ mp4: "soaa"
479
+ }
480
+ },
481
+ composerSort: {
482
+ key: "COMPOSERSORT",
483
+ description: "Sort name for composer (for alphabetization)",
484
+ type: "string",
485
+ supportedFormats: ["ID3v2", "MP4", "Vorbis"],
486
+ mappings: {
487
+ id3v2: { frame: "TSOC" },
488
+ vorbis: "COMPOSERSORT",
489
+ mp4: "soco"
490
+ }
491
+ },
492
+ subtitle: {
493
+ key: "SUBTITLE",
494
+ description: "Subtitle or description refinement",
495
+ type: "string",
496
+ supportedFormats: ["ID3v2", "MP4", "Vorbis"],
497
+ mappings: {
498
+ id3v2: { frame: "TIT3" },
499
+ vorbis: "SUBTITLE",
500
+ mp4: "----:com.apple.iTunes:SUBTITLE"
501
+ }
502
+ },
503
+ label: {
504
+ key: "LABEL",
505
+ description: "Record label name",
506
+ type: "string",
507
+ supportedFormats: ["ID3v2", "MP4", "Vorbis", "WAV"],
508
+ mappings: {
509
+ id3v2: { frame: "TPUB" },
510
+ vorbis: "LABEL",
511
+ mp4: "----:com.apple.iTunes:LABEL",
512
+ wav: "IPUB"
513
+ }
514
+ },
515
+ producer: {
516
+ key: "PRODUCER",
517
+ description: "Producer of the recording",
518
+ type: "string",
519
+ supportedFormats: ["ID3v2", "MP4", "Vorbis"],
520
+ mappings: {
521
+ id3v2: { frame: "TXXX", description: "PRODUCER" },
522
+ vorbis: "PRODUCER",
523
+ mp4: "----:com.apple.iTunes:PRODUCER"
524
+ }
525
+ },
526
+ radioStationOwner: {
527
+ key: "RADIOSTATIONOWNER",
528
+ description: "Owner of the radio station",
529
+ type: "string",
530
+ supportedFormats: ["ID3v2"],
531
+ mappings: {
532
+ id3v2: { frame: "TRSO" }
533
+ }
534
+ },
535
+ asin: {
536
+ key: "ASIN",
537
+ description: "Amazon Standard Identification Number",
538
+ type: "string",
539
+ supportedFormats: ["ID3v2", "MP4", "Vorbis"],
540
+ mappings: {
541
+ id3v2: { frame: "TXXX", description: "ASIN" },
542
+ vorbis: "ASIN",
543
+ mp4: "----:com.apple.iTunes:ASIN"
544
+ }
545
+ },
546
+ musicbrainzReleaseArtistId: {
547
+ key: "MUSICBRAINZ_ALBUMARTISTID",
548
+ description: "MusicBrainz Release Artist ID (UUID)",
549
+ type: "string",
550
+ supportedFormats: ["ID3v2", "MP4", "Vorbis"],
551
+ mappings: {
552
+ id3v2: {
553
+ frame: "TXXX",
554
+ description: "MusicBrainz Album Artist Id"
555
+ },
556
+ vorbis: "MUSICBRAINZ_ALBUMARTISTID",
557
+ mp4: "----:com.apple.iTunes:MusicBrainz Album Artist Id"
558
+ }
559
+ },
560
+ musicbrainzWorkId: {
561
+ key: "MUSICBRAINZ_WORKID",
562
+ description: "MusicBrainz Work ID (UUID)",
563
+ type: "string",
564
+ supportedFormats: ["ID3v2", "MP4", "Vorbis"],
565
+ mappings: {
566
+ id3v2: { frame: "TXXX", description: "MusicBrainz Work Id" },
567
+ vorbis: "MUSICBRAINZ_WORKID",
568
+ mp4: "----:com.apple.iTunes:MusicBrainz Work Id"
569
+ }
570
+ },
571
+ musicbrainzReleaseTrackId: {
572
+ key: "MUSICBRAINZ_RELEASETRACKID",
573
+ description: "MusicBrainz Release Track ID (UUID)",
574
+ type: "string",
575
+ supportedFormats: ["ID3v2", "MP4", "Vorbis"],
576
+ mappings: {
577
+ id3v2: {
578
+ frame: "TXXX",
579
+ description: "MusicBrainz Release Track Id"
580
+ },
581
+ vorbis: "MUSICBRAINZ_RELEASETRACKID",
582
+ mp4: "----:com.apple.iTunes:MusicBrainz Release Track Id"
583
+ }
584
+ },
585
+ podcastId: {
586
+ key: "PODCASTID",
587
+ description: "Podcast episode identifier",
588
+ type: "string",
589
+ supportedFormats: ["ID3v2", "MP4", "Vorbis"],
590
+ mappings: {
591
+ id3v2: { frame: "TGID" },
592
+ vorbis: "PODCASTID",
593
+ mp4: "egid"
594
+ }
595
+ },
596
+ podcastUrl: {
597
+ key: "PODCASTURL",
598
+ description: "Podcast feed URL",
599
+ type: "string",
600
+ supportedFormats: ["ID3v2", "MP4", "Vorbis"],
601
+ mappings: {
602
+ id3v2: { frame: "WFED" },
603
+ vorbis: "PODCASTURL",
604
+ mp4: "purl"
605
+ }
606
+ },
607
+ originalArtist: {
608
+ key: "ORIGINALARTIST",
609
+ description: "Original artist of a cover or remix",
610
+ type: "string",
611
+ supportedFormats: ["ID3v2", "Vorbis"],
612
+ mappings: {
613
+ id3v2: { frame: "TOPE" },
614
+ vorbis: "ORIGINALARTIST"
615
+ }
616
+ },
617
+ originalAlbum: {
618
+ key: "ORIGINALALBUM",
619
+ description: "Original album of a cover or remix",
620
+ type: "string",
621
+ supportedFormats: ["ID3v2", "Vorbis"],
622
+ mappings: {
623
+ id3v2: { frame: "TOAL" },
624
+ vorbis: "ORIGINALALBUM"
625
+ }
626
+ },
627
+ originalDate: {
628
+ key: "ORIGINALDATE",
629
+ description: "Original release date",
630
+ type: "string",
631
+ supportedFormats: ["ID3v2", "MP4", "Vorbis"],
632
+ mappings: {
633
+ id3v2: { frame: "TDOR" },
634
+ vorbis: "ORIGINALDATE",
635
+ mp4: "----:com.apple.iTunes:ORIGINALDATE"
636
+ }
637
+ },
638
+ script: {
639
+ key: "SCRIPT",
640
+ description: "Writing script used for text (e.g., Latn, Jpan)",
641
+ type: "string",
642
+ supportedFormats: ["MP4", "Vorbis"],
643
+ mappings: {
644
+ vorbis: "SCRIPT",
645
+ mp4: "----:com.apple.iTunes:SCRIPT"
646
+ }
647
+ },
648
+ involvedPeople: {
649
+ key: "INVOLVEDPEOPLE",
650
+ description: "List of involved people and their roles",
651
+ type: "string",
652
+ supportedFormats: ["ID3v2"],
653
+ mappings: {
654
+ id3v2: { frame: "TIPL" }
655
+ }
656
+ },
657
+ encoding: {
658
+ key: "ENCODING",
659
+ description: "Encoding software or settings",
660
+ type: "string",
661
+ supportedFormats: ["ID3v2", "MP4", "Vorbis", "WAV"],
662
+ mappings: {
663
+ id3v2: { frame: "TSSE" },
664
+ vorbis: "ENCODING",
665
+ mp4: "\xA9too",
666
+ wav: "ISFT"
667
+ }
668
+ }
669
+ };
670
+ }
671
+ });
672
+
464
673
  // src/constants/basic-properties.ts
465
674
  var BASIC_PROPERTIES;
466
675
  var init_basic_properties = __esm({
@@ -710,12 +919,14 @@ var init_general_extended_properties = __esm({
710
919
  }
711
920
  },
712
921
  remixedBy: {
713
- key: "REMIXEDBY",
922
+ key: "REMIXER",
714
923
  description: "Person who remixed the track",
715
924
  type: "string",
716
- supportedFormats: ["Vorbis"],
925
+ supportedFormats: ["ID3v2", "MP4", "Vorbis"],
717
926
  mappings: {
718
- vorbis: "REMIXEDBY"
927
+ id3v2: { frame: "TPE4" },
928
+ vorbis: "REMIXER",
929
+ mp4: "----:com.apple.iTunes:REMIXER"
719
930
  }
720
931
  },
721
932
  language: {
@@ -965,13 +1176,15 @@ var PROPERTIES, _toTagLib, _fromTagLib;
965
1176
  var init_properties = __esm({
966
1177
  "src/constants/properties.ts"() {
967
1178
  "use strict";
1179
+ init_additional_properties();
968
1180
  init_basic_properties();
969
1181
  init_general_extended_properties();
970
1182
  init_specialized_properties();
971
1183
  PROPERTIES = {
972
1184
  ...BASIC_PROPERTIES,
973
1185
  ...GENERAL_EXTENDED_PROPERTIES,
974
- ...SPECIALIZED_PROPERTIES
1186
+ ...SPECIALIZED_PROPERTIES,
1187
+ ...ADDITIONAL_PROPERTIES
975
1188
  };
976
1189
  _toTagLib = {};
977
1190
  _fromTagLib = {};
@@ -1453,7 +1666,7 @@ var VERSION;
1453
1666
  var init_version = __esm({
1454
1667
  "src/version.ts"() {
1455
1668
  "use strict";
1456
- VERSION = "1.0.7";
1669
+ VERSION = "1.0.8";
1457
1670
  }
1458
1671
  });
1459
1672
 
@@ -1549,7 +1762,7 @@ var init_taglib_class = __esm({
1549
1762
  const actualInput = isNamedAudioInput(input) ? input.data : input;
1550
1763
  const sourcePath = typeof actualInput === "string" ? actualInput : void 0;
1551
1764
  const opts = {
1552
- partial: false,
1765
+ partial: true,
1553
1766
  maxHeaderSize: 1024 * 1024,
1554
1767
  maxFooterSize: 128 * 1024,
1555
1768
  ...options
@@ -1558,18 +1771,19 @@ var init_taglib_class = __esm({
1558
1771
  actualInput,
1559
1772
  opts
1560
1773
  );
1561
- const buffer = audioData.buffer.slice(
1562
- audioData.byteOffset,
1563
- audioData.byteOffset + audioData.byteLength
1564
- );
1565
- const uint8Array = new Uint8Array(buffer);
1774
+ const uint8Array = actualInput instanceof Uint8Array && audioData.buffer === actualInput.buffer ? new Uint8Array(
1775
+ audioData.buffer.slice(
1776
+ audioData.byteOffset,
1777
+ audioData.byteOffset + audioData.byteLength
1778
+ )
1779
+ ) : audioData;
1566
1780
  const fileHandle = this.module.createFileHandle();
1567
1781
  try {
1568
1782
  const success = fileHandle.loadFromBuffer(uint8Array);
1569
1783
  if (!success) {
1570
1784
  throw new InvalidFormatError(
1571
1785
  "Failed to load audio file. File may be corrupted or in an unsupported format",
1572
- buffer.byteLength
1786
+ uint8Array.byteLength
1573
1787
  );
1574
1788
  }
1575
1789
  return new AudioFileImpl(
@@ -1714,21 +1928,20 @@ async function getTagLib() {
1714
1928
 
1715
1929
  // src/simple/tag-operations.ts
1716
1930
  init_errors2();
1717
- init_write();
1718
1931
  init_tag_mapping();
1719
1932
 
1720
1933
  // src/simple/with-audio-file.ts
1721
1934
  init_errors2();
1722
- async function withAudioFile(file, fn) {
1935
+ async function withAudioFile(file, fn, options) {
1723
1936
  const taglib = await getTagLib();
1724
- const audioFile = await taglib.open(file);
1937
+ const audioFile = await taglib.open(file, options);
1725
1938
  try {
1726
1939
  if (!audioFile.isValid()) {
1727
1940
  throw new InvalidFormatError(
1728
1941
  "File may be corrupted or in an unsupported format"
1729
1942
  );
1730
1943
  }
1731
- return fn(audioFile);
1944
+ return await fn(audioFile);
1732
1945
  } finally {
1733
1946
  audioFile.dispose();
1734
1947
  }
@@ -1743,6 +1956,12 @@ async function withAudioFileSave(file, fn) {
1743
1956
  );
1744
1957
  }
1745
1958
  return audioFile.getFileBuffer();
1959
+ }, { partial: false });
1960
+ }
1961
+ async function withAudioFileSaveToFile(file, fn) {
1962
+ return withAudioFile(file, async (audioFile) => {
1963
+ fn(audioFile);
1964
+ await audioFile.saveToFile(file);
1746
1965
  });
1747
1966
  }
1748
1967
 
@@ -1765,8 +1984,9 @@ async function applyTagsToFile(file, tags) {
1765
1984
  "applyTagsToFile requires a file path string to save changes"
1766
1985
  );
1767
1986
  }
1768
- const modifiedBuffer = await applyTags(file, tags);
1769
- await writeFileData(file, modifiedBuffer);
1987
+ await withAudioFileSaveToFile(file, (audioFile) => {
1988
+ mergeTagUpdates(audioFile, tags);
1989
+ });
1770
1990
  }
1771
1991
  async function readProperties(file) {
1772
1992
  return withAudioFile(file, (audioFile) => {
@@ -2021,36 +2241,36 @@ var Tags = {
2021
2241
  Publisher: "publisher",
2022
2242
  Mood: "mood",
2023
2243
  Media: "media",
2024
- RadioStationOwner: "RADIOSTATIONOWNER",
2025
- Producer: "PRODUCER",
2026
- Subtitle: "SUBTITLE",
2027
- Label: "LABEL",
2244
+ RadioStationOwner: "radioStationOwner",
2245
+ Producer: "producer",
2246
+ Subtitle: "subtitle",
2247
+ Label: "label",
2028
2248
  // Sorting Properties
2029
2249
  TitleSort: "titleSort",
2030
2250
  ArtistSort: "artistSort",
2031
- AlbumArtistSort: "ALBUMARTISTSORT",
2251
+ AlbumArtistSort: "albumArtistSort",
2032
2252
  AlbumSort: "albumSort",
2033
- ComposerSort: "COMPOSERSORT",
2253
+ ComposerSort: "composerSort",
2034
2254
  // Identifiers
2035
2255
  Isrc: "isrc",
2036
- Asin: "ASIN",
2256
+ Asin: "asin",
2037
2257
  CatalogNumber: "catalogNumber",
2038
2258
  Barcode: "barcode",
2039
2259
  // MusicBrainz Identifiers
2040
2260
  MusicBrainzArtistId: "musicbrainzArtistId",
2041
- MusicBrainzReleaseArtistId: "MUSICBRAINZ_ALBUMARTISTID",
2042
- MusicBrainzWorkId: "MUSICBRAINZ_WORKID",
2261
+ MusicBrainzReleaseArtistId: "musicbrainzReleaseArtistId",
2262
+ MusicBrainzWorkId: "musicbrainzWorkId",
2043
2263
  MusicBrainzReleaseId: "musicbrainzReleaseId",
2044
2264
  MusicBrainzRecordingId: "musicbrainzTrackId",
2045
2265
  MusicBrainzTrackId: "musicbrainzTrackId",
2046
2266
  MusicBrainzReleaseGroupId: "musicbrainzReleaseGroupId",
2047
- MusicBrainzReleaseTrackId: "MUSICBRAINZ_RELEASETRACKID",
2267
+ MusicBrainzReleaseTrackId: "musicbrainzReleaseTrackId",
2048
2268
  // AcoustID
2049
2269
  AcoustidFingerprint: "acoustidFingerprint",
2050
2270
  AcoustidId: "acoustidId",
2051
2271
  // Podcast Properties
2052
- PodcastId: "PODCASTID",
2053
- PodcastUrl: "PODCASTURL",
2272
+ PodcastId: "podcastId",
2273
+ PodcastUrl: "podcastUrl",
2054
2274
  // Grouping and Work
2055
2275
  Grouping: "grouping",
2056
2276
  Work: "work",
@@ -2060,15 +2280,14 @@ var Tags = {
2060
2280
  AlbumPeak: "replayGainAlbumPeak",
2061
2281
  TrackGain: "replayGainTrackGain",
2062
2282
  TrackPeak: "replayGainTrackPeak",
2063
- // Special handling
2064
- OriginalArtist: "ORIGINALARTIST",
2065
- OriginalAlbum: "ORIGINALALBUM",
2066
- OriginalDate: "ORIGINALDATE",
2067
- Script: "SCRIPT",
2068
- InvolvedPeopleList: "INVOLVEDPEOPLELIST",
2069
- // Technical Properties
2070
- EncoderSettings: "ENCODERSETTINGS",
2071
- SourceMedia: "SOURCEMEDIA"
2283
+ // Original release
2284
+ OriginalArtist: "originalArtist",
2285
+ OriginalAlbum: "originalAlbum",
2286
+ OriginalDate: "originalDate",
2287
+ // Miscellaneous
2288
+ Script: "script",
2289
+ InvolvedPeople: "involvedPeople",
2290
+ Encoding: "encoding"
2072
2291
  };
2073
2292
  function isValidTagName(name) {
2074
2293
  return Object.values(Tags).includes(name);
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @fileoverview Main module exports for TagLib-Wasm
3
3
  *
4
- * TagLib v2.1 compiled to WebAssembly with TypeScript bindings
4
+ * TagLib v2.2 compiled to WebAssembly with TypeScript bindings
5
5
  * for universal audio metadata handling across all JavaScript runtimes.
6
6
  *
7
7
  * @module TagLib-Wasm