The editor shows one original page next to its photo, with a page list,
page number and missing toggle, and highlights {uncertain} words. The
review dialog steps through them with the photo zoomed to about the
right line. Pages can be re-read from their photo or added from a new
photo, which fills a !N missing marker.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HA82gVRDXpoukzgMFumoJt
48 lines
4 KiB
Markdown
48 lines
4 KiB
Markdown
# 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):
|
||
|
||
1. *Přihlásit* (top right) with the upload password, then *+ Přidat hru*: give the title and pick a photo of each page. The same photo picked twice is skipped.
|
||
2. Each photo is read by a vision model, through OpenRouter (default `google/gemini-3.1-flash-lite`) or the Anthropic API (`claude-haiku-5-5`), and turned into the script markup: speakers, stage directions, page numbers. Missing pages are noticed from gaps in the page numbers.
|
||
3. Pages are put in order by the page number on each photo, so upload order doesn't matter, and a page photographed twice is used once (the clearer transcription wins; the editor lets you switch to the other one).
|
||
4. The editor shows one page at a time next to its photo. Words the model wasn't sure of are highlighted, and *Projít nejistá slova* steps through them one by one with the photo zoomed to about the right line: Enter accepts, a click picks the model's other reading. A page that failed or a page found later (*+ Z fotky*, which fills a `!7` "missing" marker) can be transcribed on its own. Fix, tick *Zveřejněno*, save.
|
||
|
||
## Deploying
|
||
|
||
```sh
|
||
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 | |
|
||
|---|---|
|
||
| `OPENROUTER_API_KEY` | Key from [openrouter.ai](https://openrouter.ai/settings/keys) (prepaid credit). Used for transcription when set. |
|
||
| `OPENROUTER_MODEL` | Any OpenRouter model that accepts images. Default `google/gemini-3.1-flash-lite` (about $0.0015 a page). `google/gemini-2.5-flash-lite` is cheaper. `anthropic/claude-haiku-5.5` and `google/gemini-3.5-flash` are alternatives if pages come out badly. |
|
||
| `ANTHROPIC_API_KEY` | Instead of OpenRouter: an API key from [platform.claude.com](https://platform.claude.com). **A Claude Pro/Max subscription can't be used for this.** The API is billed separately. |
|
||
| | Without either 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` | With the Anthropic key: `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`).
|