Backfill device song metadata and queue guarded server caching

This commit is contained in:
Jonathan Sykes
2026-10-03 17:55:49 +08:00
parent 9e960cf70f
commit 856ddda6a6
8 changed files with 187 additions and 7 deletions

View File

@@ -687,14 +687,14 @@ export function registerNoteRoutes(app, deps) {
// Saved (server-cached) videos with whether each already has lyrics — the
// work list for batch lyric injection.
app.get('/api/admin/media', requireAdminOrToken, async (c) => {
const rows = (await db.listMedia()).filter((r) => r.status === 'ready');
const rows = await db.listMedia();
const out = [];
for (const r of rows) {
let meta = {};
try { meta = JSON.parse(r.meta || '{}'); } catch { /* corrupt meta */ }
const n = await db.getNotes(r.video_id);
out.push({
id: r.video_id, title: meta.title || '', channel: meta.channel || meta.uploader || '',
id: r.video_id, cacheStatus: r.status, title: meta.title || '', channel: meta.channel || meta.uploader || '',
duration: Number(r.duration) || 0, lastAccess: Number(r.last_access) || 0,
lyricsRev: n.lyrics ? n.lyrics.rev : 0, lyricsLines: n.lyrics ? n.lyrics.data.lines.length : 0,
});