24 lines
781 B
JavaScript
24 lines
781 B
JavaScript
const fs = require('fs');
|
|
|
|
let scan = fs.readFileSync('src/lib/scanner/index.ts', 'utf8');
|
|
|
|
// Add thumbnailReady to select
|
|
scan = scan.replace(
|
|
'select: { id: true, relativePath: true, fileSize: true, lastModified: true },',
|
|
'select: { id: true, relativePath: true, fileSize: true, lastModified: true, thumbnailReady: true },'
|
|
);
|
|
|
|
// Add enqueue condition in else block
|
|
scan = scan.replace(
|
|
' unchanged++;\n dbPaths.delete(relPath);\n }',
|
|
` unchanged++;
|
|
dbPaths.delete(relPath);
|
|
if (existing.thumbnailReady === false) {
|
|
enqueueProcessing(relPath, getMediaType(file.ext)).catch(console.error);
|
|
console.log('Re-queued missing thumbnail:', relPath);
|
|
}
|
|
}`
|
|
);
|
|
|
|
fs.writeFileSync('src/lib/scanner/index.ts', scan, 'utf8');
|