taglib-wasm 2.2.0 → 2.2.1
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 +7 -4
- package/dist/simple.browser.js +22 -9
- package/dist/src/simple/batch-operations.d.ts +28 -11
- package/dist/src/simple/batch-operations.d.ts.map +1 -1
- package/dist/src/simple/batch-operations.js +17 -7
- package/dist/src/utils/tag-mapping.d.ts +8 -0
- package/dist/src/utils/tag-mapping.d.ts.map +1 -1
- package/dist/src/utils/tag-mapping.js +6 -3
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
package/dist/index.browser.js
CHANGED
|
@@ -2879,14 +2879,16 @@ function mapPropertiesToExtendedTag(props) {
|
|
|
2879
2879
|
}
|
|
2880
2880
|
return tag;
|
|
2881
2881
|
}
|
|
2882
|
-
function
|
|
2883
|
-
const currentProps = file.properties();
|
|
2882
|
+
function mergeTagUpdatesInto(currentProps, tags) {
|
|
2884
2883
|
const newProps = normalizeTagInput(tags);
|
|
2885
2884
|
reconcilePairFields(currentProps, newProps, tags);
|
|
2886
2885
|
if (newProps.date !== void 0 || newProps.year !== void 0) {
|
|
2887
2886
|
currentProps.YEAR = [];
|
|
2888
2887
|
}
|
|
2889
|
-
|
|
2888
|
+
return { ...currentProps, ...newProps };
|
|
2889
|
+
}
|
|
2890
|
+
function mergeTagUpdates(file, tags) {
|
|
2891
|
+
file.setProperties(mergeTagUpdatesInto(file.properties(), tags));
|
|
2890
2892
|
}
|
|
2891
2893
|
function reconcilePairFields(currentProps, newProps, input) {
|
|
2892
2894
|
const pairs = [
|
|
@@ -3002,7 +3004,7 @@ var VERSION;
|
|
|
3002
3004
|
var init_version = __esm({
|
|
3003
3005
|
"src/version.ts"() {
|
|
3004
3006
|
"use strict";
|
|
3005
|
-
VERSION = "2.2.
|
|
3007
|
+
VERSION = "2.2.1";
|
|
3006
3008
|
}
|
|
3007
3009
|
});
|
|
3008
3010
|
|
|
@@ -3492,6 +3494,7 @@ async function readPictureMetadata(file) {
|
|
|
3492
3494
|
// src/simple/batch-operations.ts
|
|
3493
3495
|
init_audio_formats();
|
|
3494
3496
|
init_errors2();
|
|
3497
|
+
init_properties();
|
|
3495
3498
|
init_tag_mapping();
|
|
3496
3499
|
async function executeBatch(files, options, processor) {
|
|
3497
3500
|
if (files.length === 0) return { items: [], duration: 0 };
|
package/dist/simple.browser.js
CHANGED
|
@@ -2811,14 +2811,16 @@ function mapPropertiesToExtendedTag(props) {
|
|
|
2811
2811
|
}
|
|
2812
2812
|
return tag;
|
|
2813
2813
|
}
|
|
2814
|
-
function
|
|
2815
|
-
const currentProps = file.properties();
|
|
2814
|
+
function mergeTagUpdatesInto(currentProps, tags) {
|
|
2816
2815
|
const newProps = normalizeTagInput(tags);
|
|
2817
2816
|
reconcilePairFields(currentProps, newProps, tags);
|
|
2818
2817
|
if (newProps.date !== void 0 || newProps.year !== void 0) {
|
|
2819
2818
|
currentProps.YEAR = [];
|
|
2820
2819
|
}
|
|
2821
|
-
|
|
2820
|
+
return { ...currentProps, ...newProps };
|
|
2821
|
+
}
|
|
2822
|
+
function mergeTagUpdates(file, tags) {
|
|
2823
|
+
file.setProperties(mergeTagUpdatesInto(file.properties(), tags));
|
|
2822
2824
|
}
|
|
2823
2825
|
function reconcilePairFields(currentProps, newProps, input) {
|
|
2824
2826
|
const pairs = [
|
|
@@ -2934,7 +2936,7 @@ var VERSION;
|
|
|
2934
2936
|
var init_version = __esm({
|
|
2935
2937
|
"src/version.ts"() {
|
|
2936
2938
|
"use strict";
|
|
2937
|
-
VERSION = "2.2.
|
|
2939
|
+
VERSION = "2.2.1";
|
|
2938
2940
|
}
|
|
2939
2941
|
});
|
|
2940
2942
|
|
|
@@ -3418,6 +3420,7 @@ async function readPictureMetadata(file) {
|
|
|
3418
3420
|
// src/simple/batch-operations.ts
|
|
3419
3421
|
init_audio_formats();
|
|
3420
3422
|
init_errors2();
|
|
3423
|
+
init_properties();
|
|
3421
3424
|
init_tag_mapping();
|
|
3422
3425
|
async function executeBatch(files, options, processor) {
|
|
3423
3426
|
if (files.length === 0) return { items: [], duration: 0 };
|
|
@@ -3569,16 +3572,26 @@ async function executeWriteBatch(entries, options, writer) {
|
|
|
3569
3572
|
}
|
|
3570
3573
|
async function writeTagsBatch(updates, options = {}) {
|
|
3571
3574
|
const byPath = new Map(updates.map((u) => [u.path, u]));
|
|
3572
|
-
return executeWriteBatch(
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3575
|
+
return executeWriteBatch(
|
|
3576
|
+
updates,
|
|
3577
|
+
options,
|
|
3578
|
+
(path) => withAudioFileSaveToFile(path, (audioFile) => {
|
|
3579
|
+
const update = byPath.get(path);
|
|
3580
|
+
const merged = update.tags !== void 0 ? mergeTagUpdatesInto(audioFile.properties(), update.tags) : audioFile.properties();
|
|
3581
|
+
if (update.properties !== void 0) {
|
|
3582
|
+
for (const [key, values] of Object.entries(update.properties)) {
|
|
3583
|
+
merged[fromTagLibKey(key)] = values;
|
|
3584
|
+
}
|
|
3585
|
+
}
|
|
3586
|
+
audioFile.setProperties(merged);
|
|
3587
|
+
})
|
|
3588
|
+
);
|
|
3576
3589
|
}
|
|
3577
3590
|
async function editTagsBatch(files, mutator, options = {}) {
|
|
3578
3591
|
return executeWriteBatch(
|
|
3579
3592
|
files,
|
|
3580
3593
|
options,
|
|
3581
|
-
(path) => withAudioFileSaveToFile(path, mutator)
|
|
3594
|
+
(path) => withAudioFileSaveToFile(path, (audioFile) => mutator(audioFile, path))
|
|
3582
3595
|
);
|
|
3583
3596
|
}
|
|
3584
3597
|
|
|
@@ -82,19 +82,33 @@ export interface WriteTagUpdate {
|
|
|
82
82
|
/** File path on disk; the file is updated in place. */
|
|
83
83
|
path: string;
|
|
84
84
|
/**
|
|
85
|
-
* Partial tag fields to merge with the file's existing metadata. An
|
|
86
|
-
* object performs a save with no tag changes (a no-op rewrite).
|
|
85
|
+
* Partial typed tag fields to merge with the file's existing metadata. An
|
|
86
|
+
* empty object performs a save with no tag changes (a no-op rewrite).
|
|
87
87
|
*/
|
|
88
|
-
tags
|
|
88
|
+
tags?: Partial<TagInput>;
|
|
89
|
+
/**
|
|
90
|
+
* Raw WIRE-key map, merged verbatim — the same shape and rule as the Full
|
|
91
|
+
* API's `setProperties` (taglib-pmhp review): keys outside the typed
|
|
92
|
+
* TagInput surface (barcode, unmodeled TXXX fields) ride here, and an
|
|
93
|
+
* EMPTY ARRAY removes the key (the qyw2/nc5 clearing contract; no
|
|
94
|
+
* empty-string carrier). Applied in the same single save as `tags`;
|
|
95
|
+
* entries here take precedence over `tags` for the same normalized key.
|
|
96
|
+
* Writes are verbatim: unlike the typed `tags` channel (which clears the
|
|
97
|
+
* legacy YEAR field when DATE is set), a raw `properties` write does not
|
|
98
|
+
* reconcile related keys — exactly like the Full API's `setProperties`.
|
|
99
|
+
*/
|
|
100
|
+
properties?: Record<string, string[]>;
|
|
89
101
|
}
|
|
90
102
|
/**
|
|
91
103
|
* Apply tag updates to multiple files with configurable concurrency.
|
|
92
104
|
*
|
|
93
105
|
* The batch write counterpart to {@link readTagsBatch}: same
|
|
94
106
|
* {@link BatchOptions} contract (concurrency, continueOnError, onProgress,
|
|
95
|
-
* signal). Each file is updated via
|
|
96
|
-
* {@link
|
|
97
|
-
*
|
|
107
|
+
* signal). Each file is updated in ONE save via a single `setProperties`
|
|
108
|
+
* fold: the typed `tags` merge ({@link mergeTagUpdatesInto} — the same
|
|
109
|
+
* semantics as {@link applyTagsToFile}) plus the raw wire-key `properties`
|
|
110
|
+
* entries. Atomic temp-file save, so a failed file is left in its pre-write
|
|
111
|
+
* state.
|
|
98
112
|
*
|
|
99
113
|
* @param updates - Per-file tag updates; a path may appear more than once
|
|
100
114
|
* (the last update for a path wins).
|
|
@@ -108,16 +122,19 @@ export declare function writeTagsBatch(updates: WriteTagUpdate[], options?: Batc
|
|
|
108
122
|
* Open, mutate, and save multiple files with configurable concurrency.
|
|
109
123
|
*
|
|
110
124
|
* Mutator-callback variant of {@link writeTagsBatch}: the callback receives
|
|
111
|
-
* the open {@link AudioFile} (Full-API style)
|
|
112
|
-
*
|
|
125
|
+
* the open {@link AudioFile} (Full-API style) plus the `path` it was opened
|
|
126
|
+
* from — the pair is a per-invocation contract, so precomputed per-path
|
|
127
|
+
* plans can be looked up without relying on invocation order (taglib-pmhp
|
|
128
|
+
* review). A one-argument mutator keeps working. Changes are saved per file;
|
|
129
|
+
* same {@link BatchOptions} contract and atomicity guarantees.
|
|
113
130
|
*
|
|
114
131
|
* @param files - File paths on disk, updated in place.
|
|
115
|
-
* @param mutator - Called once per file with the open audio file
|
|
116
|
-
* saved automatically.
|
|
132
|
+
* @param mutator - Called once per file with the open audio file and its
|
|
133
|
+
* path; changes are saved automatically.
|
|
117
134
|
* @param options - Batch processing options (concurrency, error handling,
|
|
118
135
|
* progress, abort).
|
|
119
136
|
* @returns A `BatchItem` per file in input order plus total duration in ms.
|
|
120
137
|
* @throws If `continueOnError` is `false` and any file fails to process.
|
|
121
138
|
*/
|
|
122
|
-
export declare function editTagsBatch(files: string[], mutator: (audioFile: AudioFile) => void, options?: BatchOptions): Promise<BatchResult<void>>;
|
|
139
|
+
export declare function editTagsBatch(files: string[], mutator: (audioFile: AudioFile, path: string) => void, options?: BatchOptions): Promise<BatchResult<void>>;
|
|
123
140
|
//# sourceMappingURL=batch-operations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-operations.d.ts","sourceRoot":"","sources":["../../../src/simple/batch-operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,WAAW,EACX,QAAQ,EACT,MAAM,aAAa,CAAC;AAQrB,qDAAqD;AACrD,MAAM,WAAW,YAAY;IAC3B,WAAW,CAA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G;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACvC;AAsDD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,cAAc,EAAE,EACzB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAwB5B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,EACrD,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAO5B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isNamedAudioInput } from "../types/audio-formats.js";
|
|
2
2
|
import { InvalidFormatError } from "../errors.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { fromTagLibKey } from "../constants/properties.js";
|
|
4
|
+
import { mergeTagUpdatesInto, readExtendedTag } from "../utils/tag-mapping.js";
|
|
5
5
|
import { withAudioFileSaveToFile } from "./with-audio-file.js";
|
|
6
6
|
import { getTagLib } from "./config.js";
|
|
7
7
|
async function executeBatch(files, options, processor) {
|
|
@@ -154,16 +154,26 @@ async function executeWriteBatch(entries, options, writer) {
|
|
|
154
154
|
}
|
|
155
155
|
async function writeTagsBatch(updates, options = {}) {
|
|
156
156
|
const byPath = new Map(updates.map((u) => [u.path, u]));
|
|
157
|
-
return executeWriteBatch(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
return executeWriteBatch(
|
|
158
|
+
updates,
|
|
159
|
+
options,
|
|
160
|
+
(path) => withAudioFileSaveToFile(path, (audioFile) => {
|
|
161
|
+
const update = byPath.get(path);
|
|
162
|
+
const merged = update.tags !== void 0 ? mergeTagUpdatesInto(audioFile.properties(), update.tags) : audioFile.properties();
|
|
163
|
+
if (update.properties !== void 0) {
|
|
164
|
+
for (const [key, values] of Object.entries(update.properties)) {
|
|
165
|
+
merged[fromTagLibKey(key)] = values;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
audioFile.setProperties(merged);
|
|
169
|
+
})
|
|
170
|
+
);
|
|
161
171
|
}
|
|
162
172
|
async function editTagsBatch(files, mutator, options = {}) {
|
|
163
173
|
return executeWriteBatch(
|
|
164
174
|
files,
|
|
165
175
|
options,
|
|
166
|
-
(path) => withAudioFileSaveToFile(path, mutator)
|
|
176
|
+
(path) => withAudioFileSaveToFile(path, (audioFile) => mutator(audioFile, path))
|
|
167
177
|
);
|
|
168
178
|
}
|
|
169
179
|
export {
|
|
@@ -10,6 +10,14 @@ import type { ExtendedTag, PropertyMap, TagInput } from "../types.js";
|
|
|
10
10
|
*/
|
|
11
11
|
export declare function readExtendedTag(audioFile: AudioFile, includeProperties?: string[]): ExtendedTag;
|
|
12
12
|
export declare function mapPropertiesToExtendedTag(props: PropertyMap): ExtendedTag;
|
|
13
|
+
/**
|
|
14
|
+
* Pure read-modify-write merge of typed tag input into an existing property
|
|
15
|
+
* map, WITHOUT touching the file. Shared by {@link mergeTagUpdates} (the
|
|
16
|
+
* single-file path) and the batch writer, which must fold raw wire-key
|
|
17
|
+
* entries and removals into the SAME map so one `setProperties` call reaches
|
|
18
|
+
* the replace-style Emscripten backend (taglib-pmhp review).
|
|
19
|
+
*/
|
|
20
|
+
export declare function mergeTagUpdatesInto(currentProps: PropertyMap, tags: Partial<TagInput>): PropertyMap;
|
|
13
21
|
export declare function mergeTagUpdates(file: AudioFile, tags: Partial<TagInput>): void;
|
|
14
22
|
export declare function normalizeTagInput(input: Partial<TagInput>): PropertyMap;
|
|
15
23
|
//# sourceMappingURL=tag-mapping.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag-mapping.d.ts","sourceRoot":"","sources":["../../../src/utils/tag-mapping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAqCtE;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,SAAS,EACpB,iBAAiB,CAAC,EAAE,MAAM,EAAE,GAC3B,WAAW,CA2Cb;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAiG1E;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GACtB,IAAI,
|
|
1
|
+
{"version":3,"file":"tag-mapping.d.ts","sourceRoot":"","sources":["../../../src/utils/tag-mapping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAqCtE;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,SAAS,EACpB,iBAAiB,CAAC,EAAE,MAAM,EAAE,GAC3B,WAAW,CA2Cb;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAiG1E;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,WAAW,EACzB,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GACtB,WAAW,CAYb;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GACtB,IAAI,CAEN;AAoDD,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,GACvB,WAAW,CA+Eb"}
|
|
@@ -120,14 +120,16 @@ function mapPropertiesToExtendedTag(props) {
|
|
|
120
120
|
}
|
|
121
121
|
return tag;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
const currentProps = file.properties();
|
|
123
|
+
function mergeTagUpdatesInto(currentProps, tags) {
|
|
125
124
|
const newProps = normalizeTagInput(tags);
|
|
126
125
|
reconcilePairFields(currentProps, newProps, tags);
|
|
127
126
|
if (newProps.date !== void 0 || newProps.year !== void 0) {
|
|
128
127
|
currentProps.YEAR = [];
|
|
129
128
|
}
|
|
130
|
-
|
|
129
|
+
return { ...currentProps, ...newProps };
|
|
130
|
+
}
|
|
131
|
+
function mergeTagUpdates(file, tags) {
|
|
132
|
+
file.setProperties(mergeTagUpdatesInto(file.properties(), tags));
|
|
131
133
|
}
|
|
132
134
|
function reconcilePairFields(currentProps, newProps, input) {
|
|
133
135
|
const pairs = [
|
|
@@ -204,6 +206,7 @@ function normalizeTagInput(input) {
|
|
|
204
206
|
export {
|
|
205
207
|
mapPropertiesToExtendedTag,
|
|
206
208
|
mergeTagUpdates,
|
|
209
|
+
mergeTagUpdatesInto,
|
|
207
210
|
normalizeTagInput,
|
|
208
211
|
readExtendedTag
|
|
209
212
|
};
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.2.
|
|
1
|
+
export declare const VERSION = "2.2.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/src/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taglib-wasm",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "TagLib-Wasm is the universal tagging library for TypeScript/JavaScript platforms: Browsers, Node.js, Deno, Bun, Cloudflare Workers, and Electron apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|