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
@@ -41,14 +41,14 @@ class DownloadHistory:
|
||||
|
||||
def find(self, isbn: str) -> HistoryEntry | None:
|
||||
"""Look up a history entry by ISBN. Returns None if not found."""
|
||||
entry_dict = self._data.get(isbn)
|
||||
entry_dict = self._data.get(str(isbn))
|
||||
if entry_dict is None:
|
||||
return None
|
||||
return HistoryEntry(**entry_dict)
|
||||
|
||||
def is_downloaded(self, isbn: str) -> bool:
|
||||
"""Check whether an ISBN was previously downloaded."""
|
||||
return isbn in self._data
|
||||
return str(isbn) in self._data
|
||||
|
||||
def write(self, entry: HistoryEntry) -> None:
|
||||
"""Persist a history entry to disk."""
|
||||
|
||||
Reference in new issue
Block a user