taglib-wasm 2.0.0 → 2.2.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.d.ts +1 -1
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +64 -12
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -5
- package/dist/simple.browser.js +105 -13
- package/dist/src/constants/properties.d.ts +14 -0
- package/dist/src/constants/properties.d.ts.map +1 -1
- package/dist/src/constants/specialized-properties.d.ts +14 -0
- package/dist/src/constants/specialized-properties.d.ts.map +1 -1
- package/dist/src/constants/specialized-properties.js +22 -0
- package/dist/src/constants/utilities.d.ts +13 -0
- package/dist/src/constants/utilities.d.ts.map +1 -1
- package/dist/src/constants/utilities.js +9 -1
- package/dist/src/folder-api/folder-operations.d.ts +2 -30
- package/dist/src/folder-api/folder-operations.d.ts.map +1 -1
- package/dist/src/folder-api/folder-operations.js +1 -36
- package/dist/src/folder-api/index.d.ts +2 -2
- package/dist/src/folder-api/index.d.ts.map +1 -1
- package/dist/src/folder-api/index.js +2 -7
- package/dist/src/folder-api/types.d.ts +0 -21
- package/dist/src/folder-api/types.d.ts.map +1 -1
- package/dist/src/folder-api/types.js +1 -13
- package/dist/src/msgpack/decoder.d.ts +2 -2
- package/dist/src/msgpack/decoder.d.ts.map +1 -1
- package/dist/src/msgpack/encoder.js +5 -3
- package/dist/src/msgpack/index.d.ts +1 -1
- package/dist/src/msgpack/index.d.ts.map +1 -1
- package/dist/src/msgpack/types.d.ts +10 -0
- package/dist/src/msgpack/types.d.ts.map +1 -1
- package/dist/src/msgpack/utils.d.ts +2 -1
- package/dist/src/msgpack/utils.d.ts.map +1 -1
- package/dist/src/runtime/module-loader-browser.d.ts.map +1 -1
- package/dist/src/runtime/platform-io.js +1 -1
- package/dist/src/runtime/unified-loader/module-loading.d.ts.map +1 -1
- package/dist/src/runtime/unified-loader/module-loading.js +1 -1
- package/dist/src/runtime/wasi-adapter/file-handle.d.ts.map +1 -1
- package/dist/src/runtime/wasi-adapter/file-handle.js +12 -3
- package/dist/src/runtime/wasi-fs-deno.d.ts.map +1 -1
- package/dist/src/runtime/wasi-fs-deno.js +1 -1
- package/dist/src/simple/batch-operations.d.ts +57 -2
- package/dist/src/simple/batch-operations.d.ts.map +1 -1
- package/dist/src/simple/batch-operations.js +55 -5
- package/dist/src/simple/index.d.ts +2 -2
- package/dist/src/simple/index.d.ts.map +1 -1
- package/dist/src/simple/index.js +6 -2
- package/dist/src/simple/tag-operations.d.ts +5 -1
- package/dist/src/simple/tag-operations.d.ts.map +1 -1
- package/dist/src/simple/tag-operations.js +5 -2
- package/dist/src/taglib/embind-adapter.d.ts.map +1 -1
- package/dist/src/types/metadata-mappings.d.ts +1 -1
- package/dist/src/types/metadata-mappings.d.ts.map +1 -1
- package/dist/src/types/metadata-mappings.js +5 -0
- package/dist/src/types/tags.d.ts +13 -0
- package/dist/src/types/tags.d.ts.map +1 -1
- package/dist/src/utils/mirror-fields.d.ts +2 -0
- package/dist/src/utils/mirror-fields.d.ts.map +1 -1
- package/dist/src/utils/mirror-fields.js +11 -3
- package/dist/src/utils/node-fs.d.ts +10 -10
- package/dist/src/utils/node-fs.d.ts.map +1 -1
- package/dist/src/utils/node-fs.js +2 -1
- package/dist/src/utils/tag-mapping.d.ts +1 -1
- package/dist/src/utils/tag-mapping.d.ts.map +1 -1
- package/dist/src/utils/tag-mapping.js +17 -3
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/taglib-wasi.wasm +0 -0
- package/dist/taglib-web.wasm +0 -0
- package/dist/taglib-wrapper.js +1 -1
- package/package.json +6 -6
|
@@ -1,35 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Folder-level operations:
|
|
2
|
+
* Folder-level operations: duplicates, metadata export
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
5
|
-
import type { DuplicateGroup, FolderScanOptions, FolderUpdateResult } from "./types.js";
|
|
6
|
-
/**
|
|
7
|
-
* Update metadata for multiple files in a folder
|
|
8
|
-
*
|
|
9
|
-
* @param updates - Array of objects containing path and tags to update
|
|
10
|
-
* @param options - Update options
|
|
11
|
-
* @returns Results of the update operation
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* const updates = [
|
|
16
|
-
* { path: "/music/song1.mp3", tags: { artist: "New Artist" } },
|
|
17
|
-
* { path: "/music/song2.mp3", tags: { album: "New Album" } }
|
|
18
|
-
* ];
|
|
19
|
-
*
|
|
20
|
-
* const result = await updateFolderTags(updates);
|
|
21
|
-
* const updated = result.items.filter((i) => i.status === "ok").length;
|
|
22
|
-
* console.log(`Updated ${updated} files`);
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare function updateFolderTags(updates: Array<{
|
|
26
|
-
path: string;
|
|
27
|
-
tags: Partial<TagInput>;
|
|
28
|
-
}>, options?: {
|
|
29
|
-
continueOnError?: boolean;
|
|
30
|
-
concurrency?: number;
|
|
31
|
-
signal?: AbortSignal;
|
|
32
|
-
}): Promise<FolderUpdateResult>;
|
|
4
|
+
import type { DuplicateGroup, FolderScanOptions } from "./types.js";
|
|
33
5
|
/**
|
|
34
6
|
* Find duplicate audio files based on metadata
|
|
35
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"folder-operations.d.ts","sourceRoot":"","sources":["../../../src/folder-api/folder-operations.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"folder-operations.d.ts","sourceRoot":"","sources":["../../../src/folder-api/folder-operations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAEV,cAAc,EACd,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAiBpB;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,cAAc,EAAE,CAAC,CAuB3B;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAoBf"}
|
|
@@ -1,39 +1,5 @@
|
|
|
1
|
-
import { applyTagsToFile } from "../simple/index.js";
|
|
2
1
|
import { writeFileData } from "../utils/write.js";
|
|
3
|
-
import { processBatch } from "./file-processors.js";
|
|
4
2
|
import { scanFolder } from "./scan-operations.js";
|
|
5
|
-
import { EMPTY_TAG } from "./types.js";
|
|
6
|
-
async function updateFolderTags(updates, options = {}) {
|
|
7
|
-
const startTime = Date.now();
|
|
8
|
-
const { continueOnError = true, concurrency = 4, signal } = options;
|
|
9
|
-
const items = [];
|
|
10
|
-
const batchSize = concurrency * 10;
|
|
11
|
-
for (let i = 0; i < updates.length; i += batchSize) {
|
|
12
|
-
signal?.throwIfAborted();
|
|
13
|
-
const batch = updates.slice(i, Math.min(i + batchSize, updates.length));
|
|
14
|
-
const updateMap = new Map(batch.map((u) => [u.path, u]));
|
|
15
|
-
await processBatch(
|
|
16
|
-
batch.map((u) => u.path),
|
|
17
|
-
async (path) => {
|
|
18
|
-
const update = updateMap.get(path);
|
|
19
|
-
try {
|
|
20
|
-
await applyTagsToFile(update.path, update.tags);
|
|
21
|
-
items.push({ status: "ok", path: update.path });
|
|
22
|
-
} catch (error) {
|
|
23
|
-
const err = error instanceof Error ? error : new Error(String(error));
|
|
24
|
-
if (continueOnError) {
|
|
25
|
-
items.push({ status: "error", path: update.path, error: err });
|
|
26
|
-
} else {
|
|
27
|
-
throw err;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return { path, tags: EMPTY_TAG };
|
|
31
|
-
},
|
|
32
|
-
concurrency
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
return { items, duration: Date.now() - startTime };
|
|
36
|
-
}
|
|
37
3
|
function buildCriteriaKey(tags, criteria) {
|
|
38
4
|
const record = {};
|
|
39
5
|
for (const field of criteria) {
|
|
@@ -84,6 +50,5 @@ async function exportFolderMetadata(folderPath, outputPath, options) {
|
|
|
84
50
|
}
|
|
85
51
|
export {
|
|
86
52
|
exportFolderMetadata,
|
|
87
|
-
findDuplicates
|
|
88
|
-
updateFolderTags
|
|
53
|
+
findDuplicates
|
|
89
54
|
};
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Batch folder operations for TagLib-Wasm
|
|
3
3
|
* Provides APIs for scanning directories and processing multiple audio files
|
|
4
4
|
*/
|
|
5
|
-
export type { AudioDynamics, AudioFileMetadata, DuplicateGroup, FolderScanItem, FolderScanOptions, FolderScanResult,
|
|
5
|
+
export type { AudioDynamics, AudioFileMetadata, DuplicateGroup, FolderScanItem, FolderScanOptions, FolderScanResult, } from "./types.js";
|
|
6
6
|
export { scanFolder } from "./scan-operations.js";
|
|
7
|
-
export { exportFolderMetadata, findDuplicates
|
|
7
|
+
export { exportFolderMetadata, findDuplicates } from "./folder-operations.js";
|
|
8
8
|
export { type AlbumDisc, type AlbumGroup, type AlbumGroupingResult, type AlbumGroupItem, type AlbumGroupKey, type DiscConfidence, type DiscFolderInfo, discFolderInfo, groupAlbums, type GroupAlbumsOptions, } from "./group-albums.js";
|
|
9
9
|
export { scanForAlbums, type ScanForAlbumsOptions } from "./scan-for-albums.js";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/folder-api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/folder-api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE9E,OAAO,EACL,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,cAAc,EACd,WAAW,EACX,KAAK,kBAAkB,GACxB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { scanFolder } from "./scan-operations.js";
|
|
2
|
-
import {
|
|
3
|
-
exportFolderMetadata,
|
|
4
|
-
findDuplicates,
|
|
5
|
-
updateFolderTags
|
|
6
|
-
} from "./folder-operations.js";
|
|
2
|
+
import { exportFolderMetadata, findDuplicates } from "./folder-operations.js";
|
|
7
3
|
import {
|
|
8
4
|
discFolderInfo,
|
|
9
5
|
groupAlbums
|
|
@@ -15,6 +11,5 @@ export {
|
|
|
15
11
|
findDuplicates,
|
|
16
12
|
groupAlbums,
|
|
17
13
|
scanFolder,
|
|
18
|
-
scanForAlbums
|
|
19
|
-
updateFolderTags
|
|
14
|
+
scanForAlbums
|
|
20
15
|
};
|
|
@@ -4,15 +4,6 @@
|
|
|
4
4
|
import type { ExtendedTag, Tag, TagInput } from "../simple/index.js";
|
|
5
5
|
import type { AudioProperties } from "../types.js";
|
|
6
6
|
export type { AudioProperties, ExtendedTag, Tag, TagInput };
|
|
7
|
-
export declare const EMPTY_TAG: Readonly<{
|
|
8
|
-
title: never[];
|
|
9
|
-
artist: never[];
|
|
10
|
-
album: never[];
|
|
11
|
-
comment: never[];
|
|
12
|
-
genre: never[];
|
|
13
|
-
year: number;
|
|
14
|
-
track: number;
|
|
15
|
-
}>;
|
|
16
7
|
export declare const DEFAULT_AUDIO_EXTENSIONS: string[];
|
|
17
8
|
/**
|
|
18
9
|
* Audio dynamics data (ReplayGain and Apple Sound Check)
|
|
@@ -87,18 +78,6 @@ export interface FolderScanResult {
|
|
|
87
78
|
/** Time taken in milliseconds */
|
|
88
79
|
duration: number;
|
|
89
80
|
}
|
|
90
|
-
export type FolderUpdateItem = {
|
|
91
|
-
status: "ok";
|
|
92
|
-
path: string;
|
|
93
|
-
} | {
|
|
94
|
-
status: "error";
|
|
95
|
-
path: string;
|
|
96
|
-
error: Error;
|
|
97
|
-
};
|
|
98
|
-
export interface FolderUpdateResult {
|
|
99
|
-
items: FolderUpdateItem[];
|
|
100
|
-
duration: number;
|
|
101
|
-
}
|
|
102
81
|
export interface DuplicateGroup {
|
|
103
82
|
criteria: Record<string, string>;
|
|
104
83
|
files: AudioFileMetadata[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/folder-api/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AAE5D,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/folder-api/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,GAAG,EAA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ACtB;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GACtB,CAAC;IAAE,MAAM,EAAE,IAAI,CAAA;CAAE,GAAG,iBAAiB,CAAC,GACtC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAEpD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sDAAsD;IACtD,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,KAAK,EAAE,iBAAiB,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7E,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB"}
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
const EMPTY_TAG = Object.freeze(
|
|
2
|
-
{
|
|
3
|
-
title: [],
|
|
4
|
-
artist: [],
|
|
5
|
-
album: [],
|
|
6
|
-
comment: [],
|
|
7
|
-
genre: [],
|
|
8
|
-
year: 0,
|
|
9
|
-
track: 0
|
|
10
|
-
}
|
|
11
|
-
);
|
|
12
1
|
const DEFAULT_AUDIO_EXTENSIONS = [
|
|
13
2
|
".mp3",
|
|
14
3
|
".m4a",
|
|
@@ -28,6 +17,5 @@ const DEFAULT_AUDIO_EXTENSIONS = [
|
|
|
28
17
|
".webm"
|
|
29
18
|
];
|
|
30
19
|
export {
|
|
31
|
-
DEFAULT_AUDIO_EXTENSIONS
|
|
32
|
-
EMPTY_TAG
|
|
20
|
+
DEFAULT_AUDIO_EXTENSIONS
|
|
33
21
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** MessagePack decoder — converts binary MessagePack from the C API to JS objects. */
|
|
2
2
|
import { type DecoderOptions } from "@msgpack/msgpack";
|
|
3
3
|
import type { AudioProperties, ExtendedTag, Picture, PropertyMap } from "../types.js";
|
|
4
|
-
import type { MessagePackDataType } from "./types.js";
|
|
5
|
-
export declare function decodeTagData(msgpackBuffer: Uint8Array):
|
|
4
|
+
import type { MessagePackDataType, RawTagData } from "./types.js";
|
|
5
|
+
export declare function decodeTagData(msgpackBuffer: Uint8Array): RawTagData;
|
|
6
6
|
export declare function decodeAudioProperties(msgpackBuffer: Uint8Array): AudioProperties;
|
|
7
7
|
export declare function decodePropertyMap(msgpackBuffer: Uint8Array): PropertyMap;
|
|
8
8
|
export declare function decodePicture(msgpackBuffer: Uint8Array): Picture;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decoder.d.ts","sourceRoot":"","sources":["../../../src/msgpack/decoder.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE/D,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,OAAO,EACP,WAAW,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"decoder.d.ts","sourceRoot":"","sources":["../../../src/msgpack/decoder.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE/D,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,OAAO,EACP,WAAW,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAYlE,wBAAgB,aAAa,CAAC,aAAa,EAAE,UAAU,GAAG,UAAU,CAanE;AAED,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,UAAU,GACxB,eAAe,CAiBjB;AAED,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,UAAU,GAAG,WAAW,CASxE;AAED,wBAAgB,aAAa,CAAC,aAAa,EAAE,UAAU,GAAG,OAAO,CAWhE;AAED,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,UAAU,GAAG,OAAO,EAAE,CAavE;AAED,wBAAgB,iBAAiB,CAAC,CAAC,GAAG,OAAO,EAC3C,aAAa,EAAE,UAAU,EACzB,OAAO,GAAE,OAAO,CAAC,cAAc,CAAM,GACpC,CAAC,CAUH;AA2BD,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,UAAU,GACxB,WAAW,GAAG,eAAe,GAAG,OAAO,GAAG,WAAW,CAiCvD;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAc9D;AAaD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG;IACtD,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,mBAAmB,CAAC;CAC3B,CAuBA;AAED,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,UAAU,GACxB,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAqBpE"}
|
|
@@ -27,9 +27,11 @@ const MSGPACK_ENCODE_OPTIONS = {
|
|
|
27
27
|
};
|
|
28
28
|
function lyricsTexts(value) {
|
|
29
29
|
const entries = Array.isArray(value) ? value : [value];
|
|
30
|
-
return entries.map(
|
|
31
|
-
(
|
|
32
|
-
|
|
30
|
+
return entries.map((entry) => {
|
|
31
|
+
if (typeof entry === "string") return entry;
|
|
32
|
+
const text = entry?.text;
|
|
33
|
+
return typeof text === "string" ? text : "";
|
|
34
|
+
}).filter((text) => text !== "");
|
|
33
35
|
}
|
|
34
36
|
function encodeTagData(tagData) {
|
|
35
37
|
try {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
export { decodeAudioProperties, decodeFastTagData, decodeMessagePack, decodeMessagePackAuto, decodePicture, decodePictureArray, decodePropertyMap, decodeTagData, getMessagePackInfo, isValidMessagePack, } from "./decoder.js";
|
|
23
23
|
export { canEncodeToMessagePack, compareEncodingEfficiency, encodeAudioProperties, encodeBatchTagData, encodeFastTagData, encodeMessagePack, encodeMessagePackCompact, encodeMessagePackStream, encodePicture, encodePictureArray, encodePropertyMap, encodeTagData, estimateMessagePackSize, } from "./encoder.js";
|
|
24
|
-
export type { AutoDetectionConfig, AutoDetectionResult, BatchProcessingResult, DecodingResult, EncodingResult, FormatComparison, FormatVersion, MessagePackCompatible, MessagePackData, MessagePackDataType, MessagePackError, MessagePackErrorInfo, MessagePackMetrics, MessagePackValue, StreamingConfig, TagLibMessagePackData, TagLibMessagePackMarker, ValidationResult, } from "./types.js";
|
|
24
|
+
export type { AutoDetectionConfig, AutoDetectionResult, BatchProcessingResult, DecodingResult, EncodingResult, FormatComparison, FormatVersion, MessagePackCompatible, MessagePackData, MessagePackDataType, MessagePackError, MessagePackErrorInfo, MessagePackMetrics, MessagePackValue, RawTagData, StreamingConfig, TagLibMessagePackData, TagLibMessagePackMarker, ValidationResult, } from "./types.js";
|
|
25
25
|
export { TAGLIB_MSGPACK_MARKERS } from "./types.js";
|
|
26
26
|
export { MessagePackUtils } from "./utils.js";
|
|
27
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/msgpack/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,EACvB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/msgpack/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,EACvB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -113,4 +113,14 @@ export interface AutoDetectionResult {
|
|
|
113
113
|
}>;
|
|
114
114
|
detectionClues: string[];
|
|
115
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* The raw tag-data shape decoded from the C++ MessagePack snapshot: wire
|
|
118
|
+
* values, not the typed surface. Property values are canonical strings —
|
|
119
|
+
* boolean-typed keys (COMPILATION) decode as "1"/"0" (taglib-c9b), numbers
|
|
120
|
+
* stay verbatim strings ("03", "3/12"). Audio-info booleans and nested maps
|
|
121
|
+
* (id3Tags {v1, v2}) keep their native shapes.
|
|
122
|
+
*/
|
|
123
|
+
export type RawTagData = Record<string, unknown> & {
|
|
124
|
+
compilation?: "1" | "0";
|
|
125
|
+
};
|
|
116
126
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/msgpack/types.ts"],"names":[],"mappings":"AAAA,qEAAqE;AAErE,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC;AAEzC,MAAM,MAAM,gBAAgB,GACxB,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,UAAU,GACV,gBAAgB,EAAE,GAClB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAA;CAAE,CAAC;AAExC,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,OAAO;IACzC,IAAI,EA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zB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview High-level MessagePack utilities for common TagLib-Wasm operations
|
|
3
3
|
*/
|
|
4
|
+
import type { RawTagData } from "./types.js";
|
|
4
5
|
import type { AudioProperties, ExtendedTag, Picture, PropertyMap } from "../types.js";
|
|
5
6
|
/**
|
|
6
7
|
* High-level MessagePack utilities for common TagLib-Wasm operations
|
|
@@ -13,7 +14,7 @@ export declare class MessagePackUtils {
|
|
|
13
14
|
/**
|
|
14
15
|
* Validate and decode tag data with error handling
|
|
15
16
|
*/
|
|
16
|
-
static safeDecodeTagData(buffer: Uint8Array):
|
|
17
|
+
static safeDecodeTagData(buffer: Uint8Array): RawTagData | null;
|
|
17
18
|
/**
|
|
18
19
|
* Validate and decode audio properties with error handling
|
|
19
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/msgpack/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,OAAO,EACP,WAAW,EACZ,MAAM,aAAa,CAAC;AAYrB;;GAEG;AACH,qBAAa,gBAAgB;IAC3B;;OAEG;IACH,MAAM,CAAC,MAAM,CACX,MAAM,EAAE,UAAU,GACjB,WAAW,GAAG,eAAe,GAAG,OAAO,GAAG,WAAW;IAIxD;;OAEG;IACH,MAAM,CAAC,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/msgpack/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,OAAO,EACP,WAAW,EACZ,MAAM,aAAa,CAAC;AAYrB;;GAEG;AACH,qBAAa,gBAAgB;IAC3B;;OAEG;IACH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K,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"module-loader-browser.d.ts","sourceRoot":"","sources":["../../../src/runtime/module-loader-browser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAwDvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-loading.d.ts","sourceRoot":"","sources":["../../../../src/runtime/unified-loader/module-loading.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAG7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAiBzE,6EAA6E;AAC7E,wBAAgB,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"module-loading.d.ts","sourceRoot":"","sources":["../../../../src/runtime/unified-loader/module-loading.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAG7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAiBzE,6EAA6E;AAC7E,wBAAgB,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA0BpD;AAOD,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,GAAG,YAAY,EAC/B,OAAO,EAAE,sBAAsB,EAC/B,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAS3B"}
|
|
@@ -8,7 +8,7 @@ function isWindows() {
|
|
|
8
8
|
}
|
|
9
9
|
function getPreopens() {
|
|
10
10
|
if (!isWindows()) return { "/": "/" };
|
|
11
|
-
const statSync = isDeno() ? Deno.statSync : getNodeFsSync()?.statSync;
|
|
11
|
+
const statSync = isDeno() ? (p) => Deno.statSync(p) : getNodeFsSync()?.statSync;
|
|
12
12
|
if (!statSync) {
|
|
13
13
|
console.warn(
|
|
14
14
|
"[taglib-wasm] Windows drive detection unavailable: node:fs could not be loaded. Only C:\\ is registered as a WASI preopen."
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-handle.d.ts","sourceRoot":"","sources":["../../../../src/runtime/wasi-adapter/file-handle.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,aAAa,EACb,SAAS,EACT,UAAU,EACX,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAEV,eAAe,EAEhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"file-handle.d.ts","sourceRoot":"","sources":["../../../../src/runtime/wasi-adapter/file-handle.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,aAAa,EACb,SAAS,EACT,UAAU,EACX,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAEV,eAAe,EAEhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAuHhE,qBAAa,cAAe,YAAW,UAAU;IAC/C,OAAO,CAAC,QAAQ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AAI,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,GAAG,SAAS;IAMhE,OAAO,IAAI,IAAI;CAKhB"}
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
readNumericMirror,
|
|
17
17
|
stageNumericWrite,
|
|
18
18
|
stageRawWrite,
|
|
19
|
+
stringifyScalar,
|
|
19
20
|
TRACK_MIRROR
|
|
20
21
|
} from "../../utils/mirror-fields.js";
|
|
21
22
|
import {
|
|
@@ -244,7 +245,7 @@ class WasiFileHandle {
|
|
|
244
245
|
result[propKey] = value.map(String);
|
|
245
246
|
} else if (typeof value === "object") {
|
|
246
247
|
continue;
|
|
247
|
-
} else {
|
|
248
|
+
} else if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint" || typeof value === "symbol") {
|
|
248
249
|
result[propKey] = [String(value)];
|
|
249
250
|
}
|
|
250
251
|
}
|
|
@@ -276,7 +277,11 @@ class WasiFileHandle {
|
|
|
276
277
|
this.checkNotDestroyed();
|
|
277
278
|
const mappedKey = fromTagLibKey(key);
|
|
278
279
|
const stored = this.tagData?.[mappedKey];
|
|
279
|
-
|
|
280
|
+
if (Array.isArray(stored)) {
|
|
281
|
+
const first = stored[0];
|
|
282
|
+
return stringifyScalar(first);
|
|
283
|
+
}
|
|
284
|
+
return stringifyScalar(stored);
|
|
280
285
|
}
|
|
281
286
|
setProperty(key, value) {
|
|
282
287
|
this.checkNotDestroyed();
|
|
@@ -304,7 +309,11 @@ class WasiFileHandle {
|
|
|
304
309
|
if (key.startsWith("----:")) {
|
|
305
310
|
const foreign = this.tagData?.[key];
|
|
306
311
|
if (foreign !== void 0) {
|
|
307
|
-
|
|
312
|
+
if (Array.isArray(foreign)) {
|
|
313
|
+
const first = foreign[0];
|
|
314
|
+
return stringifyScalar(first);
|
|
315
|
+
}
|
|
316
|
+
return stringifyScalar(foreign);
|
|
308
317
|
}
|
|
309
318
|
}
|
|
310
319
|
return this.getProperty(mp4ItemPropertyKey(key));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasi-fs-deno.d.ts","sourceRoot":"","sources":["../../../src/runtime/wasi-fs-deno.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAGnB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"wasi-fs-deno.d.ts","sourceRoot":"","sources":["../../../src/runtime/wasi-fs-deno.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAGnB,MAAM,uBAAuB,CAAC;AAY/B,wBAAgB,oBAAoB,IAAI,kBAAkB,CAazD"}
|
|
@@ -4,7 +4,7 @@ function wrapDenoFile(file) {
|
|
|
4
4
|
writeSync: (data) => file.writeSync(data),
|
|
5
5
|
seekSync: (offset, whence) => file.seekSync(offset, whence),
|
|
6
6
|
truncateSync: (size) => file.truncateSync(size),
|
|
7
|
-
close: () => file.close()
|
|
7
|
+
close: () => void file.close()
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
function createDenoFsProvider() {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { AudioFile } from "../taglib.js";
|
|
1
2
|
import type { AudioDynamics } from "../folder-api/types.js";
|
|
2
|
-
import type { AudioFileInput, AudioProperties, ExtendedTag } from "../types.js";
|
|
3
|
+
import type { AudioFileInput, AudioProperties, ExtendedTag, TagInput } from "../types.js";
|
|
3
4
|
/** Configuration for batch processing operations. */
|
|
4
5
|
export interface BatchOptions {
|
|
5
6
|
concurrency?: number;
|
|
@@ -7,6 +8,13 @@ export interface BatchOptions {
|
|
|
7
8
|
onProgress?: (processed: number, total: number, currentFile: string) => void;
|
|
8
9
|
/** AbortSignal to cancel the batch operation between chunks. */
|
|
9
10
|
signal?: AbortSignal;
|
|
11
|
+
/**
|
|
12
|
+
* Raw WIRE keys (e.g. "CATALOGNUMBER") to surface per item under
|
|
13
|
+
* `extraProperties`, for keys outside the modeled typed set (taglib-3s1f).
|
|
14
|
+
* The PropertyMap is already fetched per file, so this costs no extra
|
|
15
|
+
* opens on either backend. Absent keys are omitted, not empty arrays.
|
|
16
|
+
*/
|
|
17
|
+
includeProperties?: string[];
|
|
10
18
|
}
|
|
11
19
|
/** Discriminated union result for a single file in a batch operation. */
|
|
12
20
|
export type BatchItem<T> = {
|
|
@@ -52,10 +60,14 @@ export interface FileMetadata {
|
|
|
52
60
|
* Read complete metadata (tags, properties, cover art, dynamics) from a single file.
|
|
53
61
|
*
|
|
54
62
|
* @param file - A file path, Uint8Array, ArrayBuffer, File object, or NamedAudioInput.
|
|
63
|
+
* @param options - Read options; `includeProperties` (wire keys) surfaces raw
|
|
64
|
+
* values in `tags.extraProperties` (taglib-3s1f).
|
|
55
65
|
* @returns The file's complete metadata.
|
|
56
66
|
* @throws `InvalidFormatError` if the file is corrupted or in an unsupported format.
|
|
57
67
|
*/
|
|
58
|
-
export declare function readMetadata(file: AudioFileInput
|
|
68
|
+
export declare function readMetadata(file: AudioFileInput, options?: {
|
|
69
|
+
includeProperties?: string[];
|
|
70
|
+
}): Promise<FileMetadata>;
|
|
59
71
|
/**
|
|
60
72
|
* Read complete metadata from multiple files with configurable concurrency.
|
|
61
73
|
*
|
|
@@ -65,4 +77,47 @@ export declare function readMetadata(file: AudioFileInput): Promise<FileMetadata
|
|
|
65
77
|
* @throws If `continueOnError` is `false` and any file fails to process.
|
|
66
78
|
*/
|
|
67
79
|
export declare function readMetadataBatch(files: AudioFileInput[], options?: BatchOptions): Promise<BatchResult<FileMetadata>>;
|
|
80
|
+
/** One file to update in a {@link writeTagsBatch} call. */
|
|
81
|
+
export interface WriteTagUpdate {
|
|
82
|
+
/** File path on disk; the file is updated in place. */
|
|
83
|
+
path: string;
|
|
84
|
+
/**
|
|
85
|
+
* Partial tag fields to merge with the file's existing metadata. An empty
|
|
86
|
+
* object performs a save with no tag changes (a no-op rewrite).
|
|
87
|
+
*/
|
|
88
|
+
tags: Partial<TagInput>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Apply tag updates to multiple files with configurable concurrency.
|
|
92
|
+
*
|
|
93
|
+
* The batch write counterpart to {@link readTagsBatch}: same
|
|
94
|
+
* {@link BatchOptions} contract (concurrency, continueOnError, onProgress,
|
|
95
|
+
* signal). Each file is updated via the same path as
|
|
96
|
+
* {@link applyTagsToFile} — merge semantics, atomic temp-file save, so a
|
|
97
|
+
* failed file is left in its pre-write state.
|
|
98
|
+
*
|
|
99
|
+
* @param updates - Per-file tag updates; a path may appear more than once
|
|
100
|
+
* (the last update for a path wins).
|
|
101
|
+
* @param options - Batch processing options (concurrency, error handling,
|
|
102
|
+
* progress, abort).
|
|
103
|
+
* @returns A `BatchItem` per update in input order plus total duration in ms.
|
|
104
|
+
* @throws If `continueOnError` is `false` and any file fails to process.
|
|
105
|
+
*/
|
|
106
|
+
export declare function writeTagsBatch(updates: WriteTagUpdate[], options?: BatchOptions): Promise<BatchResult<void>>;
|
|
107
|
+
/**
|
|
108
|
+
* Open, mutate, and save multiple files with configurable concurrency.
|
|
109
|
+
*
|
|
110
|
+
* Mutator-callback variant of {@link writeTagsBatch}: the callback receives
|
|
111
|
+
* the open {@link AudioFile} (Full-API style) and its changes are saved per
|
|
112
|
+
* file. Same {@link BatchOptions} contract and atomicity guarantees.
|
|
113
|
+
*
|
|
114
|
+
* @param files - File paths on disk, updated in place.
|
|
115
|
+
* @param mutator - Called once per file with the open audio file; changes are
|
|
116
|
+
* saved automatically.
|
|
117
|
+
* @param options - Batch processing options (concurrency, error handling,
|
|
118
|
+
* progress, abort).
|
|
119
|
+
* @returns A `BatchItem` per file in input order plus total duration in ms.
|
|
120
|
+
* @throws If `continueOnError` is `false` and any file fails to process.
|
|
121
|
+
*/
|
|
122
|
+
export declare function editTagsBatch(files: string[], mutator: (audioFile: AudioFile) => void, options?: BatchOptions): Promise<BatchResult<void>>;
|
|
68
123
|
//# 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":"
|
|
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,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7E,gEAAgE;IAChE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,yEAAyE;AACzE,MAAM,MAAM,SAAS,CAAC,CAAC,IACnB;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GACvC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAEpD,mEAAmE;AACnE,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAyDD;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,GAAE,YAAiB,GACzB,OAA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AM5B"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { isNamedAudioInput } from "../types/audio-formats.js";
|
|
2
2
|
import { InvalidFormatError } from "../errors.js";
|
|
3
3
|
import { readExtendedTag } from "../utils/tag-mapping.js";
|
|
4
|
+
import { applyTagsToFile } from "./tag-operations.js";
|
|
5
|
+
import { withAudioFileSaveToFile } from "./with-audio-file.js";
|
|
4
6
|
import { getTagLib } from "./config.js";
|
|
5
7
|
async function executeBatch(files, options, processor) {
|
|
6
8
|
if (files.length === 0) return { items: [], duration: 0 };
|
|
@@ -48,7 +50,7 @@ async function readTagsBatch(files, options = {}) {
|
|
|
48
50
|
return executeBatch(
|
|
49
51
|
files,
|
|
50
52
|
options,
|
|
51
|
-
(audioFile) => readExtendedTag(audioFile)
|
|
53
|
+
(audioFile) => readExtendedTag(audioFile, options.includeProperties)
|
|
52
54
|
);
|
|
53
55
|
}
|
|
54
56
|
async function readPropertiesBatch(files, options = {}) {
|
|
@@ -77,7 +79,7 @@ function extractDynamics(audioFile) {
|
|
|
77
79
|
if (appleSoundCheck) dynamics.appleSoundCheck = appleSoundCheck;
|
|
78
80
|
return Object.keys(dynamics).length > 0 ? dynamics : void 0;
|
|
79
81
|
}
|
|
80
|
-
async function readMetadata(file) {
|
|
82
|
+
async function readMetadata(file, options = {}) {
|
|
81
83
|
const taglib = await getTagLib();
|
|
82
84
|
const audioFile = await taglib.open(file);
|
|
83
85
|
try {
|
|
@@ -98,7 +100,7 @@ async function readMetadata(file) {
|
|
|
98
100
|
}
|
|
99
101
|
const dynamics = extractDynamics(audioFile);
|
|
100
102
|
return {
|
|
101
|
-
tags: readExtendedTag(audioFile),
|
|
103
|
+
tags: readExtendedTag(audioFile, options.includeProperties),
|
|
102
104
|
properties: audioFile.audioProperties(),
|
|
103
105
|
hasCoverArt: audioFile.getPictures().length > 0,
|
|
104
106
|
...dynamics !== void 0 ? { dynamics } : {}
|
|
@@ -111,16 +113,64 @@ async function readMetadataBatch(files, options = {}) {
|
|
|
111
113
|
return executeBatch(files, options, (audioFile) => {
|
|
112
114
|
const dynamics = extractDynamics(audioFile);
|
|
113
115
|
return {
|
|
114
|
-
tags: readExtendedTag(audioFile),
|
|
116
|
+
tags: readExtendedTag(audioFile, options.includeProperties),
|
|
115
117
|
properties: audioFile.audioProperties(),
|
|
116
118
|
hasCoverArt: audioFile.getPictures().length > 0,
|
|
117
119
|
...dynamics !== void 0 ? { dynamics } : {}
|
|
118
120
|
};
|
|
119
121
|
});
|
|
120
122
|
}
|
|
123
|
+
function entryPath(entry) {
|
|
124
|
+
return typeof entry === "string" ? entry : entry.path;
|
|
125
|
+
}
|
|
126
|
+
async function executeWriteBatch(entries, options, writer) {
|
|
127
|
+
if (entries.length === 0) return { items: [], duration: 0 };
|
|
128
|
+
await getTagLib();
|
|
129
|
+
const startTime = Date.now();
|
|
130
|
+
const { concurrency = 4, continueOnError = true, onProgress, signal } = options;
|
|
131
|
+
const items = new Array(entries.length);
|
|
132
|
+
let processed = 0;
|
|
133
|
+
const total = entries.length;
|
|
134
|
+
for (let i = 0; i < entries.length; i += concurrency) {
|
|
135
|
+
signal?.throwIfAborted();
|
|
136
|
+
const chunk = entries.slice(i, i + concurrency);
|
|
137
|
+
const chunkPromises = chunk.map(async (entry, idx) => {
|
|
138
|
+
const index = i + idx;
|
|
139
|
+
const path = entryPath(entry);
|
|
140
|
+
try {
|
|
141
|
+
await writer(path);
|
|
142
|
+
items[index] = { status: "ok", path, data: void 0 };
|
|
143
|
+
} catch (error) {
|
|
144
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
145
|
+
items[index] = { status: "error", path, error: err };
|
|
146
|
+
if (!continueOnError) throw err;
|
|
147
|
+
}
|
|
148
|
+
processed++;
|
|
149
|
+
onProgress?.(processed, total, path);
|
|
150
|
+
});
|
|
151
|
+
await Promise.all(chunkPromises);
|
|
152
|
+
}
|
|
153
|
+
return { items, duration: Date.now() - startTime };
|
|
154
|
+
}
|
|
155
|
+
async function writeTagsBatch(updates, options = {}) {
|
|
156
|
+
const byPath = new Map(updates.map((u) => [u.path, u]));
|
|
157
|
+
return executeWriteBatch(updates, options, (path) => {
|
|
158
|
+
const update = byPath.get(path);
|
|
159
|
+
return applyTagsToFile(path, update.tags);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
async function editTagsBatch(files, mutator, options = {}) {
|
|
163
|
+
return executeWriteBatch(
|
|
164
|
+
files,
|
|
165
|
+
options,
|
|
166
|
+
(path) => withAudioFileSaveToFile(path, mutator)
|
|
167
|
+
);
|
|
168
|
+
}
|
|
121
169
|
export {
|
|
170
|
+
editTagsBatch,
|
|
122
171
|
readMetadata,
|
|
123
172
|
readMetadataBatch,
|
|
124
173
|
readPropertiesBatch,
|
|
125
|
-
readTagsBatch
|
|
174
|
+
readTagsBatch,
|
|
175
|
+
writeTagsBatch
|
|
126
176
|
};
|