refactor(downloader): shrink download_book to 4 domain params

Replace 9-parameter signature (book, client, output_base, history,
format_strategy, config, transport, progress, cancel_event) with
4 domain-aligned parameters (book, session, plan, reporter) that
return a frozen DownloadResult dataclass.

Key changes:
- Add DownloadResult(status, path, format, error) frozen dataclass
- Add format_strategy field to OutputPlan
- Move history writing from download_book() to caller (cli closure)
- Remove config param from download_accompanying_files()
- Wire cancel_event through reporter.cancel_event attribute
- Extract transport from session._client._transport

Closes #29

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
AlexKuceraandClaude Opus 4.6 committed 2026-06-05 07:34:01 +02:00
1 parent 0ee8186361
commit 9ac581e5b7
11 files changed
+492 -174

No files matched your search

+7
View File
@@ -21,6 +21,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
eliminating duplicated audio-filename logic. 237 tests pass (+10 new).
Closes #28.
- **downloader:** Shrink download_book() from 9 parameters to 4
domain-aligned params (book, session, plan, reporter) returning a frozen
DownloadResult dataclass. Move history writing to caller (cli closure).
Add format_strategy to OutputPlan, wire cancel_event through reporter,
extract transport from session. Remove config from accompanying_files.
368 tests pass (+15 new). Closes #29.
10:9bb|### Fixed
- **progress:** Wire task_id through parallel progress callback.
All concurrent download updates went to the same (most recently started) bar