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/simple.browser.js
CHANGED
|
@@ -449,6 +449,215 @@ var init_write = __esm({
|
|
|
449
449
|
}
|
|
450
450
|
});
|
|
451
451
|
|
|
452
|
+
// src/constants/additional-properties.ts
|
|
453
|
+
var ADDITIONAL_PROPERTIES;
|
|
454
|
+
var init_additional_properties = __esm({
|
|
455
|
+
"src/constants/additional-properties.ts"() {
|
|
456
|
+
"use strict";
|
|
457
|
+
ADDITIONAL_PROPERTIES = {
|
|
458
|
+
albumArtistSort: {
|
|
459
|
+
key: "ALBUMARTISTSORT",
|
|
460
|
+
description: "Sort name for album artist (for alphabetization)",
|
|
461
|
+
type: "string",
|
|
462
|
+
supportedFormats: ["ID3v2", "MP4", "Vorbis"],
|
|
463
|
+
mappings: {
|
|
464
|
+
id3v2: { frame: "TSO2" },
|
|
465
|
+
vorbis: "ALBUMARTISTSORT",
|
|
466
|
+
mp4: "soaa"
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
composerSort: {
|
|
470
|
+
key: "COMPOSERSORT",
|
|
471
|
+
description: "Sort name for composer (for alphabetization)",
|
|
472
|
+
type: "string",
|
|
473
|
+
supportedFormats: ["ID3v2", "MP4", "Vorbis"],
|
|
474
|
+
mappings: {
|
|
475
|
+
id3v2: { frame: "TSOC" },
|
|
476
|
+
vorbis: "COMPOSERSORT",
|
|
477
|
+
mp4: "soco"
|
|
478
|
+
}
|
|
479
|
+
},
|
|
480
|
+
subtitle: {
|
|
481
|
+
key: "SUBTITLE",
|
|
482
|
+
description: "Subtitle or description refinement",
|
|
483
|
+
type: "string",
|
|
484
|
+
supportedFormats: ["ID3v2", "MP4", "Vorbis"],
|
|
485
|
+
mappings: {
|
|
486
|
+
id3v2: { frame: "TIT3" },
|
|
487
|
+
vorbis: "SUBTITLE",
|
|
488
|
+
mp4: "----:com.apple.iTunes:SUBTITLE"
|
|
489
|
+
}
|
|
490
|
+
},
|
|
491
|
+
label: {
|
|
492
|
+
key: "LABEL",
|
|
493
|
+
description: "Record label name",
|
|
494
|
+
type: "string",
|
|
495
|
+
supportedFormats: ["ID3v2", "MP4", "Vorbis", "WAV"],
|
|
496
|
+
mappings: {
|
|
497
|
+
id3v2: { frame: "TPUB" },
|
|
498
|
+
vorbis: "LABEL",
|
|
499
|
+
mp4: "----:com.apple.iTunes:LABEL",
|
|
500
|
+
wav: "IPUB"
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
producer: {
|
|
504
|
+
key: "PRODUCER",
|
|
505
|
+
description: "Producer of the recording",
|
|
506
|
+
type: "string",
|
|
507
|
+
supportedFormats: ["ID3v2", "MP4", "Vorbis"],
|
|
508
|
+
mappings: {
|
|
509
|
+
id3v2: { frame: "TXXX", description: "PRODUCER" },
|
|
510
|
+
vorbis: "PRODUCER",
|
|
511
|
+
mp4: "----:com.apple.iTunes:PRODUCER"
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
radioStationOwner: {
|
|
515
|
+
key: "RADIOSTATIONOWNER",
|
|
516
|
+
description: "Owner of the radio station",
|
|
517
|
+
type: "string",
|
|
518
|
+
supportedFormats: ["ID3v2"],
|
|
519
|
+
mappings: {
|
|
520
|
+
id3v2: { frame: "TRSO" }
|
|
521
|
+
}
|
|
522
|
+
},
|
|
523
|
+
asin: {
|
|
524
|
+
key: "ASIN",
|
|
525
|
+
description: "Amazon Standard Identification Number",
|
|
526
|
+
type: "string",
|
|
527
|
+
supportedFormats: ["ID3v2", "MP4", "Vorbis"],
|
|
528
|
+
mappings: {
|
|
529
|
+
id3v2: { frame: "TXXX", description: "ASIN" },
|
|
530
|
+
vorbis: "ASIN",
|
|
531
|
+
mp4: "----:com.apple.iTunes:ASIN"
|
|
532
|
+
}
|
|
533
|
+
},
|
|
534
|
+
musicbrainzReleaseArtistId: {
|
|
535
|
+
key: "MUSICBRAINZ_ALBUMARTISTID",
|
|
536
|
+
description: "MusicBrainz Release Artist ID (UUID)",
|
|
537
|
+
type: "string",
|
|
538
|
+
supportedFormats: ["ID3v2", "MP4", "Vorbis"],
|
|
539
|
+
mappings: {
|
|
540
|
+
id3v2: {
|
|
541
|
+
frame: "TXXX",
|
|
542
|
+
description: "MusicBrainz Album Artist Id"
|
|
543
|
+
},
|
|
544
|
+
vorbis: "MUSICBRAINZ_ALBUMARTISTID",
|
|
545
|
+
mp4: "----:com.apple.iTunes:MusicBrainz Album Artist Id"
|
|
546
|
+
}
|
|
547
|
+
},
|
|
548
|
+
musicbrainzWorkId: {
|
|
549
|
+
key: "MUSICBRAINZ_WORKID",
|
|
550
|
+
description: "MusicBrainz Work ID (UUID)",
|
|
551
|
+
type: "string",
|
|
552
|
+
supportedFormats: ["ID3v2", "MP4", "Vorbis"],
|
|
553
|
+
mappings: {
|
|
554
|
+
id3v2: { frame: "TXXX", description: "MusicBrainz Work Id" },
|
|
555
|
+
vorbis: "MUSICBRAINZ_WORKID",
|
|
556
|
+
mp4: "----:com.apple.iTunes:MusicBrainz Work Id"
|
|
557
|
+
}
|
|
558
|
+
},
|
|
559
|
+
musicbrainzReleaseTrackId: {
|
|
560
|
+
key: "MUSICBRAINZ_RELEASETRACKID",
|
|
561
|
+
description: "MusicBrainz Release Track ID (UUID)",
|
|
562
|
+
type: "string",
|
|
563
|
+
supportedFormats: ["ID3v2", "MP4", "Vorbis"],
|
|
564
|
+
mappings: {
|
|
565
|
+
id3v2: {
|
|
566
|
+
frame: "TXXX",
|
|
567
|
+
description: "MusicBrainz Release Track Id"
|
|
568
|
+
},
|
|
569
|
+
vorbis: "MUSICBRAINZ_RELEASETRACKID",
|
|
570
|
+
mp4: "----:com.apple.iTunes:MusicBrainz Release Track Id"
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
podcastId: {
|
|
574
|
+
key: "PODCASTID",
|
|
575
|
+
description: "Podcast episode identifier",
|
|
576
|
+
type: "string",
|
|
577
|
+
supportedFormats: ["ID3v2", "MP4", "Vorbis"],
|
|
578
|
+
mappings: {
|
|
579
|
+
id3v2: { frame: "TGID" },
|
|
580
|
+
vorbis: "PODCASTID",
|
|
581
|
+
mp4: "egid"
|
|
582
|
+
}
|
|
583
|
+
},
|
|
584
|
+
podcastUrl: {
|
|
585
|
+
key: "PODCASTURL",
|
|
586
|
+
description: "Podcast feed URL",
|
|
587
|
+
type: "string",
|
|
588
|
+
supportedFormats: ["ID3v2", "MP4", "Vorbis"],
|
|
589
|
+
mappings: {
|
|
590
|
+
id3v2: { frame: "WFED" },
|
|
591
|
+
vorbis: "PODCASTURL",
|
|
592
|
+
mp4: "purl"
|
|
593
|
+
}
|
|
594
|
+
},
|
|
595
|
+
originalArtist: {
|
|
596
|
+
key: "ORIGINALARTIST",
|
|
597
|
+
description: "Original artist of a cover or remix",
|
|
598
|
+
type: "string",
|
|
599
|
+
supportedFormats: ["ID3v2", "Vorbis"],
|
|
600
|
+
mappings: {
|
|
601
|
+
id3v2: { frame: "TOPE" },
|
|
602
|
+
vorbis: "ORIGINALARTIST"
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
|
+
originalAlbum: {
|
|
606
|
+
key: "ORIGINALALBUM",
|
|
607
|
+
description: "Original album of a cover or remix",
|
|
608
|
+
type: "string",
|
|
609
|
+
supportedFormats: ["ID3v2", "Vorbis"],
|
|
610
|
+
mappings: {
|
|
611
|
+
id3v2: { frame: "TOAL" },
|
|
612
|
+
vorbis: "ORIGINALALBUM"
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
originalDate: {
|
|
616
|
+
key: "ORIGINALDATE",
|
|
617
|
+
description: "Original release date",
|
|
618
|
+
type: "string",
|
|
619
|
+
supportedFormats: ["ID3v2", "MP4", "Vorbis"],
|
|
620
|
+
mappings: {
|
|
621
|
+
id3v2: { frame: "TDOR" },
|
|
622
|
+
vorbis: "ORIGINALDATE",
|
|
623
|
+
mp4: "----:com.apple.iTunes:ORIGINALDATE"
|
|
624
|
+
}
|
|
625
|
+
},
|
|
626
|
+
script: {
|
|
627
|
+
key: "SCRIPT",
|
|
628
|
+
description: "Writing script used for text (e.g., Latn, Jpan)",
|
|
629
|
+
type: "string",
|
|
630
|
+
supportedFormats: ["MP4", "Vorbis"],
|
|
631
|
+
mappings: {
|
|
632
|
+
vorbis: "SCRIPT",
|
|
633
|
+
mp4: "----:com.apple.iTunes:SCRIPT"
|
|
634
|
+
}
|
|
635
|
+
},
|
|
636
|
+
involvedPeople: {
|
|
637
|
+
key: "INVOLVEDPEOPLE",
|
|
638
|
+
description: "List of involved people and their roles",
|
|
639
|
+
type: "string",
|
|
640
|
+
supportedFormats: ["ID3v2"],
|
|
641
|
+
mappings: {
|
|
642
|
+
id3v2: { frame: "TIPL" }
|
|
643
|
+
}
|
|
644
|
+
},
|
|
645
|
+
encoding: {
|
|
646
|
+
key: "ENCODING",
|
|
647
|
+
description: "Encoding software or settings",
|
|
648
|
+
type: "string",
|
|
649
|
+
supportedFormats: ["ID3v2", "MP4", "Vorbis", "WAV"],
|
|
650
|
+
mappings: {
|
|
651
|
+
id3v2: { frame: "TSSE" },
|
|
652
|
+
vorbis: "ENCODING",
|
|
653
|
+
mp4: "\xA9too",
|
|
654
|
+
wav: "ISFT"
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
});
|
|
660
|
+
|
|
452
661
|
// src/constants/basic-properties.ts
|
|
453
662
|
var BASIC_PROPERTIES;
|
|
454
663
|
var init_basic_properties = __esm({
|
|
@@ -698,12 +907,14 @@ var init_general_extended_properties = __esm({
|
|
|
698
907
|
}
|
|
699
908
|
},
|
|
700
909
|
remixedBy: {
|
|
701
|
-
key: "
|
|
910
|
+
key: "REMIXER",
|
|
702
911
|
description: "Person who remixed the track",
|
|
703
912
|
type: "string",
|
|
704
|
-
supportedFormats: ["Vorbis"],
|
|
913
|
+
supportedFormats: ["ID3v2", "MP4", "Vorbis"],
|
|
705
914
|
mappings: {
|
|
706
|
-
|
|
915
|
+
id3v2: { frame: "TPE4" },
|
|
916
|
+
vorbis: "REMIXER",
|
|
917
|
+
mp4: "----:com.apple.iTunes:REMIXER"
|
|
707
918
|
}
|
|
708
919
|
},
|
|
709
920
|
language: {
|
|
@@ -953,13 +1164,15 @@ var PROPERTIES, _toTagLib, _fromTagLib;
|
|
|
953
1164
|
var init_properties = __esm({
|
|
954
1165
|
"src/constants/properties.ts"() {
|
|
955
1166
|
"use strict";
|
|
1167
|
+
init_additional_properties();
|
|
956
1168
|
init_basic_properties();
|
|
957
1169
|
init_general_extended_properties();
|
|
958
1170
|
init_specialized_properties();
|
|
959
1171
|
PROPERTIES = {
|
|
960
1172
|
...BASIC_PROPERTIES,
|
|
961
1173
|
...GENERAL_EXTENDED_PROPERTIES,
|
|
962
|
-
...SPECIALIZED_PROPERTIES
|
|
1174
|
+
...SPECIALIZED_PROPERTIES,
|
|
1175
|
+
...ADDITIONAL_PROPERTIES
|
|
963
1176
|
};
|
|
964
1177
|
_toTagLib = {};
|
|
965
1178
|
_fromTagLib = {};
|
|
@@ -1151,7 +1364,19 @@ var init_audio_file_base = __esm({
|
|
|
1151
1364
|
});
|
|
1152
1365
|
|
|
1153
1366
|
// src/taglib/audio-file-impl.ts
|
|
1154
|
-
|
|
1367
|
+
function readFileSync(path) {
|
|
1368
|
+
if (typeof Deno !== "undefined") return Deno.readFileSync(path);
|
|
1369
|
+
if (_nodeFs === void 0) {
|
|
1370
|
+
try {
|
|
1371
|
+
_nodeFs = new Function("return require('node:fs')")();
|
|
1372
|
+
} catch {
|
|
1373
|
+
_nodeFs = null;
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
if (_nodeFs) return new Uint8Array(_nodeFs.readFileSync(path));
|
|
1377
|
+
return new Uint8Array(0);
|
|
1378
|
+
}
|
|
1379
|
+
var _nodeFs, AudioFileImpl;
|
|
1155
1380
|
var init_audio_file_impl = __esm({
|
|
1156
1381
|
"src/taglib/audio-file-impl.ts"() {
|
|
1157
1382
|
"use strict";
|
|
@@ -1170,6 +1395,7 @@ var init_audio_file_impl = __esm({
|
|
|
1170
1395
|
isPartiallyLoaded,
|
|
1171
1396
|
partialLoadOptions
|
|
1172
1397
|
);
|
|
1398
|
+
__publicField(this, "pathModeBuffer", null);
|
|
1173
1399
|
}
|
|
1174
1400
|
save() {
|
|
1175
1401
|
if (this.isPartiallyLoaded && this.originalSource) {
|
|
@@ -1183,7 +1409,17 @@ var init_audio_file_impl = __esm({
|
|
|
1183
1409
|
}
|
|
1184
1410
|
getFileBuffer() {
|
|
1185
1411
|
const buffer = this.handle.getBuffer();
|
|
1186
|
-
|
|
1412
|
+
if (buffer.length > 0) return buffer;
|
|
1413
|
+
if (this.pathModeBuffer) return this.pathModeBuffer;
|
|
1414
|
+
if (this.sourcePath) {
|
|
1415
|
+
try {
|
|
1416
|
+
this.pathModeBuffer = readFileSync(this.sourcePath);
|
|
1417
|
+
return this.pathModeBuffer;
|
|
1418
|
+
} catch {
|
|
1419
|
+
return new Uint8Array(0);
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
return new Uint8Array(0);
|
|
1187
1423
|
}
|
|
1188
1424
|
async saveToFile(path) {
|
|
1189
1425
|
const targetPath = path ?? this.sourcePath;
|
|
@@ -1194,14 +1430,15 @@ var init_audio_file_impl = __esm({
|
|
|
1194
1430
|
);
|
|
1195
1431
|
}
|
|
1196
1432
|
if (this.isPartiallyLoaded && this.originalSource) {
|
|
1197
|
-
const fullData = await readFileData(this.originalSource);
|
|
1198
1433
|
const fullFileHandle = this.module.createFileHandle();
|
|
1199
1434
|
try {
|
|
1200
|
-
const success =
|
|
1435
|
+
const success = await (async () => {
|
|
1436
|
+
const data = await readFileData(this.originalSource);
|
|
1437
|
+
return fullFileHandle.loadFromBuffer(data);
|
|
1438
|
+
})();
|
|
1201
1439
|
if (!success) {
|
|
1202
1440
|
throw new InvalidFormatError(
|
|
1203
|
-
"Failed to load full audio file for saving"
|
|
1204
|
-
fullData.byteLength
|
|
1441
|
+
"Failed to load full audio file for saving"
|
|
1205
1442
|
);
|
|
1206
1443
|
}
|
|
1207
1444
|
const partialTag = this.handle.getTag();
|
|
@@ -1237,7 +1474,10 @@ var init_audio_file_impl = __esm({
|
|
|
1237
1474
|
"Failed to save changes to in-memory buffer"
|
|
1238
1475
|
);
|
|
1239
1476
|
}
|
|
1240
|
-
|
|
1477
|
+
const buffer = this.handle.getBuffer();
|
|
1478
|
+
if (buffer.length > 0) {
|
|
1479
|
+
await writeFileData(targetPath, buffer);
|
|
1480
|
+
}
|
|
1241
1481
|
}
|
|
1242
1482
|
}
|
|
1243
1483
|
getPictures() {
|
|
@@ -1441,7 +1681,7 @@ var VERSION;
|
|
|
1441
1681
|
var init_version = __esm({
|
|
1442
1682
|
"src/version.ts"() {
|
|
1443
1683
|
"use strict";
|
|
1444
|
-
VERSION = "1.0
|
|
1684
|
+
VERSION = "1.1.0";
|
|
1445
1685
|
}
|
|
1446
1686
|
});
|
|
1447
1687
|
|
|
@@ -1535,8 +1775,34 @@ var init_taglib_class = __esm({
|
|
|
1535
1775
|
}
|
|
1536
1776
|
const actualInput = isNamedAudioInput(input) ? input.data : input;
|
|
1537
1777
|
const sourcePath = typeof actualInput === "string" ? actualInput : void 0;
|
|
1778
|
+
if (typeof actualInput === "string" && this.module.isWasi) {
|
|
1779
|
+
const fileHandle2 = this.module.createFileHandle();
|
|
1780
|
+
try {
|
|
1781
|
+
const fh = fileHandle2;
|
|
1782
|
+
if (fh.loadFromPath) {
|
|
1783
|
+
const success = fh.loadFromPath(actualInput);
|
|
1784
|
+
if (!success) {
|
|
1785
|
+
throw new InvalidFormatError(
|
|
1786
|
+
`Failed to load audio file. Path: ${actualInput}`
|
|
1787
|
+
);
|
|
1788
|
+
}
|
|
1789
|
+
return new AudioFileImpl(
|
|
1790
|
+
this.module,
|
|
1791
|
+
fileHandle2,
|
|
1792
|
+
sourcePath,
|
|
1793
|
+
actualInput,
|
|
1794
|
+
false
|
|
1795
|
+
);
|
|
1796
|
+
}
|
|
1797
|
+
} catch (error) {
|
|
1798
|
+
if (typeof fileHandle2.destroy === "function") {
|
|
1799
|
+
fileHandle2.destroy();
|
|
1800
|
+
}
|
|
1801
|
+
throw error;
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1538
1804
|
const opts = {
|
|
1539
|
-
partial:
|
|
1805
|
+
partial: true,
|
|
1540
1806
|
maxHeaderSize: 1024 * 1024,
|
|
1541
1807
|
maxFooterSize: 128 * 1024,
|
|
1542
1808
|
...options
|
|
@@ -1545,18 +1811,19 @@ var init_taglib_class = __esm({
|
|
|
1545
1811
|
actualInput,
|
|
1546
1812
|
opts
|
|
1547
1813
|
);
|
|
1548
|
-
const
|
|
1549
|
-
audioData.
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1814
|
+
const uint8Array = actualInput instanceof Uint8Array && audioData.buffer === actualInput.buffer ? new Uint8Array(
|
|
1815
|
+
audioData.buffer.slice(
|
|
1816
|
+
audioData.byteOffset,
|
|
1817
|
+
audioData.byteOffset + audioData.byteLength
|
|
1818
|
+
)
|
|
1819
|
+
) : audioData;
|
|
1553
1820
|
const fileHandle = this.module.createFileHandle();
|
|
1554
1821
|
try {
|
|
1555
1822
|
const success = fileHandle.loadFromBuffer(uint8Array);
|
|
1556
1823
|
if (!success) {
|
|
1557
1824
|
throw new InvalidFormatError(
|
|
1558
1825
|
"Failed to load audio file. File may be corrupted or in an unsupported format",
|
|
1559
|
-
|
|
1826
|
+
uint8Array.byteLength
|
|
1560
1827
|
);
|
|
1561
1828
|
}
|
|
1562
1829
|
return new AudioFileImpl(
|
|
@@ -1696,21 +1963,20 @@ async function getTagLib() {
|
|
|
1696
1963
|
|
|
1697
1964
|
// src/simple/tag-operations.ts
|
|
1698
1965
|
init_errors2();
|
|
1699
|
-
init_write();
|
|
1700
1966
|
init_tag_mapping();
|
|
1701
1967
|
|
|
1702
1968
|
// src/simple/with-audio-file.ts
|
|
1703
1969
|
init_errors2();
|
|
1704
|
-
async function withAudioFile(file, fn) {
|
|
1970
|
+
async function withAudioFile(file, fn, options) {
|
|
1705
1971
|
const taglib = await getTagLib();
|
|
1706
|
-
const audioFile = await taglib.open(file);
|
|
1972
|
+
const audioFile = await taglib.open(file, options);
|
|
1707
1973
|
try {
|
|
1708
1974
|
if (!audioFile.isValid()) {
|
|
1709
1975
|
throw new InvalidFormatError(
|
|
1710
1976
|
"File may be corrupted or in an unsupported format"
|
|
1711
1977
|
);
|
|
1712
1978
|
}
|
|
1713
|
-
return fn(audioFile);
|
|
1979
|
+
return await fn(audioFile);
|
|
1714
1980
|
} finally {
|
|
1715
1981
|
audioFile.dispose();
|
|
1716
1982
|
}
|
|
@@ -1725,6 +1991,12 @@ async function withAudioFileSave(file, fn) {
|
|
|
1725
1991
|
);
|
|
1726
1992
|
}
|
|
1727
1993
|
return audioFile.getFileBuffer();
|
|
1994
|
+
}, { partial: false });
|
|
1995
|
+
}
|
|
1996
|
+
async function withAudioFileSaveToFile(file, fn) {
|
|
1997
|
+
return withAudioFile(file, async (audioFile) => {
|
|
1998
|
+
fn(audioFile);
|
|
1999
|
+
await audioFile.saveToFile(file);
|
|
1728
2000
|
});
|
|
1729
2001
|
}
|
|
1730
2002
|
|
|
@@ -1747,8 +2019,9 @@ async function applyTagsToFile(file, tags) {
|
|
|
1747
2019
|
"applyTagsToFile requires a file path string to save changes"
|
|
1748
2020
|
);
|
|
1749
2021
|
}
|
|
1750
|
-
|
|
1751
|
-
|
|
2022
|
+
await withAudioFileSaveToFile(file, (audioFile) => {
|
|
2023
|
+
mergeTagUpdates(audioFile, tags);
|
|
2024
|
+
});
|
|
1752
2025
|
}
|
|
1753
2026
|
async function readProperties(file) {
|
|
1754
2027
|
return withAudioFile(file, (audioFile) => {
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Additional audio metadata properties not covered by basic, general-extended,
|
|
3
|
+
* or specialized property files. Includes sorting extensions, identifiers,
|
|
4
|
+
* podcast metadata, original-release info, and miscellaneous properties.
|
|
5
|
+
*
|
|
6
|
+
* Wire names and format mappings sourced from TagLib's propertymapping.dox.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ADDITIONAL_PROPERTIES: {
|
|
9
|
+
readonly albumArtistSort: {
|
|
10
|
+
readonly key: "ALBUMARTISTSORT";
|
|
11
|
+
readonly description: "Sort name for album artist (for alphabetization)";
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
readonly supportedFormats: readonly ["ID3v2", "MP4", "Vorbis"];
|
|
14
|
+
readonly mappings: {
|
|
15
|
+
readonly id3v2: {
|
|
16
|
+
readonly frame: "TSO2";
|
|
17
|
+
};
|
|
18
|
+
readonly vorbis: "ALBUMARTISTSORT";
|
|
19
|
+
readonly mp4: "soaa";
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
readonly composerSort: {
|
|
23
|
+
readonly key: "COMPOSERSORT";
|
|
24
|
+
readonly description: "Sort name for composer (for alphabetization)";
|
|
25
|
+
readonly type: "string";
|
|
26
|
+
readonly supportedFormats: readonly ["ID3v2", "MP4", "Vorbis"];
|
|
27
|
+
readonly mappings: {
|
|
28
|
+
readonly id3v2: {
|
|
29
|
+
readonly frame: "TSOC";
|
|
30
|
+
};
|
|
31
|
+
readonly vorbis: "COMPOSERSORT";
|
|
32
|
+
readonly mp4: "soco";
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
readonly subtitle: {
|
|
36
|
+
readonly key: "SUBTITLE";
|
|
37
|
+
readonly description: "Subtitle or description refinement";
|
|
38
|
+
readonly type: "string";
|
|
39
|
+
readonly supportedFormats: readonly ["ID3v2", "MP4", "Vorbis"];
|
|
40
|
+
readonly mappings: {
|
|
41
|
+
readonly id3v2: {
|
|
42
|
+
readonly frame: "TIT3";
|
|
43
|
+
};
|
|
44
|
+
readonly vorbis: "SUBTITLE";
|
|
45
|
+
readonly mp4: "----:com.apple.iTunes:SUBTITLE";
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
readonly label: {
|
|
49
|
+
readonly key: "LABEL";
|
|
50
|
+
readonly description: "Record label name";
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
readonly supportedFormats: readonly ["ID3v2", "MP4", "Vorbis", "WAV"];
|
|
53
|
+
readonly mappings: {
|
|
54
|
+
readonly id3v2: {
|
|
55
|
+
readonly frame: "TPUB";
|
|
56
|
+
};
|
|
57
|
+
readonly vorbis: "LABEL";
|
|
58
|
+
readonly mp4: "----:com.apple.iTunes:LABEL";
|
|
59
|
+
readonly wav: "IPUB";
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
readonly producer: {
|
|
63
|
+
readonly key: "PRODUCER";
|
|
64
|
+
readonly description: "Producer of the recording";
|
|
65
|
+
readonly type: "string";
|
|
66
|
+
readonly supportedFormats: readonly ["ID3v2", "MP4", "Vorbis"];
|
|
67
|
+
readonly mappings: {
|
|
68
|
+
readonly id3v2: {
|
|
69
|
+
readonly frame: "TXXX";
|
|
70
|
+
readonly description: "PRODUCER";
|
|
71
|
+
};
|
|
72
|
+
readonly vorbis: "PRODUCER";
|
|
73
|
+
readonly mp4: "----:com.apple.iTunes:PRODUCER";
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
readonly radioStationOwner: {
|
|
77
|
+
readonly key: "RADIOSTATIONOWNER";
|
|
78
|
+
readonly description: "Owner of the radio station";
|
|
79
|
+
readonly type: "string";
|
|
80
|
+
readonly supportedFormats: readonly ["ID3v2"];
|
|
81
|
+
readonly mappings: {
|
|
82
|
+
readonly id3v2: {
|
|
83
|
+
readonly frame: "TRSO";
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
readonly asin: {
|
|
88
|
+
readonly key: "ASIN";
|
|
89
|
+
readonly description: "Amazon Standard Identification Number";
|
|
90
|
+
readonly type: "string";
|
|
91
|
+
readonly supportedFormats: readonly ["ID3v2", "MP4", "Vorbis"];
|
|
92
|
+
readonly mappings: {
|
|
93
|
+
readonly id3v2: {
|
|
94
|
+
readonly frame: "TXXX";
|
|
95
|
+
readonly description: "ASIN";
|
|
96
|
+
};
|
|
97
|
+
readonly vorbis: "ASIN";
|
|
98
|
+
readonly mp4: "----:com.apple.iTunes:ASIN";
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
readonly musicbrainzReleaseArtistId: {
|
|
102
|
+
readonly key: "MUSICBRAINZ_ALBUMARTISTID";
|
|
103
|
+
readonly description: "MusicBrainz Release Artist ID (UUID)";
|
|
104
|
+
readonly type: "string";
|
|
105
|
+
readonly supportedFormats: readonly ["ID3v2", "MP4", "Vorbis"];
|
|
106
|
+
readonly mappings: {
|
|
107
|
+
readonly id3v2: {
|
|
108
|
+
readonly frame: "TXXX";
|
|
109
|
+
readonly description: "MusicBrainz Album Artist Id";
|
|
110
|
+
};
|
|
111
|
+
readonly vorbis: "MUSICBRAINZ_ALBUMARTISTID";
|
|
112
|
+
readonly mp4: "----:com.apple.iTunes:MusicBrainz Album Artist Id";
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
readonly musicbrainzWorkId: {
|
|
116
|
+
readonly key: "MUSICBRAINZ_WORKID";
|
|
117
|
+
readonly description: "MusicBrainz Work ID (UUID)";
|
|
118
|
+
readonly type: "string";
|
|
119
|
+
readonly supportedFormats: readonly ["ID3v2", "MP4", "Vorbis"];
|
|
120
|
+
readonly mappings: {
|
|
121
|
+
readonly id3v2: {
|
|
122
|
+
readonly frame: "TXXX";
|
|
123
|
+
readonly description: "MusicBrainz Work Id";
|
|
124
|
+
};
|
|
125
|
+
readonly vorbis: "MUSICBRAINZ_WORKID";
|
|
126
|
+
readonly mp4: "----:com.apple.iTunes:MusicBrainz Work Id";
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
readonly musicbrainzReleaseTrackId: {
|
|
130
|
+
readonly key: "MUSICBRAINZ_RELEASETRACKID";
|
|
131
|
+
readonly description: "MusicBrainz Release Track ID (UUID)";
|
|
132
|
+
readonly type: "string";
|
|
133
|
+
readonly supportedFormats: readonly ["ID3v2", "MP4", "Vorbis"];
|
|
134
|
+
readonly mappings: {
|
|
135
|
+
readonly id3v2: {
|
|
136
|
+
readonly frame: "TXXX";
|
|
137
|
+
readonly description: "MusicBrainz Release Track Id";
|
|
138
|
+
};
|
|
139
|
+
readonly vorbis: "MUSICBRAINZ_RELEASETRACKID";
|
|
140
|
+
readonly mp4: "----:com.apple.iTunes:MusicBrainz Release Track Id";
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
readonly podcastId: {
|
|
144
|
+
readonly key: "PODCASTID";
|
|
145
|
+
readonly description: "Podcast episode identifier";
|
|
146
|
+
readonly type: "string";
|
|
147
|
+
readonly supportedFormats: readonly ["ID3v2", "MP4", "Vorbis"];
|
|
148
|
+
readonly mappings: {
|
|
149
|
+
readonly id3v2: {
|
|
150
|
+
readonly frame: "TGID";
|
|
151
|
+
};
|
|
152
|
+
readonly vorbis: "PODCASTID";
|
|
153
|
+
readonly mp4: "egid";
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
readonly podcastUrl: {
|
|
157
|
+
readonly key: "PODCASTURL";
|
|
158
|
+
readonly description: "Podcast feed URL";
|
|
159
|
+
readonly type: "string";
|
|
160
|
+
readonly supportedFormats: readonly ["ID3v2", "MP4", "Vorbis"];
|
|
161
|
+
readonly mappings: {
|
|
162
|
+
readonly id3v2: {
|
|
163
|
+
readonly frame: "WFED";
|
|
164
|
+
};
|
|
165
|
+
readonly vorbis: "PODCASTURL";
|
|
166
|
+
readonly mp4: "purl";
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
readonly originalArtist: {
|
|
170
|
+
readonly key: "ORIGINALARTIST";
|
|
171
|
+
readonly description: "Original artist of a cover or remix";
|
|
172
|
+
readonly type: "string";
|
|
173
|
+
readonly supportedFormats: readonly ["ID3v2", "Vorbis"];
|
|
174
|
+
readonly mappings: {
|
|
175
|
+
readonly id3v2: {
|
|
176
|
+
readonly frame: "TOPE";
|
|
177
|
+
};
|
|
178
|
+
readonly vorbis: "ORIGINALARTIST";
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
readonly originalAlbum: {
|
|
182
|
+
readonly key: "ORIGINALALBUM";
|
|
183
|
+
readonly description: "Original album of a cover or remix";
|
|
184
|
+
readonly type: "string";
|
|
185
|
+
readonly supportedFormats: readonly ["ID3v2", "Vorbis"];
|
|
186
|
+
readonly mappings: {
|
|
187
|
+
readonly id3v2: {
|
|
188
|
+
readonly frame: "TOAL";
|
|
189
|
+
};
|
|
190
|
+
readonly vorbis: "ORIGINALALBUM";
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
readonly originalDate: {
|
|
194
|
+
readonly key: "ORIGINALDATE";
|
|
195
|
+
readonly description: "Original release date";
|
|
196
|
+
readonly type: "string";
|
|
197
|
+
readonly supportedFormats: readonly ["ID3v2", "MP4", "Vorbis"];
|
|
198
|
+
readonly mappings: {
|
|
199
|
+
readonly id3v2: {
|
|
200
|
+
readonly frame: "TDOR";
|
|
201
|
+
};
|
|
202
|
+
readonly vorbis: "ORIGINALDATE";
|
|
203
|
+
readonly mp4: "----:com.apple.iTunes:ORIGINALDATE";
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
readonly script: {
|
|
207
|
+
readonly key: "SCRIPT";
|
|
208
|
+
readonly description: "Writing script used for text (e.g., Latn, Jpan)";
|
|
209
|
+
readonly type: "string";
|
|
210
|
+
readonly supportedFormats: readonly ["MP4", "Vorbis"];
|
|
211
|
+
readonly mappings: {
|
|
212
|
+
readonly vorbis: "SCRIPT";
|
|
213
|
+
readonly mp4: "----:com.apple.iTunes:SCRIPT";
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
readonly involvedPeople: {
|
|
217
|
+
readonly key: "INVOLVEDPEOPLE";
|
|
218
|
+
readonly description: "List of involved people and their roles";
|
|
219
|
+
readonly type: "string";
|
|
220
|
+
readonly supportedFormats: readonly ["ID3v2"];
|
|
221
|
+
readonly mappings: {
|
|
222
|
+
readonly id3v2: {
|
|
223
|
+
readonly frame: "TIPL";
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
readonly encoding: {
|
|
228
|
+
readonly key: "ENCODING";
|
|
229
|
+
readonly description: "Encoding software or settings";
|
|
230
|
+
readonly type: "string";
|
|
231
|
+
readonly supportedFormats: readonly ["ID3v2", "MP4", "Vorbis", "WAV"];
|
|
232
|
+
readonly mappings: {
|
|
233
|
+
readonly id3v2: {
|
|
234
|
+
readonly frame: "TSSE";
|
|
235
|
+
};
|
|
236
|
+
readonly vorbis: "ENCODING";
|
|
237
|
+
readonly mp4: "©too";
|
|
238
|
+
readonly wav: "ISFT";
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
//# sourceMappingURL=additional-properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"additional-properties.d.ts","sourceRoot":"","sources":["../../../src/constants/additional-properties.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwMxB,CAAC"}
|