feat(content): serve the mounted content folder under /content (spec 003)

Audio with range requests, library.json, Homer books; LRC parser. Content
stays out of git and the image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas WintherandClaude Opus 5.5 committed 2026-10-30 02:46:43 +01:00
1 parent 9d063fcbe0
commit 27b1d2fe26
15 files changed
+527 -10

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
export interface LrcLine {
time: number;
text: string;
}
const STAMP = /\[(\d+):(\d{1,2}(?:\.\d+)?)\]/g;
/** Parses LRC timed lyrics: metadata tags and untimed lines are skipped, output is sorted by time. */
export function parseLrc(text: string): LrcLine[] {
const lines: LrcLine[] = [];
for (const raw of text.split(/\r?\n/)) {
const stamps = [...raw.matchAll(STAMP)];
if (stamps.length === 0) continue;
const lyric = raw.replace(STAMP, "").trim();
for (const [, min, sec] of stamps) {
lines.push({ time: Math.round((Number(min) * 60 + Number(sec)) * 1000) / 1000, text: lyric });
}
}
return lines.sort((a, b) => a.time - b.time);
}