feat(downloader): add M4B download pipeline with resume (closes #5)
Add streaming chunked M4B download via .partial files and atomic rename, resume support through HTTP Range headers, full CLI orchestration loop, --verbose flag, and config/secrets templates. Fix 4 API-shape bugs found during live testing: library endpoint returns audiobooks not books, M4B endpoint returns m4b_url not url, narrators nested under audiobook_info, and ISBN int/str type mismatch in history lookup causing re-downloads. 12 new tests (109 total). 6 books downloaded live (~2.9 GB).
This commit is contained in:
1 parent
25ee66b95d
commit
33aa80b7aa
11 files changed
+989
-15
No files matched your search
+21
-1
@@ -8,11 +8,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
- M4B download pipeline: streaming chunked download with .partial files,
|
||||
atomic rename to .m4b, resume support via HTTP Range header
|
||||
- `fetch_m4b_url()` client method for M4B download URL lookup
|
||||
- `download_book()` orchestration: resolve path → query M4B → download →
|
||||
write history; returns None when book has no M4B available
|
||||
- Full CLI download loop with per-book status, summary counts, and --verbose
|
||||
flag showing config/auth/library/download details
|
||||
- `config.yaml` template and `secrets.yaml` gitignored credentials file
|
||||
- 12 new tests covering M4B query, streaming download, resume, path
|
||||
integration, subdirectory logic, history post-download, skip behavior,
|
||||
and verbose output (109 total)
|
||||
|
||||
### Fixed
|
||||
- Library endpoint key mismatch: API returns "audiobooks" not "books"
|
||||
- M4B endpoint key mismatch: API returns "m4b_url" not "url"
|
||||
- Narrators nested under `audiobook_info.narrators` in API response
|
||||
- ISBN type mismatch in history lookup: JSON keys are strings but API
|
||||
returns ISBN as integer — added str() coercion in find/is_downloaded
|
||||
- Missing download loop in CLI run() function (listed books but never downloaded)
|
||||
|
||||
### Changed
|
||||
- Initial project scaffolding: pyproject.toml, package structure, test suite
|
||||
- Config module with YAML loading, secrets deep-merge, validation, and defaults
|
||||
- OAuth2 client with password grant auth and paginated library fetch
|
||||
- Download history tracking with corrupt JSON recovery
|
||||
- CLI skeleton wiring config → auth → library → filter → print
|
||||
- Path resolution with default conditional patterns and custom token substitution
|
||||
- Filesystem-safe component sanitization (illegal chars, control chars, colons)
|
||||
- Immutable Book dataclass for typed book metadata
|
||||
|
||||
Reference in new issue
Block a user