- Replace the static nginx site with a small Node server: serves public/, stores plays on a /data volume and exposes a JSON API. Writes need a shared UPLOAD_PASSWORD; unpublished plays are hidden without it. - Page photos (shrunk to <=1.15 MP JPEG in the browser) are transcribed one request per page by a Claude vision model (claude-haiku-5-5 by default, CLAUDE_MODEL to change) into the play markup, then stitched together: speaker spellings unified, gaps in page numbers marked as missing pages, failed pages flagged. DAILY_PAGE_LIMIT caps spend. - New pages: library (play menu), add (upload + progress), editor (text next to the photos, checks for [?] readings and one-off names, publish, delete). The reader loads plays from the API and remembers the chosen role per play; old /?postava= links still work. - PDF export: text now flows across original pages and prints at the on-screen size, so A4 sheets are full instead of half empty; page numbers in the footer. - docker-compose.yml + .env.example for one-click deploys; the 1931 play moves to seed/ and is copied into an empty volume on first start. - Tests: parser leniency, transcription assembly, API end to end with a stubbed Claude client. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HA82gVRDXpoukzgMFumoJt
3 KiB
Divadelní čtečka (theater reader)
A small web app for reading play scripts during rehearsals.
Reading (anyone):
- a library of plays to choose from,
- choose a font (typewriter, Atkinson Hyperlegible, Lexend, Literata or the system font), the text size and colours (light, sepia, dark),
- pick your character: your lines are highlighted and ▲ ▼ (or
J/K) jump between them, - running text (hyphenation joined, spacing tidied) or the original typescript lines,
- reading mode (settings hidden), or export a PDF of your own copy: A4 sheets filled edge to edge at the size you chose, your lines highlighted. It goes through the print dialog, so choose "Save as PDF".
A link like read.html?hra=hra-1931&postava=Lída opens a play with the character already chosen, so a director can send each actor their own link.
Adding plays (anyone with the upload password):
- Přidat hru: give the title and pick a photo of each page.
- Each photo is read by a Claude vision model (Claude Haiku 5.5 by default) and turned into the script markup: speakers, stage directions, page numbers. Missing pages are noticed from gaps in the page numbers.
- The editor shows the text next to the photos and lists things to check (uncertain words marked
[?], characters who speak only once, pages that failed). Fix, tick Zveřejněno, save.
Deploying
cp .env.example .env && chmod 600 .env # then fill in the two secrets
docker compose up -d # or: podman compose up -d
The app listens on port 3010 on loopback (PORT and BIND_ADDRESS change that). Plays and photos are kept in the plays volume. On first start the volume is seeded with the 1931 play.
| Variable | |
|---|---|
ANTHROPIC_API_KEY |
API key from platform.claude.com. A Claude Pro/Max subscription can't be used for this. The API is billed separately, pay as you go. Without a key the app still works, but uploaded pages have to be typed up by hand. |
UPLOAD_PASSWORD |
Shared password for adding, editing and deleting plays. Unset = uploading switched off. |
CLAUDE_MODEL |
claude-haiku-5-5 (default, around $0.001 a page) or claude-sonnet-5-5 (reads hard pages better, roughly 20× the price). |
DAILY_PAGE_LIMIT |
Cap on pages transcribed per day, for all users together (default 300), so a leaked password can't run up a bill. |
MAX_PAGES |
Maximum photos per play (default 80). |
Without compose: docker build -t theater-reader . && docker run -d -p 127.0.0.1:3010:8080 -v plays:/data --env-file .env theater-reader.
The play included
seed/hra-1931/play.txt is a transcription of a 1931 typescript, pages 5–27. Pages 1–4 (probably the title page and cast list) and page 7 are missing from the original, and the text breaks off at the end of page 27. Once deployed, the play is edited in the app. The seed file is only copied into an empty volume.
Fonts are self-hosted under the SIL Open Font License (see public/fonts/OFL-*.txt).