Let people add plays from photos; library, editor, compose; full-page PDF

- 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
This commit is contained in:
agent 2026-11-03 09:43:32 +00:00
parent 2608d10dd2
commit 46aa1236ed
32 changed files with 1761 additions and 160 deletions

View file

@ -6,68 +6,19 @@
<title>Divadelní čtečka</title>
<link rel="stylesheet" href="fonts/fonts.css">
<link rel="stylesheet" href="app.css">
<script type="module" src="app.js"></script>
<script type="module" src="library.js"></script>
</head>
<body>
<div class="layout">
<aside class="panel" aria-label="Nastavení">
<h1>Divadelní čtečka</h1>
<label class="field" id="play-field" hidden>
<span>Hra</span>
<select id="play"></select>
</label>
<p class="play-note" id="play-note"></p>
<label class="field">
<span>Moje postava</span>
<select id="role"><option value="">— žádná —</option></select>
</label>
<fieldset class="field">
<legend>Písmo</legend>
<div class="fonts" id="fonts"></div>
</fieldset>
<label class="field">
<span>Velikost písma <output id="size-out"></output></span>
<input type="range" id="size" min="14" max="30" step="1">
</label>
<fieldset class="field">
<legend>Podoba textu</legend>
<label class="radio"><input type="radio" name="layout" value="flow"> Plynulý text <small>čitelnější, doplněné mezery</small></label>
<label class="radio"><input type="radio" name="layout" value="original"> Jako v originále <small>řádky strojopisu</small></label>
</fieldset>
<fieldset class="field">
<legend>Barvy</legend>
<div class="seg" id="theme">
<label><input type="radio" name="theme" value="light"> Světlé</label>
<label><input type="radio" name="theme" value="sepia"> Sépie</label>
<label><input type="radio" name="theme" value="dark"> Tmavé</label>
</div>
</fieldset>
<div class="actions">
<button id="read" class="primary">Číst</button>
<button id="export">Exportovat PDF</button>
</div>
<p class="hint">PDF se ukládá přes dialog tisku – jako tiskárnu zvolte <b>Uložit jako PDF</b>. Pro barevné zvýraznění zapněte „Grafika na pozadí“, pokud ji prohlížeč nabídne.</p>
</aside>
<main class="script" id="script" tabindex="-1">
<p class="loading">Načítám text…</p>
</main>
</div>
<nav class="lines-nav" id="lines-nav" hidden aria-label="Moje repliky">
<button id="exit-read" class="exit" title="Konec čtení (Esc)">✕</button>
<button id="prev" title="Předchozí replika (K)">▲</button>
<span id="counter"></span>
<button id="next" title="Další replika (J)">▼</button>
<button id="smaller" class="read-only" title="Menší písmo">A−</button>
<button id="larger" class="read-only" title="Větší písmo">A+</button>
</nav>
<body class="page-library">
<header class="topbar">
<h1>Divadelní čtečka</h1>
<div class="topbar-actions">
<a class="button primary" id="add" href="add.html" hidden>+ Přidat hru</a>
<button id="logout" hidden>Odhlásit</button>
</div>
</header>
<main class="wrap">
<p class="muted">Vyberte hru, zvolte svou postavu a čtěte nebo si stáhněte vlastní PDF se zvýrazněnými replikami.</p>
<ul class="play-list" id="plays"><li class="muted">Načítám…</li></ul>
</main>
</body>
</html>