S012: the choice of a stream is kept, plan done

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
astar76 2026-11-25 13:57:12 -06:00
commit cac5f242d4
2 changed files with 42 additions and 14 deletions

View file

@ -55,3 +55,6 @@
- D-053 — 2026-11-25 — A mirror is used only after S008's comparison with what is here (verdict same or probably same, at least 16 KiB here) and, where no version proves it, after two more places that the base and the mirror must both have. Whoever is caught with other bytes is dropped and all it gave comes again; between the base and a mirror the mirror is the liar. If the first link fails, the next one that passes becomes the base. Each connection goes to the server that brings the most per connection, an untried one first; a connection four times slower than another server's moves there. — A wrong byte costs more than a slow start — 02, 06
- D-054 — 2026-11-25 — Files are compared under their unfinished name, before they get their own, in the state `checking` (no place in the queue); `Checking` may go back to `Running` (pieces) and, for a file that was done before, to `Done`, which is no new finish. `Task::verified` holds what the file matched, so a new checksum counts as open by itself. The whole file's hash counts more than its pieces'. — A bad file never appears finished — 03, 05
- D-055 — 2026-11-25 — Headers give mirrors only with a `Digest` or `Repr-Digest` (RFC 6249); they and a linked metalink fill only what the task doesn't have. Sidecars are looked for only when asked. Metalinks are read by quick-xml within limits; a document type or an unknown entity refuses the file. — No extra requests, nothing to expand — 02, 06
- D-056 — 2026-11-25 — Streams are kept as pieces in one unfinished file with a record before each (`stream::tape`), and joined by ffmpeg with `-c copy` from sockets of this user: mp4 (m4a for sound alone) or what the name asks for, mkv where that can't hold it. — One file moves and bins like any other; needs twice, not three times the space. — 02, 06
- D-057 — 2026-11-25 — ffmpeg never opens links of lists: Medlar fetches all of HLS and DASH itself (proxy, logins, limits), and ffmpeg may open only `unix` sockets and known formats. For RTSP and MMS it connects itself, never when a proxy is set; logins go through its standard input. — Lists come from strangers; arguments are seen by all. — 02, 06
- D-058 — 2026-11-25 — Any sign of protection refuses the whole stream (`ErrorKind::Drm`): `ContentProtection`, keys other than AES-128 with `identity`, protected boxes in the first piece. — CLAUDE.md 4. — 02, 06

View file

@ -170,5 +170,15 @@ Not done: the Fix for `Checksum` in the list is the general `Choose` menu, not `
Verified: `nice cargo test -j 2 -p medlar-core --test mirror` green (13, three times; 36 to 49 s), all of core and clippy green with the S012 and S016 work of that moment. Covered: fast and slow mirror, other file, short file, page, caught liar, corrupt pieces, dead first and later links, all five kinds, paste, sidecars, headers, both metalinks, hostile XML, rot on disk, pause while checking.
Seen: boxes 2 to 5 were ticked together after the tests. A copy of the tree built into the shared target makes cargo take its artifacts for fresh ones of the real tree: never do that.
## S012 — HLS, DASH, RTSP and MMS (2026-11-25)
Done: `core::stream` (`ffmpeg`, `hls`, `dash`, `fetch`, `tape`, `join`, `record`), `http::piece`. Choices: D-056 to D-058. Outside the plan's files: `Task::stream` (migration 005), `Command::Finish`, the manager runs streams, `Monitor::finish`, kinds `tool`, `drm`, `media`. New crates: `aes`, `cbc`, `roxmltree` (were in the lock), tokio's `process`.
Verified: `nice cargo test -j 2 -p medlar-core --test stream` green (15; ffprobe says 6 s, ffmpeg decodes each file without a complaint), all other core tests and clippy green on d26c59e (`parts` benchmark once under load, green alone).
- A task is a stream by link or type (`stream::kind_of`); it then runs, pauses, renames and goes on like any other. `task.stream: Option<Choice>` is the quality, language and limits (`seconds`, `bytes`); None is the best.
- **Probe result** (S016, S025): `stream::probe(&client, &source, &mut stop) -> Found { kind, live, duration, videos, audios }`, best first; `Variant { id, bandwidth, size, codecs, language, name, sound, preferred }`. `Pick::One(variant.id)` in the choice. The Add dialog should use it where `stream::kind(&url, mime)` says so.
- Stop a recording and keep it: `Command::Finish(id)`, also when paused. Pause keeps it to go on later. The size shown is a guess from its length until it is done.
- S025, S026: `Tools::find().ffmpeg()?`, `Job::new()` + `input`, `file` or `pipe`, `start` → `Running` (`progress()`, `finish()`, `kill()`, `end()` → `Failed { tail }`, `.error()`). Logins go through `stdin`.
Not done: subtitles; rtsps (its certificate can't be checked); HLS low-latency parts; `Command::Continue` with a new link for a stream (edit the link instead); a pause drops pieces under way (up to 4); no UI for choice and Finish. RTSP and MMS were tried against stubs only (PCMU over TCP, ASF over HTTP), HLS and DASH against ffmpeg's own; no real server.
Seen: tested in a second checkout on the shared target; S009 saw stale artifacts from it. Use a target of its own for that. Boxes were ticked together at the end, against rule 3.
## Later
-