From 00a5055817daaa7680ea2bfcc3ece005a459a372 Mon Sep 17 00:00:00 2001 From: mtvpls Date: Sat, 10 Jan 2026 10:25:14 +0800 Subject: [PATCH] =?UTF-8?q?openlist=E5=A4=9A=E7=9B=AE=E5=BD=95=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/admin/page.tsx | 57 ++++++-- src/app/api/admin/openlist/route.ts | 14 +- src/app/api/cms-proxy/route.ts | 4 +- src/app/api/detail/route.ts | 4 +- .../api/openlist/cms-proxy/[token]/route.ts | 4 +- src/app/api/openlist/correct/route.ts | 7 +- src/app/api/openlist/delete/route.ts | 6 +- src/app/api/openlist/detail/route.ts | 4 +- src/app/api/openlist/list/route.ts | 5 +- src/app/api/openlist/play/route.ts | 4 +- src/app/api/openlist/refresh-video/route.ts | 4 +- src/app/api/search/route.ts | 5 +- src/app/api/search/ws/route.ts | 5 +- src/app/api/source-detail/route.ts | 4 +- src/lib/admin.types.ts | 3 +- src/lib/openlist-cache.ts | 18 +-- src/lib/openlist-refresh.ts | 130 ++++++++++++++++-- 17 files changed, 212 insertions(+), 66 deletions(-) diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index 26ba098..4994392 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -2763,7 +2763,7 @@ const OpenListConfigComponent = ({ const [url, setUrl] = useState(''); const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); - const [rootPath, setRootPath] = useState('/'); + const [rootPaths, setRootPaths] = useState(['/']); const [offlineDownloadPath, setOfflineDownloadPath] = useState('/'); const [scanInterval, setScanInterval] = useState(0); const [scanMode, setScanMode] = useState<'torrent' | 'name' | 'hybrid'>('hybrid'); @@ -2783,7 +2783,7 @@ const OpenListConfigComponent = ({ setUrl(config.OpenListConfig.URL || ''); setUsername(config.OpenListConfig.Username || ''); setPassword(config.OpenListConfig.Password || ''); - setRootPath(config.OpenListConfig.RootPath || '/'); + setRootPaths(config.OpenListConfig.RootPaths || (config.OpenListConfig.RootPath ? [config.OpenListConfig.RootPath] : ['/'])); setOfflineDownloadPath(config.OpenListConfig.OfflineDownloadPath || '/'); setScanInterval(config.OpenListConfig.ScanInterval || 0); setScanMode(config.OpenListConfig.ScanMode || 'hybrid'); @@ -2824,7 +2824,7 @@ const OpenListConfigComponent = ({ URL: url, Username: username, Password: password, - RootPath: rootPath, + RootPaths: rootPaths, OfflineDownloadPath: offlineDownloadPath, ScanInterval: scanInterval, ScanMode: scanMode, @@ -3104,18 +3104,49 @@ const OpenListConfigComponent = ({
- setRootPath(e.target.value)} - disabled={!enabled} - placeholder='/' - className='w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed' - /> +
+ {rootPaths.map((path, index) => ( +
+ { + const newPaths = [...rootPaths]; + newPaths[index] = e.target.value; + setRootPaths(newPaths); + }} + disabled={!enabled} + placeholder='/' + className='flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed' + /> + {rootPaths.length > 1 && ( + + )} +
+ ))} + +

- OpenList 中的视频文件夹路径,默认为根目录 / + OpenList 中的视频文件夹路径,可以配置多个根目录

diff --git a/src/app/api/admin/openlist/route.ts b/src/app/api/admin/openlist/route.ts index e03015e..82f5714 100644 --- a/src/app/api/admin/openlist/route.ts +++ b/src/app/api/admin/openlist/route.ts @@ -26,7 +26,7 @@ export async function POST(request: NextRequest) { try { const body = await request.json(); - const { action, Enabled, URL, Username, Password, RootPath, OfflineDownloadPath, ScanInterval, ScanMode } = body; + const { action, Enabled, URL, Username, Password, RootPaths, OfflineDownloadPath, ScanInterval, ScanMode } = body; const authInfo = getAuthInfoFromCookie(request); if (!authInfo || !authInfo.username) { @@ -53,7 +53,7 @@ export async function POST(request: NextRequest) { URL: URL || '', Username: Username || '', Password: Password || '', - RootPath: RootPath || '/', + RootPaths: RootPaths || ['/'], OfflineDownloadPath: OfflineDownloadPath || '/', LastRefreshTime: adminConfig.OpenListConfig?.LastRefreshTime, ResourceCount: adminConfig.OpenListConfig?.ResourceCount, @@ -77,6 +77,14 @@ export async function POST(request: NextRequest) { ); } + // 验证 RootPaths + if (!Array.isArray(RootPaths) || RootPaths.length === 0) { + return NextResponse.json( + { error: '请至少提供一个根目录' }, + { status: 400 } + ); + } + // 验证扫描间隔 let scanInterval = parseInt(ScanInterval) || 0; if (scanInterval > 0 && scanInterval < 60) { @@ -104,7 +112,7 @@ export async function POST(request: NextRequest) { URL, Username, Password, - RootPath: RootPath || '/', + RootPaths, OfflineDownloadPath: OfflineDownloadPath || '/', LastRefreshTime: adminConfig.OpenListConfig?.LastRefreshTime, ResourceCount: adminConfig.OpenListConfig?.ResourceCount, diff --git a/src/app/api/cms-proxy/route.ts b/src/app/api/cms-proxy/route.ts index b4e1ff0..9618dfd 100644 --- a/src/app/api/cms-proxy/route.ts +++ b/src/app/api/cms-proxy/route.ts @@ -268,14 +268,14 @@ async function handleOpenListProxy(request: NextRequest) { ); // 读取 metainfo (从数据库或缓存) - let metaInfo: MetaInfo | null = getCachedMetaInfo(rootPath); + let metaInfo: MetaInfo | null = getCachedMetaInfo(); if (!metaInfo) { try { const metainfoJson = await db.getGlobalValue('video.metainfo'); if (metainfoJson) { metaInfo = JSON.parse(metainfoJson) as MetaInfo; - setCachedMetaInfo(rootPath, metaInfo); + setCachedMetaInfo(metaInfo); } } catch (error) { return NextResponse.json( diff --git a/src/app/api/detail/route.ts b/src/app/api/detail/route.ts index 04d6825..cb6901c 100644 --- a/src/app/api/detail/route.ts +++ b/src/app/api/detail/route.ts @@ -45,13 +45,13 @@ export async function GET(request: NextRequest) { const { getCachedMetaInfo, setCachedMetaInfo } = await import('@/lib/openlist-cache'); const { db } = await import('@/lib/db'); - metaInfo = getCachedMetaInfo(rootPath); + metaInfo = getCachedMetaInfo(); if (!metaInfo) { const metainfoJson = await db.getGlobalValue('video.metainfo'); if (metainfoJson) { metaInfo = JSON.parse(metainfoJson); - setCachedMetaInfo(rootPath, metaInfo); + setCachedMetaInfo(metaInfo); } } diff --git a/src/app/api/openlist/cms-proxy/[token]/route.ts b/src/app/api/openlist/cms-proxy/[token]/route.ts index b386b39..489673f 100644 --- a/src/app/api/openlist/cms-proxy/[token]/route.ts +++ b/src/app/api/openlist/cms-proxy/[token]/route.ts @@ -76,7 +76,7 @@ export async function GET( const { getCachedMetaInfo, setCachedMetaInfo } = await import('@/lib/openlist-cache'); const { db } = await import('@/lib/db'); - let metaInfo = getCachedMetaInfo(rootPath); + let metaInfo = getCachedMetaInfo(); if (!metaInfo) { try { @@ -84,7 +84,7 @@ export async function GET( if (metainfoJson) { metaInfo = JSON.parse(metainfoJson); if (metaInfo) { - setCachedMetaInfo(rootPath, metaInfo); + setCachedMetaInfo(metaInfo); } } } catch (error) { diff --git a/src/app/api/openlist/correct/route.ts b/src/app/api/openlist/correct/route.ts index 1520c7b..cd188a4 100644 --- a/src/app/api/openlist/correct/route.ts +++ b/src/app/api/openlist/correct/route.ts @@ -65,7 +65,6 @@ export async function POST(request: NextRequest) { ); } - const rootPath = openListConfig.RootPath || '/'; const client = new OpenListClient( openListConfig.URL, openListConfig.Username, @@ -73,7 +72,7 @@ export async function POST(request: NextRequest) { ); // 读取现有 metainfo (从数据库或缓存) - let metaInfo: MetaInfo | null = getCachedMetaInfo(rootPath); + let metaInfo: MetaInfo | null = getCachedMetaInfo(); if (!metaInfo) { try { @@ -132,8 +131,8 @@ export async function POST(request: NextRequest) { await db.setGlobalValue('video.metainfo', metainfoContent); // 更新缓存 - invalidateMetaInfoCache(rootPath); - setCachedMetaInfo(rootPath, metaInfo); + invalidateMetaInfoCache(); + setCachedMetaInfo(metaInfo); return NextResponse.json({ success: true, diff --git a/src/app/api/openlist/delete/route.ts b/src/app/api/openlist/delete/route.ts index 1c435c9..77501ce 100644 --- a/src/app/api/openlist/delete/route.ts +++ b/src/app/api/openlist/delete/route.ts @@ -49,8 +49,6 @@ export async function POST(request: NextRequest) { ); } - const rootPath = openListConfig.RootPath || '/'; - // 从数据库读取 metainfo const metainfoContent = await db.getGlobalValue('video.metainfo'); if (!metainfoContent) { @@ -78,8 +76,8 @@ export async function POST(request: NextRequest) { await db.setGlobalValue('video.metainfo', updatedMetainfoContent); // 更新缓存 - invalidateMetaInfoCache(rootPath); - setCachedMetaInfo(rootPath, metaInfo); + invalidateMetaInfoCache(); + setCachedMetaInfo(metaInfo); // 更新配置中的资源数量 if (config.OpenListConfig) { diff --git a/src/app/api/openlist/detail/route.ts b/src/app/api/openlist/detail/route.ts index d0503e0..fc69fbe 100644 --- a/src/app/api/openlist/detail/route.ts +++ b/src/app/api/openlist/detail/route.ts @@ -45,8 +45,8 @@ export async function GET(request: NextRequest) { return NextResponse.json({ error: 'OpenList 未配置或未启用' }, { status: 400 }); } - const rootPath = openListConfig.RootPath || '/'; - const folderPath = `${rootPath}${rootPath.endsWith('/') ? '' : '/'}${folderName}`; + // folderName 已经是完整路径,直接使用 + const folderPath = folderName; const client = new OpenListClient( openListConfig.URL, openListConfig.Username, diff --git a/src/app/api/openlist/list/route.ts b/src/app/api/openlist/list/route.ts index ad1297e..7b2798e 100644 --- a/src/app/api/openlist/list/route.ts +++ b/src/app/api/openlist/list/route.ts @@ -48,7 +48,6 @@ export async function GET(request: NextRequest) { ); } - const rootPath = openListConfig.RootPath || '/'; const client = new OpenListClient( openListConfig.URL, openListConfig.Username, @@ -62,7 +61,7 @@ export async function GET(request: NextRequest) { if (noCache) { // noCache 模式:跳过缓存 } else { - metaInfo = getCachedMetaInfo(rootPath); + metaInfo = getCachedMetaInfo(); } if (!metaInfo) { @@ -83,7 +82,7 @@ export async function GET(request: NextRequest) { // 只有在不是 noCache 模式时才更新缓存 if (!noCache) { - setCachedMetaInfo(rootPath, metaInfo); + setCachedMetaInfo(metaInfo); } } catch (parseError) { console.error('[OpenList List] JSON 解析或验证失败:', parseError); diff --git a/src/app/api/openlist/play/route.ts b/src/app/api/openlist/play/route.ts index ea7c812..371c373 100644 --- a/src/app/api/openlist/play/route.ts +++ b/src/app/api/openlist/play/route.ts @@ -41,8 +41,8 @@ export async function GET(request: NextRequest) { return NextResponse.json({ error: 'OpenList 未配置或未启用' }, { status: 400 }); } - const rootPath = openListConfig.RootPath || '/'; - const folderPath = `${rootPath}${rootPath.endsWith('/') ? '' : '/'}${folderName}`; + // folderName 已经是完整路径,直接使用 + const folderPath = folderName; const filePath = `${folderPath}/${fileName}`; const client = new OpenListClient( diff --git a/src/app/api/openlist/refresh-video/route.ts b/src/app/api/openlist/refresh-video/route.ts index 92a0ec2..bf22627 100644 --- a/src/app/api/openlist/refresh-video/route.ts +++ b/src/app/api/openlist/refresh-video/route.ts @@ -40,8 +40,8 @@ export async function POST(request: NextRequest) { return NextResponse.json({ error: 'OpenList 未配置或未启用' }, { status: 400 }); } - const rootPath = openListConfig.RootPath || '/'; - const folderPath = `${rootPath}${rootPath.endsWith('/') ? '' : '/'}${folder}`; + // folder 已经是完整路径,直接使用 + const folderPath = folder; const client = new OpenListClient( openListConfig.URL, openListConfig.Username, diff --git a/src/app/api/search/route.ts b/src/app/api/search/route.ts index add5724..4438ecd 100644 --- a/src/app/api/search/route.ts +++ b/src/app/api/search/route.ts @@ -105,15 +105,14 @@ export async function GET(request: NextRequest) { const { getTMDBImageUrl } = await import('@/lib/tmdb.search'); const { db } = await import('@/lib/db'); - const rootPath = config.OpenListConfig!.RootPath || '/'; - let metaInfo = getCachedMetaInfo(rootPath); + let metaInfo = getCachedMetaInfo(); if (!metaInfo) { const metainfoJson = await db.getGlobalValue('video.metainfo'); if (metainfoJson) { metaInfo = JSON.parse(metainfoJson); if (metaInfo) { - setCachedMetaInfo(rootPath, metaInfo); + setCachedMetaInfo(metaInfo); } } } diff --git a/src/app/api/search/ws/route.ts b/src/app/api/search/ws/route.ts index a271efa..22d16de 100644 --- a/src/app/api/search/ws/route.ts +++ b/src/app/api/search/ws/route.ts @@ -213,15 +213,14 @@ export async function GET(request: NextRequest) { const { getTMDBImageUrl } = await import('@/lib/tmdb.search'); const { db } = await import('@/lib/db'); - const rootPath = config.OpenListConfig!.RootPath || '/'; - let metaInfo = getCachedMetaInfo(rootPath); + let metaInfo = getCachedMetaInfo(); if (!metaInfo) { const metainfoJson = await db.getGlobalValue('video.metainfo'); if (metainfoJson) { metaInfo = JSON.parse(metainfoJson); if (metaInfo) { - setCachedMetaInfo(rootPath, metaInfo); + setCachedMetaInfo(metaInfo); } } } diff --git a/src/app/api/source-detail/route.ts b/src/app/api/source-detail/route.ts index 1cebc28..8722d76 100644 --- a/src/app/api/source-detail/route.ts +++ b/src/app/api/source-detail/route.ts @@ -149,13 +149,13 @@ export async function GET(request: NextRequest) { const { getCachedMetaInfo, setCachedMetaInfo } = await import('@/lib/openlist-cache'); const { db } = await import('@/lib/db'); - metaInfo = getCachedMetaInfo(rootPath); + metaInfo = getCachedMetaInfo(); if (!metaInfo) { const metainfoJson = await db.getGlobalValue('video.metainfo'); if (metainfoJson) { metaInfo = JSON.parse(metainfoJson); - setCachedMetaInfo(rootPath, metaInfo); + setCachedMetaInfo(metaInfo); } } diff --git a/src/lib/admin.types.ts b/src/lib/admin.types.ts index 6e2c32f..66f528b 100644 --- a/src/lib/admin.types.ts +++ b/src/lib/admin.types.ts @@ -106,7 +106,8 @@ export interface AdminConfig { URL: string; // OpenList 服务器地址 Username: string; // 账号(用于登录获取Token) Password: string; // 密码(用于登录获取Token) - RootPath: string; // 根目录路径,默认 "/" + RootPath?: string; // 旧字段:根目录路径(向后兼容,迁移后删除) + RootPaths?: string[]; // 新字段:多根目录路径列表 OfflineDownloadPath: string; // 离线下载目录,默认 "/" LastRefreshTime?: number; // 上次刷新时间戳 ResourceCount?: number; // 资源数量 diff --git a/src/lib/openlist-cache.ts b/src/lib/openlist-cache.ts index 18b51d4..016cd33 100644 --- a/src/lib/openlist-cache.ts +++ b/src/lib/openlist-cache.ts @@ -49,28 +49,30 @@ export interface VideoInfo { last_updated: number; } -// MetaInfo 缓存操作 -export function getCachedMetaInfo(rootPath: string): MetaInfo | null { - const entry = METAINFO_CACHE.get(rootPath); +// MetaInfo 缓存操作(使用固定键) +const METAINFO_CACHE_KEY = 'openlist_meta'; + +export function getCachedMetaInfo(): MetaInfo | null { + const entry = METAINFO_CACHE.get(METAINFO_CACHE_KEY); if (!entry) return null; if (entry.expiresAt <= Date.now()) { - METAINFO_CACHE.delete(rootPath); + METAINFO_CACHE.delete(METAINFO_CACHE_KEY); return null; } return entry.data; } -export function setCachedMetaInfo(rootPath: string, data: MetaInfo): void { - METAINFO_CACHE.set(rootPath, { +export function setCachedMetaInfo(data: MetaInfo): void { + METAINFO_CACHE.set(METAINFO_CACHE_KEY, { expiresAt: Date.now() + METAINFO_CACHE_TTL_MS, data, }); } -export function invalidateMetaInfoCache(rootPath: string): void { - METAINFO_CACHE.delete(rootPath); +export function invalidateMetaInfoCache(): void { + METAINFO_CACHE.delete(METAINFO_CACHE_KEY); } // VideoInfo 缓存操作 diff --git a/src/lib/openlist-refresh.ts b/src/lib/openlist-refresh.ts index 7688f7c..f59269a 100644 --- a/src/lib/openlist-refresh.ts +++ b/src/lib/openlist-refresh.ts @@ -20,6 +20,65 @@ import { import { parseSeasonFromTitle } from '@/lib/season-parser'; import { searchTMDB, getTVSeasonDetails } from '@/lib/tmdb.search'; import parseTorrentName from 'parse-torrent-name'; +import type { AdminConfig } from '@/lib/admin.types'; + +/** + * 获取根目录列表(兼容新旧配置) + */ +function getRootPaths(openListConfig: AdminConfig['OpenListConfig']): string[] { + if (!openListConfig) { + return ['/']; + } + + // 如果有新字段 RootPaths,直接使用 + if (openListConfig.RootPaths && openListConfig.RootPaths.length > 0) { + return openListConfig.RootPaths; + } + + // 如果只tPath,返回单元素数组 + if (openListConfig.RootPath) { + return [openListConfig.RootPath]; + } + + // 默认值 + return ['/']; +} + +/** + * 迁移旧版单根目录配置到多根目录 + */ +async function migrateToMultiRoot(openListConfig: NonNullable): Promise { + const oldRootPath = openListConfig.RootPath!; + + console.log('[OpenList Migration] 检测到旧版配置,开始迁移...'); + + // 1. 读取现有 metainfo + const metainfoContent = await db.getGlobalValue('video.metainfo'); + if (metainfoContent) { + const metaInfo: MetaInfo = JSON.parse(metainfoContent); + + // 2. 迁移 folderName:加上原根路径前缀 + for (const [key, info] of Object.entries(metaInfo.folders)) { + const oldFolderName = info.folderName; + const newFolderName = `${oldRootPath}${oldRootPath.endsWith('/') ? '' : '/'}${oldFolderName}`; + info.folderName = newFolderName; + + console.log(`[Migration] ${oldFolderName} -> ${newFolderName}`); + } + + // 3. 保存迁移后的 metainfo + await db.setGlobalValue('video.metainfo', JSON.stringify(metaInfo)); + console.log('[OpenList Migration] MetaInfo 迁移完成'); + } + + // 4. 更新配置:RootPath -> RootPaths + const config = await getConfig(); + config.OpenListConfig!.RootPaths = [oldRootPath]; + delete config.OpenListConfig!.RootPath; + await db.saveAdminConfig(config); + + console.log('[OpenList Migration] 配置迁移完成'); +} /** * 启动 OpenList 刷新任务 @@ -45,13 +104,24 @@ export async function startOpenListRefresh(clearMetaInfo: boolean = false): Prom throw new Error('TMDB API Key 未配置'); } + // 检测是否需要迁移 + if (openListConfig.RootPath && !openListConfig.RootPaths) { + await migrateToMultiRoot(openListConfig); + // 重新加载配置 + const newConfig = await getConfig(); + Object.assign(openListConfig, newConfig.OpenListConfig); + } + cleanupOldTasks(); const taskId = createScanTask(); - performScan( + const rootPaths = getRootPaths(openListConfig); + + // 顺序扫描多个根目录 + performMultiRootScan( taskId, openListConfig.URL, - openListConfig.RootPath || '/', + rootPaths, tmdbApiKey, tmdbProxy, openListConfig.Username, @@ -66,6 +136,43 @@ export async function startOpenListRefresh(clearMetaInfo: boolean = false): Prom return { taskId }; } +/** + * 扫描多个根目录 + */ +async function performMultiRootScan( + taskId: string, + url: string, + rootPaths: string[], + tmdbApiKey: string, + tmdbProxy: string | undefined, + username: string, + password: string, + clearMetaInfo: boolean, + scanMode: 'torrent' | 'name' | 'hybrid' +): Promise { + for (let i = 0; i < rootPaths.length; i++) { + const rootPath = rootPaths[i]; + console.log(`[OpenList Refresh] 扫描根目录 (${i + 1}/${rootPaths.length}): ${rootPath}`); + + try { + await performScan( + taskId, + url, + rootPath, + tmdbApiKey, + tmdbProxy, + username, + password, + clearMetaInfo && i === 0, // 只在第一个根目录时清除 + scanMode + ); + } catch (error) { + console.error(`[OpenList Refresh] 根目录 ${rootPath} 扫描失败:`, error); + // 继续扫描其他根目录 + } + } +} + /** * 执行扫描任务 */ @@ -112,7 +219,7 @@ async function performScan( } } - invalidateMetaInfoCache(rootPath); + invalidateMetaInfoCache(); const folders: any[] = []; let currentPage = 1; @@ -155,12 +262,15 @@ async function performScan( updateScanTaskProgress(taskId, i + 1, folders.length, folder.name); - if (!clearMetaInfo && folderNameToKey.has(folder.name)) { + // folderName 存储完整路径(包含根目录) + const fullFolderPath = `${rootPath}${rootPath.endsWith('/') ? '' : '/'}${folder.name}`; + + if (!clearMetaInfo && folderNameToKey.has(fullFolderPath)) { existingCount++; continue; } - const folderKey = generateFolderKey(folder.name, existingKeys); + const folderKey = generateFolderKey(fullFolderPath, existingKeys); existingKeys.add(folderKey); try { @@ -197,7 +307,7 @@ async function performScan( const result = searchResult.result; const folderInfo: any = { - folderName: folder.name, + folderName: fullFolderPath, tmdb_id: result.id, title: result.title || result.name || folder.name, poster_path: result.poster_path, @@ -249,7 +359,7 @@ async function performScan( newCount++; } else { metaInfo.folders[folderKey] = { - folderName: folder.name, + folderName: fullFolderPath, tmdb_id: 0, title: folder.name, poster_path: null, @@ -267,7 +377,7 @@ async function performScan( } catch (error) { console.error(`[OpenList Refresh] 处理文件夹失败: ${folder.name}`, error); metaInfo.folders[folderKey] = { - folderName: folder.name, + folderName: fullFolderPath, tmdb_id: 0, title: folder.name, poster_path: null, @@ -287,8 +397,8 @@ async function performScan( const metainfoContent = JSON.stringify(metaInfo); await db.setGlobalValue('video.metainfo', metainfoContent); - invalidateMetaInfoCache(rootPath); - setCachedMetaInfo(rootPath, metaInfo); + invalidateMetaInfoCache(); + setCachedMetaInfo(metaInfo); const config = await getConfig(); config.OpenListConfig!.LastRefreshTime = Date.now();