Skip to content

Commit cd5896f

Browse files
committed
Add media-server OpenAPI specs & UI updates
Add upstream OpenAPI specs for Emby, Jellyfin and Plex under api_reference/ for adapter development, and add CLAUDE.md as a project overview. Update frontend components (ConfigPage.svelte, EnrichDialog.svelte, HistoryPage.svelte) and backend modules (api.rs, config.rs, media.rs, mining.rs, session.rs) to integrate enrichment, session tracking and configuration changes.
1 parent 41fb965 commit cd5896f

13 files changed

Lines changed: 169411 additions & 170 deletions

CLAUDE.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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.

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)