feat(content): prefer Greek-name Homer translations; voyage app spec, design record and plan
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9a0350c82f
commit
c11c2ef079
9 files changed
+372
-8
No files matched your search
@@ -3,7 +3,12 @@ import { join, resolve, sep } from "node:path";
|
||||
import { scanLibrary } from "./library";
|
||||
import { splitBooks, type HomerBook } from "./homer";
|
||||
|
||||
const HOMER_FILES = { odyssey: "The Odyssey.txt", iliad: "The Illiad.txt" } as const;
|
||||
// Preferred first: translations that keep the Greek names (Butcher & Lang, Gutenberg #1728; Lang, Leaf
|
||||
// & Myers, #3059). Butler's (#1727, #2199) use Roman names and are the fallback.
|
||||
const HOMER_FILES = {
|
||||
odyssey: ["The Odyssey (Butcher and Lang).txt", "The Odyssey.txt"],
|
||||
iliad: ["The Iliad (Lang, Leaf and Myers).txt", "The Illiad.txt"],
|
||||
} as const;
|
||||
const HOMER_DIR = "Homers the Odyssey Book";
|
||||
const notFound = () => new Response("Not found", { status: 404 });
|
||||
// Bun reports FLAC as audio/x-flac; audio/flac is the registered type.
|
||||
@@ -12,8 +17,8 @@ const contentType = (file: Blob) => (file.type.startsWith("audio/x-flac") ? "aud
|
||||
const bookCache = new Map<string, HomerBook[]>();
|
||||
|
||||
function homerBooks(dir: string, work: keyof typeof HOMER_FILES): HomerBook[] | null {
|
||||
const path = join(dir, HOMER_DIR, HOMER_FILES[work]);
|
||||
if (!existsSync(path)) return null;
|
||||
const path = HOMER_FILES[work].map((f) => join(dir, HOMER_DIR, f)).find((p) => existsSync(p));
|
||||
if (!path) return null;
|
||||
let books = bookCache.get(path);
|
||||
if (!books) {
|
||||
books = splitBooks(readFileSync(path, "utf8"));
|
||||
|
||||
Reference in new issue
Block a user