|
| 1 | +# Nagare |
| 2 | + |
| 3 | +Subtitle mining tool for Emby / Jellyfin / Plex. A Rust (axum + tokio) backend |
| 4 | +watches media-server playback sessions and AnkiConnect, then enriches Anki cards |
| 5 | +with audio, screenshots, and sentence/translation context. A Svelte frontend |
| 6 | +provides the player-side UI and configuration. |
| 7 | + |
| 8 | +## Layout |
| 9 | + |
| 10 | +- `src/` — Rust backend |
| 11 | + - `api.rs` — axum HTTP/WebSocket routes, enrichment pipeline (`perform_enrichment`) |
| 12 | + - `config.rs` — `Config` and all persisted settings (serde). Stored as JSON in SQLite (`app_config`) |
| 13 | + - `anki.rs` — AnkiConnect client + the poller/AnkiBeacon push loop (`run_anki_poller`) |
| 14 | + - `mining.rs` — SQLite persistence (config, media history, mined notes) |
| 15 | + - `session.rs` — media-server session tracking, history entries, subtitle loading |
| 16 | + - `media.rs` — ffmpeg audio/screenshot/AVIF generation |
| 17 | + - `subtitle.rs` — subtitle parsing + sentence-to-line matching |
| 18 | + - `media_server/` — per-server adapters: `mediabrowser.rs` (Emby/Jellyfin), `plex.rs`, shared types in `mod.rs` |
| 19 | +- `frontend/src/` — Svelte app |
| 20 | + - `lib/ConfigPage.svelte` — settings UI (tabbed: Server / Anki & Media / Frontend) |
| 21 | + - `lib/EnrichDialog.svelte` — the card enrichment dialog |
| 22 | + - `lib/stores.js`, `lib/api.js` — client state and backend calls |
| 23 | +- `api_reference/` — **third-party media-server OpenAPI specs** (see below) |
| 24 | + |
| 25 | +## API reference |
| 26 | + |
| 27 | +When working with the media-server adapters in `src/media_server/`, consult the |
| 28 | +upstream OpenAPI specifications in [`api_reference/`](api_reference/) rather than |
| 29 | +guessing endpoint shapes or field names: |
| 30 | + |
| 31 | +- `api_reference/emby_openapi.json` — Emby |
| 32 | +- `api_reference/jellyfin-openapi-stable.json` — Jellyfin |
| 33 | +- `api_reference/plex_openapi.json` — Plex |
| 34 | + |
| 35 | +These are large; search them for the specific endpoint/field instead of reading |
| 36 | +them whole. |
| 37 | + |
| 38 | +## Build & check |
| 39 | + |
| 40 | +- Backend: `cargo check` / `cargo build` / `cargo test` (run from repo root) |
| 41 | +- Frontend: `npm run build` (or `npm run dev`) from `frontend/` |
| 42 | + |
| 43 | +## Notes |
| 44 | + |
| 45 | +- Config is persisted via SQLite, not a flat file; `Config::save_to` is legacy. |
| 46 | + The `mining.auto_approve` field is a migrated client-local setting and is |
| 47 | + stripped server-side. |
| 48 | +- Series tagging (`anki.series_tag_parent`): when set, enrichment adds a |
| 49 | + `parent::Series_Name` tag in `perform_enrichment`. The series name comes from |
| 50 | + the media server's metadata (`NowPlaying.series_name`), plumbed through |
| 51 | + `NowPlayingState` / `HistoryEntry` (persisted in the `media_history` table) and |
| 52 | + `MediaContext`; movies fall back to the bare title. |
0 commit comments