八国语言+eagle图片

This commit is contained in:
tianmo committed 2026-10-29 11:02:01 +08:00
1 parent acc93d5404
commit 3bd3ba7404
46 files changed
+2520 -290

No files matched your search

@@ -37,6 +37,7 @@ function cleanupStaleFiles(directory, prefix, maxAgeMs, now = Date.now()) {
function createLibraryWatcher(options) {
const onBatch = options.onBatch || (() => {});
const onLog = options.onLog || (() => {});
const t = options.t || ((key) => key);
let imagesDir = null;
let watcher = null;
let quietTimer = null;
@@ -47,7 +48,7 @@ function createLibraryWatcher(options) {
try {
return new Set(fs.readdirSync(imagesDir).filter((name) => name.endsWith('.info')));
} catch (error) {
onLog('读取素材目录失败:' + ((error && error.message) || error));
onLog(t('thumb.watchReadFailed', { error: (error && error.message) || error }));
return new Set();
}
}
@@ -82,15 +83,15 @@ function createLibraryWatcher(options) {
stop();
imagesDir = path.join(libraryPath, 'images');
if (!fs.existsSync(imagesDir)) {
onLog('素材目录不存在:' + imagesDir);
onLog(t('thumb.watchMissingDir', { path: imagesDir }));
return false;
}
known = listItemDirs();
onLog('监听 ' + imagesDir + '(现有 ' + known.size + ' 个素材视为历史,不处理)');
onLog(t('thumb.watching', { path: imagesDir, count: known.size }));
try {
watcher = fs.watch(imagesDir, { persistent: true }, () => scheduleFlush());
} catch (error) {
onLog('建立监听失败:' + ((error && error.message) || error));
onLog(t('thumb.watchFailed', { error: (error && error.message) || error }));
return false;
}
fallbackTimer = setInterval(() => {