Files
leaguerecorder/app/README.md
T
vhaudiquet 297118cfc1
record-daemon / Build, check and test (push) Failing after 1m15s
app: download ffmpeg on the first run, not the first export
Clip export needs ffmpeg, and the app fetched it when an export was
asked for: a minute of nothing at the worst moment, with the export
sitting behind it. The run that follows an install now fetches it in
the background and narrates the download in the notice banner; the
notice is updated in place and leaves another notice alone. A hidden
start (the login item) skips the fetch and leaves it to the export.

Only ffmpeg.exe is unpacked. The archive also carries ffplay and
ffprobe, which the export paths never call: unpacking all three put
370 MB beside the exe instead of 105 MB.

An export asked for while the download runs says so instead of
starting a second download over the same directory, and --fetch-ffmpeg
runs the same fetch from a shell, printing progress.

Checked on this machine: --fetch-ffmpeg downloaded in about 20 s,
unpacked, and answered "ready"; a second run returned at once.
2026-11-19 22:23:08 +01:00

133 lines
7.0 KiB
Markdown

# League Recorder (rune app)
The native replacement for `tauri-app`. It talks to `record-daemon` over the daemon's existing
named-pipe protocol and draws with [rune](https://github.com/anomalyco/rune).
## Run it
```sh
cargo run
```
The binary is a windowed app on Windows (`windows_subsystem = "windows"` in `main.rs`), so
launching it from Explorer, the Run key or the login item never opens a console. The printing
modes still work from a shell: `attach_console` borrows the console of whatever started the app,
and nothing happens when nothing did.
The app starts the daemon if it isn't running, then reads its settings and status. `cargo run --
--probe` does the same without a window and prints the daemon's answers; `cargo run -- --games`
prints how many timelines load from disk.
Headless renders, for looking at a screen without a window:
```sh
cargo run -- --snap history.png --scene history
cargo run -- --snap settings.png --scene settings
cargo run -- --snap recording.png --scene recording
cargo run -- --snap audio.png --scene audio
cargo run -- --snap review.png --scene review
cargo run -- --snap many.png --scene many --at 1 # 60 sample games, to see the scrollbar
```
Pass `--at 1` when the screenshot depends on a laid-out size (the scrollbar does): layout callbacks
run after the first frame.
`--live` renders without sample data: the app talks to the daemon and reads the real timelines
from disk. Loading them takes a few seconds with a large history, so give it time before `--at`.
```sh
cargo run -- --snap live.png --live --at 40
```
Without `--live`, a headless run never starts the daemon and reads no recording: `App::new` loads
the sample recordings from `history::sample` when it sees rune's tooling flags. Portraits still
come from the Data Dragon cache (or download into it) so the PNGs show real champion faces.
## Test
```sh
cargo test
```
The tests pin the wire format the daemon parses (`ipc::tests`, `settings::tests`), timeline
reading (`history::tests`), highlight clipping (`highlight::tests`) and formatting.
## Layout
| File | What it holds |
| --- | --- |
| `src/main.rs` | Entry point, single instance, notifications, app spec, `--probe` |
| `src/app.rs` | App state, `poll` (daemon answers, tray events, status), screen dispatch |
| `src/ipc.rs` | Protocol types and the named-pipe client, on a worker thread |
| `src/daemon.rs` | Finding, starting and logging the daemon |
| `src/settings.rs` | The daemon's settings model, field for field |
| `src/history.rs` | Timelines from disk and the values the cards show |
| `src/portraits.rs` | Champion portraits: the Data Dragon cache and its downloads |
| `src/highlight.rs` | Highlight clips from kill events |
| `src/export.rs` | ffmpeg clip export |
| `src/os.rs` | Run key, toasts, tray icon and menu |
| `src/ui.rs` | Colours, cards, switches, sliders, buttons |
| `src/screens/` | Settings, match history, game review |
## Where this stands against TODO.txt
1. Skeleton: done. Rune is pinned to `4ddf696b0f13ec618fdeb80b4c9ea1a6246547f1`; the window
opens and `--snap` writes PNGs.
2. Pipe client: done and checked against the running daemon here: `--probe` prints status,
settings, encoders and audio devices, and parses the settings reply with the app's model.
Requests are typed (`Command`), the worker thread keeps the UI off tokio, and the same types
are tested against the daemon's serde names.
3. Settings: done. General, recording, audio and daemon tabs; device and encoder lists come from
`getAudioDevices` and `getEncoders`; changes go out through `updateSettings`, and each
application volume slider sends `updateAudioSource` as it moves.
4. Match history: done. Cards read `GameHistory.vue`'s fields (result, champion portrait,
queue, KDA, CS/m, gold/m, LP change) from the raw API responses in each timeline, with the
queue filters. Portraits come from Data Dragon and are cached on disk (`src/portraits.rs`).
The list holds rows, not timelines: `history::summaries` parses each file, keeps a
`Summary`, and drops the timeline with its events and raw responses, 20 rows at a time as
the list scrolls. Opening a row reads that one timeline again, on a thread, and the review
screen fills in when it arrives. Peak over 313 recordings: 165 MB, down from 2.1 GB.
5. Video: not libmpv. Rune ships a `Player` with a native surface and frame seeking
(`Player::file`, `seek`, `duration`), which removes the OpenGL and wgpu interop question the
TODO opened. The review screen uses it. If clip-accurate seeking turns out to be worse than
mpv's, the three options in TODO.txt still apply; `Player` is confined to `screens/review.rs`.
6. Game review: done. The clip fills the window at 16:9, with play/pause, +/-10 s, and a
scrubber that marks every event; highlights (play, export) and the timeline sit in a side
panel, one press away. ffmpeg exports each highlight.
7. Audio channels: the recorder writes one audio stream per source, and the review screen opens
one player per stream (`export::extract_tracks` copies each into the audio cache). Toggles
under the transport mute a channel for listening, and clip and highlight exports mix only
the channels left on. Recordings made before the split play as one mixed track.
8. OS integration: tray icon with open/hide/record/quit, launch at login through the Run key,
single instance, and toasts on recording start and stop.
9. Installer: `packager.toml` targets NSIS and copies the daemon, its OBS files and the VC++
runtime beside the exe. `cargo install cargo-packager --locked && cargo packager --release`.
On the first run the app downloads ffmpeg (`--fetch-ffmpeg` does it from a shell), so clip
export is ready before the first clip. The installer has not been run on a clean VM yet.
10. Parity: `tauri-app` is still in the tree. Delete it once the items above are verified on a
machine with a live League Client.
### Known gaps
- Item images are not drawn. Champion portraits download from Data Dragon on first sight and are
cached under the user's cache directory; offline, a card falls back to initials on the
champion's colour.
- The installer has not been run on a clean VM, and it is unsigned: SmartScreen will warn on
every download until it is signed. The VC++ runtime travels with it (`vendor/vcruntime`),
because Windows ships the UCRT but not `VCRUNTIME140.dll`, `VCRUNTIME140_1.dll` or
`MSVCP140.dll`, and the app, the daemon and every OBS plugin import them.
## The vendored crates
`vendor/` also holds `vcruntime/`: the three redistributable DLLs the installer puts beside
the exes, copied from a machine with Visual Studio's runtime installed.
`vendor/` holds three crates copied from rune's own `vendor/`: `wgpu-hal`, `winit` and
`parley_engine`. Rune builds against patched copies of these, and a dependency's
`[patch.crates-io]` does not apply to the app that depends on it, so `Cargo.toml` repeats the
patches here. They match the rune rev above; when the rev moves, refresh them from that checkout:
```sh
cp -r ../rune/vendor/{wgpu-hal,winit,parley_engine} vendor/
```