fix: realtime folder photo counts during scan discovery and decode
This commit is contained in:
@@ -809,6 +809,17 @@ export async function scanFolder(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
for (const id of known.keys()) count(id.startsWith(`${normRoot}/`) ? id.slice(normRoot.length + 1) : id);
|
for (const id of known.keys()) count(id.startsWith(`${normRoot}/`) ? id.slice(normRoot.length + 1) : id);
|
||||||
|
const knownPaths = new Set(
|
||||||
|
[...known.keys()].map((id) => (id.startsWith(`${normRoot}/`) ? id.slice(normRoot.length + 1) : id))
|
||||||
|
);
|
||||||
|
const countedDiscovered = new Set<string>();
|
||||||
|
const countDiscovered = (rel: string) => {
|
||||||
|
const relClean = rel.replace(/\\/g, '/');
|
||||||
|
if (knownPaths.has(relClean) || countedDiscovered.has(relClean)) return;
|
||||||
|
countedDiscovered.add(relClean);
|
||||||
|
count(relClean);
|
||||||
|
};
|
||||||
|
for (const e of entries) countDiscovered(e.rel);
|
||||||
// The frames the catalogue already holds of the folder being read, which is
|
// The frames the catalogue already holds of the folder being read, which is
|
||||||
// what the reading is measured against: a roll of a hundred thousand that has
|
// what the reading is measured against: a roll of a hundred thousand that has
|
||||||
// been read once before is a reading of a hundred thousand frames even while
|
// been read once before is a reading of a hundred thousand frames even while
|
||||||
@@ -1036,10 +1047,20 @@ export async function scanFolder(
|
|||||||
// through. A jump would take it out of the subtree it was kept to, and
|
// through. A jump would take it out of the subtree it was kept to, and
|
||||||
// the reading it left behind is the reading that folder wanted.
|
// the reading it left behind is the reading that folder wanted.
|
||||||
const asked = bounded ? () => null : (jump ?? (() => null));
|
const asked = bounded ? () => null : (jump ?? (() => null));
|
||||||
walked = await walkPass(tree, entries, names, isSupportedPhoto, asked, (dirRel) => {
|
walked = await walkPass(
|
||||||
progress.at = normPath(dirRel);
|
tree,
|
||||||
publish(true);
|
entries,
|
||||||
});
|
names,
|
||||||
|
isSupportedPhoto,
|
||||||
|
asked,
|
||||||
|
(dirRel) => {
|
||||||
|
progress.at = normPath(dirRel);
|
||||||
|
publish(true);
|
||||||
|
},
|
||||||
|
(file) => {
|
||||||
|
countDiscovered(file.rel);
|
||||||
|
}
|
||||||
|
);
|
||||||
// The names come in before the frames they hold: the column grows one pass
|
// The names come in before the frames they hold: the column grows one pass
|
||||||
// ahead of the strip, which is the whole point of reading layer by layer.
|
// ahead of the strip, which is the whole point of reading layer by layer.
|
||||||
for (const rel of names) {
|
for (const rel of names) {
|
||||||
|
|||||||
@@ -88,7 +88,8 @@ export async function walkPass(
|
|||||||
seen: string[],
|
seen: string[],
|
||||||
keep: (name: string) => boolean,
|
keep: (name: string) => boolean,
|
||||||
jump: () => string | null,
|
jump: () => string | null,
|
||||||
onDir?: (rel: string) => void
|
onDir?: (rel: string) => void,
|
||||||
|
onFile?: (file: WalkFile) => void
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
for (let i = 0; i < DIRS_PER_PASS && walk.pending.length; i++) {
|
for (let i = 0; i < DIRS_PER_PASS && walk.pending.length; i++) {
|
||||||
await jumpQueue(walk, jump());
|
await jumpQueue(walk, jump());
|
||||||
@@ -107,7 +108,9 @@ export async function walkPass(
|
|||||||
walk.pending.push({ dir: entry as FileSystemDirectoryHandle, rel });
|
walk.pending.push({ dir: entry as FileSystemDirectoryHandle, rel });
|
||||||
seen.push(rel);
|
seen.push(rel);
|
||||||
} else if (keep(entry.name)) {
|
} else if (keep(entry.name)) {
|
||||||
out.push({ handle: entry as FileSystemFileHandle, rel: `${baseRel}${entry.name}` });
|
const file: WalkFile = { handle: entry as FileSystemFileHandle, rel: `${baseRel}${entry.name}` };
|
||||||
|
out.push(file);
|
||||||
|
onFile?.(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
3e9a0f2173ec2dd5df1d1d6b3925ce16ac637e82746a316cc90cf35a82fb2c14 recipescam-images.tar.gz
|
d01beb3a629be66f3e70b82a325b26c92dd620e79a41de3ab73a578781f5bf45 recipescam-images.tar.gz
|
||||||
|
|||||||
Reference in New Issue
Block a user