crabidy/plan/youtube-provider.md

46 lines
2.5 KiB
Markdown

# Plan: youtube-provider
Ordered tasks; each names its verification (tests in `ytdy/src/lib.rs`
and/or gates in `quality/youtube-provider.md`). The crate skeleton,
stubs, workspace/devenv wiring, and all tests exist; the tests fail on
`todo!()` at plan time.
- [x] **T1 — Engine.** `run` (argv-only, `--no-warnings`, cookie flag,
timeout with `kill_on_drop`, stdout cap, typed errors), `probe`,
`flat_listing`, `video_entry`, `stream_urls`. Verifies:
`engine_failures_are_typed_never_panics`, parts of every other test;
gates "Engine".
- [x] **T2 — Path parsing.** `parse_path` for all `YtPath` shapes;
reject everything else. Verifies:
`foreign_and_malformed_paths_are_rejected`,
`tracks_resolve_streams_and_metadata` (is_track_path).
- [x] **T3 — Init.** Settings parse (defaults on broken TOML like the
other providers), engine construction, `--version` probe, cookies
readability check (degrade to logged out with a warning). Verifies:
`init_probes_the_binary`, `root_lists_playlists_only_when_logged_in`.
- [x] **T4 — Search.** Term registry (snapshot/register),
`search_term_node` (`ytsearchN:`), `create/rename/delete_lib_node`,
`get_lib_node` arms for Root/Search/SearchTerm, central
downloadable rule. Verifies:
`search_terms_are_created_listed_and_searched`,
`search_terms_rename_and_delete`.
- [x] **T5 — Playlists + tracks.** `playlists_node` (feed URL, login
gate), `playlist_node`, `get_urls_for_track` (`-g`),
`get_metadata_for_track` (single-video `-J`). Verifies:
`playlists_list_and_resolve_when_logged_in`,
`tracks_resolve_streams_and_metadata`.
- [x] **T6 — Orchestrator wiring.** `youtube_client: Option<Arc<_>>`,
non-fatal init from `ytdy.toml` (written back), routing arms in every
method, root child; `extension_for` gains `audio/webm`. Verifies:
existing orchestrator patterns by inspection; gates "Orchestrator
wiring"; `extension_prefers_content_type_then_url_then_bin` extended.
- [x] **T7 — Full verification.** Workspace suite green; clippy/fmt/
taplo/markdownlint clean; every gate ticked; no `todo!()`.
- [x] **T8 — Live smoke test.** With the devenv `yt-dlp`: search a term
through the provider, fetch a stream URL for one result, and download
a small capture through the capture store — remove the probe
afterwards. Validate the playlists feed invocation if cookies are
available; otherwise record it as unvalidated in the summary.
- [x] **T9 — Docs.** `plan/summary.md` section incl. deviations;
reconcile `architecture/youtube-provider.md`.