taglib-wasm 0.4.2 → 0.4.3
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"folder-api.d.ts","sourceRoot":"","sources":["../../src/folder-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"folder-api.d.ts","sourceRoot":"","sources":["../../src/folder-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAY,KAAK,GAAG,EAAc,MAAM,aAAa,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAgBlD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,IAAI,EAAE,GAAG,CAAC;IACV,8DAA8D;IAC9D,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,qDAAqD;IACrD,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,iEAAiE;IACjE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7E,0DAA0D;IAC1D,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,oDAAoD;IACpD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,iDAAiD;IACjD,KA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,iBAAiB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAuBf"}
|
package/dist/src/folder-api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TagLib } from "./taglib.js";
|
|
2
|
-
import {
|
|
2
|
+
import { readTags, updateTags } from "./simple.js";
|
|
3
3
|
function join(...paths) {
|
|
4
4
|
return paths.filter((p) => p).join("/").replace(/\/+/g, "/");
|
|
5
5
|
}
|
|
@@ -71,18 +71,13 @@ async function* walkDirectory(path, options = {}) {
|
|
|
71
71
|
}
|
|
72
72
|
async function processBatch(files, processor, concurrency) {
|
|
73
73
|
const results = [];
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (executing.length >= concurrency) {
|
|
81
|
-
await Promise.race(executing);
|
|
82
|
-
executing.splice(executing.findIndex((p) => p === promise), 1);
|
|
83
|
-
}
|
|
74
|
+
for (let i = 0; i < files.length; i += concurrency) {
|
|
75
|
+
const chunk = files.slice(i, i + concurrency);
|
|
76
|
+
const chunkResults = await Promise.all(
|
|
77
|
+
chunk.map((file) => processor(file))
|
|
78
|
+
);
|
|
79
|
+
results.push(...chunkResults);
|
|
84
80
|
}
|
|
85
|
-
await Promise.all(executing);
|
|
86
81
|
return results;
|
|
87
82
|
}
|
|
88
83
|
async function scanFolder(folderPath, options = {}) {
|
|
@@ -163,7 +158,7 @@ async function updateFolderTags(updates, options = {}) {
|
|
|
163
158
|
const failed = [];
|
|
164
159
|
const processor = async (update) => {
|
|
165
160
|
try {
|
|
166
|
-
await
|
|
161
|
+
await updateTags(update.path, update.tags);
|
|
167
162
|
successful++;
|
|
168
163
|
} catch (error) {
|
|
169
164
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
@@ -201,9 +196,7 @@ async function findDuplicates(folderPath, criteria = ["artist", "title"]) {
|
|
|
201
196
|
if (key) {
|
|
202
197
|
const group = duplicates.get(key) || [];
|
|
203
198
|
group.push(file);
|
|
204
|
-
|
|
205
|
-
duplicates.set(key, group);
|
|
206
|
-
}
|
|
199
|
+
duplicates.set(key, group);
|
|
207
200
|
}
|
|
208
201
|
}
|
|
209
202
|
for (const [key, files] of duplicates.entries()) {
|
package/package.json
CHANGED