taglib-wasm 1.0.7 → 1.1.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/dist/index.browser.js +318 -46
- package/dist/index.d.ts +1 -1
- package/dist/simple.browser.js +298 -25
- package/dist/src/constants/additional-properties.d.ts +242 -0
- package/dist/src/constants/additional-properties.d.ts.map +1 -0
- package/dist/src/constants/additional-properties.js +204 -0
- package/dist/src/constants/general-extended-properties.d.ts +7 -3
- package/dist/src/constants/general-extended-properties.d.ts.map +1 -1
- package/dist/src/constants/general-extended-properties.js +5 -3
- package/dist/src/constants/properties.d.ts +239 -3
- package/dist/src/constants/properties.d.ts.map +1 -1
- package/dist/src/constants/properties.js +3 -1
- package/dist/src/constants/tags.d.ts +20 -21
- package/dist/src/constants/tags.d.ts.map +1 -1
- package/dist/src/constants/tags.js +20 -21
- package/dist/src/deno-compile.js +1 -1
- package/dist/src/runtime/module-loader.d.ts.map +1 -1
- package/dist/src/runtime/module-loader.js +2 -3
- package/dist/src/runtime/unified-loader/module-loading.js +5 -19
- package/dist/src/runtime/unified-loader/module-selection.d.ts.map +1 -1
- package/dist/src/runtime/unified-loader/module-selection.js +0 -1
- package/dist/src/runtime/unified-loader/types.d.ts +1 -3
- package/dist/src/runtime/unified-loader/types.d.ts.map +1 -1
- package/dist/src/runtime/wasi-adapter/adapter.d.ts +1 -1
- package/dist/src/runtime/wasi-adapter/adapter.js +1 -1
- package/dist/src/runtime/wasi-adapter/file-handle.d.ts +3 -2
- package/dist/src/runtime/wasi-adapter/file-handle.d.ts.map +1 -1
- package/dist/src/runtime/wasi-adapter/file-handle.js +27 -11
- package/dist/src/runtime/wasi-adapter/wasm-io.d.ts +3 -1
- package/dist/src/runtime/wasi-adapter/wasm-io.d.ts.map +1 -1
- package/dist/src/runtime/wasi-adapter/wasm-io.js +66 -1
- package/dist/src/runtime/wasi-host-loader.d.ts +1 -1
- package/dist/src/runtime/wasi-host-loader.js +1 -1
- package/dist/src/runtime/wasmer-sdk-loader/types.d.ts +1 -24
- package/dist/src/runtime/wasmer-sdk-loader/types.d.ts.map +1 -1
- package/dist/src/runtime/wasmer-sdk-loader/types.js +1 -19
- package/dist/src/simple/tag-operations.d.ts.map +1 -1
- package/dist/src/simple/tag-operations.js +8 -4
- package/dist/src/simple/with-audio-file.d.ts +3 -2
- package/dist/src/simple/with-audio-file.d.ts.map +1 -1
- package/dist/src/simple/with-audio-file.js +11 -4
- package/dist/src/taglib/audio-file-impl.d.ts +1 -0
- package/dist/src/taglib/audio-file-impl.d.ts.map +1 -1
- package/dist/src/taglib/audio-file-impl.js +37 -6
- package/dist/src/taglib/taglib-class.d.ts.map +1 -1
- package/dist/src/taglib/taglib-class.js +34 -7
- package/dist/src/types/config.d.ts +1 -1
- package/dist/src/types/metadata-mappings.d.ts.map +1 -1
- package/dist/src/types/metadata-mappings.js +20 -1
- package/dist/src/types/tags.d.ts +24 -0
- package/dist/src/types/tags.d.ts.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/wasm.d.ts +3 -0
- package/dist/src/wasm.d.ts.map +1 -1
- package/dist/taglib-web.wasm +0 -0
- package/dist/taglib-wrapper.js +1 -1
- package/dist/taglib_wasi.wasm +0 -0
- package/package.json +2 -2
- package/dist/src/runtime/wasmer-sdk-loader/high-level-api.d.ts +0 -10
- package/dist/src/runtime/wasmer-sdk-loader/high-level-api.d.ts.map +0 -1
- package/dist/src/runtime/wasmer-sdk-loader/high-level-api.js +0 -83
- package/dist/src/runtime/wasmer-sdk-loader/index.d.ts +0 -6
- package/dist/src/runtime/wasmer-sdk-loader/index.d.ts.map +0 -1
- package/dist/src/runtime/wasmer-sdk-loader/index.js +0 -17
- package/dist/src/runtime/wasmer-sdk-loader/initialization.d.ts +0 -16
- package/dist/src/runtime/wasmer-sdk-loader/initialization.d.ts.map +0 -1
- package/dist/src/runtime/wasmer-sdk-loader/initialization.js +0 -55
- package/dist/src/runtime/wasmer-sdk-loader/loader.d.ts +0 -9
- package/dist/src/runtime/wasmer-sdk-loader/loader.d.ts.map +0 -1
- package/dist/src/runtime/wasmer-sdk-loader/loader.js +0 -47
- package/dist/src/runtime/wasmer-sdk-loader/module-creation.d.ts +0 -9
- package/dist/src/runtime/wasmer-sdk-loader/module-creation.d.ts.map +0 -1
- package/dist/src/runtime/wasmer-sdk-loader/module-creation.js +0 -71
- package/dist/src/runtime/wasmer-sdk-loader/wasi-stubs.d.ts +0 -16
- package/dist/src/runtime/wasmer-sdk-loader/wasi-stubs.d.ts.map +0 -1
- package/dist/src/runtime/wasmer-sdk-loader/wasi-stubs.js +0 -64
package/dist/index.browser.js
CHANGED
|
@@ -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: "
|
|
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
|
-
|
|
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 = {};
|
|
@@ -1163,7 +1376,19 @@ var init_audio_file_base = __esm({
|
|
|
1163
1376
|
});
|
|
1164
1377
|
|
|
1165
1378
|
// src/taglib/audio-file-impl.ts
|
|
1166
|
-
|
|
1379
|
+
function readFileSync(path) {
|
|
1380
|
+
if (typeof Deno !== "undefined") return Deno.readFileSync(path);
|
|
1381
|
+
if (_nodeFs === void 0) {
|
|
1382
|
+
try {
|
|
1383
|
+
_nodeFs = new Function("return require('node:fs')")();
|
|
1384
|
+
} catch {
|
|
1385
|
+
_nodeFs = null;
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
if (_nodeFs) return new Uint8Array(_nodeFs.readFileSync(path));
|
|
1389
|
+
return new Uint8Array(0);
|
|
1390
|
+
}
|
|
1391
|
+
var _nodeFs, AudioFileImpl;
|
|
1167
1392
|
var init_audio_file_impl = __esm({
|
|
1168
1393
|
"src/taglib/audio-file-impl.ts"() {
|
|
1169
1394
|
"use strict";
|
|
@@ -1182,6 +1407,7 @@ var init_audio_file_impl = __esm({
|
|
|
1182
1407
|
isPartiallyLoaded,
|
|
1183
1408
|
partialLoadOptions
|
|
1184
1409
|
);
|
|
1410
|
+
__publicField(this, "pathModeBuffer", null);
|
|
1185
1411
|
}
|
|
1186
1412
|
save() {
|
|
1187
1413
|
if (this.isPartiallyLoaded && this.originalSource) {
|
|
@@ -1195,7 +1421,17 @@ var init_audio_file_impl = __esm({
|
|
|
1195
1421
|
}
|
|
1196
1422
|
getFileBuffer() {
|
|
1197
1423
|
const buffer = this.handle.getBuffer();
|
|
1198
|
-
|
|
1424
|
+
if (buffer.length > 0) return buffer;
|
|
1425
|
+
if (this.pathModeBuffer) return this.pathModeBuffer;
|
|
1426
|
+
if (this.sourcePath) {
|
|
1427
|
+
try {
|
|
1428
|
+
this.pathModeBuffer = readFileSync(this.sourcePath);
|
|
1429
|
+
return this.pathModeBuffer;
|
|
1430
|
+
} catch {
|
|
1431
|
+
return new Uint8Array(0);
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
return new Uint8Array(0);
|
|
1199
1435
|
}
|
|
1200
1436
|
async saveToFile(path) {
|
|
1201
1437
|
const targetPath = path ?? this.sourcePath;
|
|
@@ -1206,14 +1442,15 @@ var init_audio_file_impl = __esm({
|
|
|
1206
1442
|
);
|
|
1207
1443
|
}
|
|
1208
1444
|
if (this.isPartiallyLoaded && this.originalSource) {
|
|
1209
|
-
const fullData = await readFileData(this.originalSource);
|
|
1210
1445
|
const fullFileHandle = this.module.createFileHandle();
|
|
1211
1446
|
try {
|
|
1212
|
-
const success =
|
|
1447
|
+
const success = await (async () => {
|
|
1448
|
+
const data = await readFileData(this.originalSource);
|
|
1449
|
+
return fullFileHandle.loadFromBuffer(data);
|
|
1450
|
+
})();
|
|
1213
1451
|
if (!success) {
|
|
1214
1452
|
throw new InvalidFormatError(
|
|
1215
|
-
"Failed to load full audio file for saving"
|
|
1216
|
-
fullData.byteLength
|
|
1453
|
+
"Failed to load full audio file for saving"
|
|
1217
1454
|
);
|
|
1218
1455
|
}
|
|
1219
1456
|
const partialTag = this.handle.getTag();
|
|
@@ -1249,7 +1486,10 @@ var init_audio_file_impl = __esm({
|
|
|
1249
1486
|
"Failed to save changes to in-memory buffer"
|
|
1250
1487
|
);
|
|
1251
1488
|
}
|
|
1252
|
-
|
|
1489
|
+
const buffer = this.handle.getBuffer();
|
|
1490
|
+
if (buffer.length > 0) {
|
|
1491
|
+
await writeFileData(targetPath, buffer);
|
|
1492
|
+
}
|
|
1253
1493
|
}
|
|
1254
1494
|
}
|
|
1255
1495
|
getPictures() {
|
|
@@ -1453,7 +1693,7 @@ var VERSION;
|
|
|
1453
1693
|
var init_version = __esm({
|
|
1454
1694
|
"src/version.ts"() {
|
|
1455
1695
|
"use strict";
|
|
1456
|
-
VERSION = "1.0
|
|
1696
|
+
VERSION = "1.1.0";
|
|
1457
1697
|
}
|
|
1458
1698
|
});
|
|
1459
1699
|
|
|
@@ -1548,8 +1788,34 @@ var init_taglib_class = __esm({
|
|
|
1548
1788
|
}
|
|
1549
1789
|
const actualInput = isNamedAudioInput(input) ? input.data : input;
|
|
1550
1790
|
const sourcePath = typeof actualInput === "string" ? actualInput : void 0;
|
|
1791
|
+
if (typeof actualInput === "string" && this.module.isWasi) {
|
|
1792
|
+
const fileHandle2 = this.module.createFileHandle();
|
|
1793
|
+
try {
|
|
1794
|
+
const fh = fileHandle2;
|
|
1795
|
+
if (fh.loadFromPath) {
|
|
1796
|
+
const success = fh.loadFromPath(actualInput);
|
|
1797
|
+
if (!success) {
|
|
1798
|
+
throw new InvalidFormatError(
|
|
1799
|
+
`Failed to load audio file. Path: ${actualInput}`
|
|
1800
|
+
);
|
|
1801
|
+
}
|
|
1802
|
+
return new AudioFileImpl(
|
|
1803
|
+
this.module,
|
|
1804
|
+
fileHandle2,
|
|
1805
|
+
sourcePath,
|
|
1806
|
+
actualInput,
|
|
1807
|
+
false
|
|
1808
|
+
);
|
|
1809
|
+
}
|
|
1810
|
+
} catch (error) {
|
|
1811
|
+
if (typeof fileHandle2.destroy === "function") {
|
|
1812
|
+
fileHandle2.destroy();
|
|
1813
|
+
}
|
|
1814
|
+
throw error;
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1551
1817
|
const opts = {
|
|
1552
|
-
partial:
|
|
1818
|
+
partial: true,
|
|
1553
1819
|
maxHeaderSize: 1024 * 1024,
|
|
1554
1820
|
maxFooterSize: 128 * 1024,
|
|
1555
1821
|
...options
|
|
@@ -1558,18 +1824,19 @@ var init_taglib_class = __esm({
|
|
|
1558
1824
|
actualInput,
|
|
1559
1825
|
opts
|
|
1560
1826
|
);
|
|
1561
|
-
const
|
|
1562
|
-
audioData.
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1827
|
+
const uint8Array = actualInput instanceof Uint8Array && audioData.buffer === actualInput.buffer ? new Uint8Array(
|
|
1828
|
+
audioData.buffer.slice(
|
|
1829
|
+
audioData.byteOffset,
|
|
1830
|
+
audioData.byteOffset + audioData.byteLength
|
|
1831
|
+
)
|
|
1832
|
+
) : audioData;
|
|
1566
1833
|
const fileHandle = this.module.createFileHandle();
|
|
1567
1834
|
try {
|
|
1568
1835
|
const success = fileHandle.loadFromBuffer(uint8Array);
|
|
1569
1836
|
if (!success) {
|
|
1570
1837
|
throw new InvalidFormatError(
|
|
1571
1838
|
"Failed to load audio file. File may be corrupted or in an unsupported format",
|
|
1572
|
-
|
|
1839
|
+
uint8Array.byteLength
|
|
1573
1840
|
);
|
|
1574
1841
|
}
|
|
1575
1842
|
return new AudioFileImpl(
|
|
@@ -1714,21 +1981,20 @@ async function getTagLib() {
|
|
|
1714
1981
|
|
|
1715
1982
|
// src/simple/tag-operations.ts
|
|
1716
1983
|
init_errors2();
|
|
1717
|
-
init_write();
|
|
1718
1984
|
init_tag_mapping();
|
|
1719
1985
|
|
|
1720
1986
|
// src/simple/with-audio-file.ts
|
|
1721
1987
|
init_errors2();
|
|
1722
|
-
async function withAudioFile(file, fn) {
|
|
1988
|
+
async function withAudioFile(file, fn, options) {
|
|
1723
1989
|
const taglib = await getTagLib();
|
|
1724
|
-
const audioFile = await taglib.open(file);
|
|
1990
|
+
const audioFile = await taglib.open(file, options);
|
|
1725
1991
|
try {
|
|
1726
1992
|
if (!audioFile.isValid()) {
|
|
1727
1993
|
throw new InvalidFormatError(
|
|
1728
1994
|
"File may be corrupted or in an unsupported format"
|
|
1729
1995
|
);
|
|
1730
1996
|
}
|
|
1731
|
-
return fn(audioFile);
|
|
1997
|
+
return await fn(audioFile);
|
|
1732
1998
|
} finally {
|
|
1733
1999
|
audioFile.dispose();
|
|
1734
2000
|
}
|
|
@@ -1743,6 +2009,12 @@ async function withAudioFileSave(file, fn) {
|
|
|
1743
2009
|
);
|
|
1744
2010
|
}
|
|
1745
2011
|
return audioFile.getFileBuffer();
|
|
2012
|
+
}, { partial: false });
|
|
2013
|
+
}
|
|
2014
|
+
async function withAudioFileSaveToFile(file, fn) {
|
|
2015
|
+
return withAudioFile(file, async (audioFile) => {
|
|
2016
|
+
fn(audioFile);
|
|
2017
|
+
await audioFile.saveToFile(file);
|
|
1746
2018
|
});
|
|
1747
2019
|
}
|
|
1748
2020
|
|
|
@@ -1765,8 +2037,9 @@ async function applyTagsToFile(file, tags) {
|
|
|
1765
2037
|
"applyTagsToFile requires a file path string to save changes"
|
|
1766
2038
|
);
|
|
1767
2039
|
}
|
|
1768
|
-
|
|
1769
|
-
|
|
2040
|
+
await withAudioFileSaveToFile(file, (audioFile) => {
|
|
2041
|
+
mergeTagUpdates(audioFile, tags);
|
|
2042
|
+
});
|
|
1770
2043
|
}
|
|
1771
2044
|
async function readProperties(file) {
|
|
1772
2045
|
return withAudioFile(file, (audioFile) => {
|
|
@@ -2021,36 +2294,36 @@ var Tags = {
|
|
|
2021
2294
|
Publisher: "publisher",
|
|
2022
2295
|
Mood: "mood",
|
|
2023
2296
|
Media: "media",
|
|
2024
|
-
RadioStationOwner: "
|
|
2025
|
-
Producer: "
|
|
2026
|
-
Subtitle: "
|
|
2027
|
-
Label: "
|
|
2297
|
+
RadioStationOwner: "radioStationOwner",
|
|
2298
|
+
Producer: "producer",
|
|
2299
|
+
Subtitle: "subtitle",
|
|
2300
|
+
Label: "label",
|
|
2028
2301
|
// Sorting Properties
|
|
2029
2302
|
TitleSort: "titleSort",
|
|
2030
2303
|
ArtistSort: "artistSort",
|
|
2031
|
-
AlbumArtistSort: "
|
|
2304
|
+
AlbumArtistSort: "albumArtistSort",
|
|
2032
2305
|
AlbumSort: "albumSort",
|
|
2033
|
-
ComposerSort: "
|
|
2306
|
+
ComposerSort: "composerSort",
|
|
2034
2307
|
// Identifiers
|
|
2035
2308
|
Isrc: "isrc",
|
|
2036
|
-
Asin: "
|
|
2309
|
+
Asin: "asin",
|
|
2037
2310
|
CatalogNumber: "catalogNumber",
|
|
2038
2311
|
Barcode: "barcode",
|
|
2039
2312
|
// MusicBrainz Identifiers
|
|
2040
2313
|
MusicBrainzArtistId: "musicbrainzArtistId",
|
|
2041
|
-
MusicBrainzReleaseArtistId: "
|
|
2042
|
-
MusicBrainzWorkId: "
|
|
2314
|
+
MusicBrainzReleaseArtistId: "musicbrainzReleaseArtistId",
|
|
2315
|
+
MusicBrainzWorkId: "musicbrainzWorkId",
|
|
2043
2316
|
MusicBrainzReleaseId: "musicbrainzReleaseId",
|
|
2044
2317
|
MusicBrainzRecordingId: "musicbrainzTrackId",
|
|
2045
2318
|
MusicBrainzTrackId: "musicbrainzTrackId",
|
|
2046
2319
|
MusicBrainzReleaseGroupId: "musicbrainzReleaseGroupId",
|
|
2047
|
-
MusicBrainzReleaseTrackId: "
|
|
2320
|
+
MusicBrainzReleaseTrackId: "musicbrainzReleaseTrackId",
|
|
2048
2321
|
// AcoustID
|
|
2049
2322
|
AcoustidFingerprint: "acoustidFingerprint",
|
|
2050
2323
|
AcoustidId: "acoustidId",
|
|
2051
2324
|
// Podcast Properties
|
|
2052
|
-
PodcastId: "
|
|
2053
|
-
PodcastUrl: "
|
|
2325
|
+
PodcastId: "podcastId",
|
|
2326
|
+
PodcastUrl: "podcastUrl",
|
|
2054
2327
|
// Grouping and Work
|
|
2055
2328
|
Grouping: "grouping",
|
|
2056
2329
|
Work: "work",
|
|
@@ -2060,15 +2333,14 @@ var Tags = {
|
|
|
2060
2333
|
AlbumPeak: "replayGainAlbumPeak",
|
|
2061
2334
|
TrackGain: "replayGainTrackGain",
|
|
2062
2335
|
TrackPeak: "replayGainTrackPeak",
|
|
2063
|
-
//
|
|
2064
|
-
OriginalArtist: "
|
|
2065
|
-
OriginalAlbum: "
|
|
2066
|
-
OriginalDate: "
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
SourceMedia: "SOURCEMEDIA"
|
|
2336
|
+
// Original release
|
|
2337
|
+
OriginalArtist: "originalArtist",
|
|
2338
|
+
OriginalAlbum: "originalAlbum",
|
|
2339
|
+
OriginalDate: "originalDate",
|
|
2340
|
+
// Miscellaneous
|
|
2341
|
+
Script: "script",
|
|
2342
|
+
InvolvedPeople: "involvedPeople",
|
|
2343
|
+
Encoding: "encoding"
|
|
2072
2344
|
};
|
|
2073
2345
|
function isValidTagName(name) {
|
|
2074
2346
|
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.
|
|
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
|