mirror of
https://github.com/jo1gi/grawlix.git
synced 2026-07-10 01:34:49 -06:00
download: skip-and-continue when a single book fails in a series
download_series only caught AccessDenied, so any other per-book error (e.g. a Nextory book whose epub package is missing the crypt_key) aborted the entire series/list download. Catch all per-book exceptions, log them, and continue; report the count of skipped books at the end. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
cacce0a493
commit
b816152d23
@ -126,13 +126,20 @@ async def download_series(source: Source, series: Series, args) -> None:
|
||||
:param series: Series to download
|
||||
"""
|
||||
template = args.output or "{series}/{title}.{ext}"
|
||||
failed: list = []
|
||||
with logging.progress(series.title, source.name, len(series.book_ids)) as progress:
|
||||
for book_id in series.book_ids:
|
||||
try:
|
||||
book: Book = await source.download_book_from_id(book_id)
|
||||
await download_with_progress(book, progress, template)
|
||||
except AccessDenied as error:
|
||||
except AccessDenied:
|
||||
logging.info("Skipping - Access Denied")
|
||||
except Exception as error:
|
||||
# Don't let one bad book abort the whole list; record and continue
|
||||
failed.append((book_id, error))
|
||||
logging.info(f"Skipping {book_id} - {type(error).__name__}: {error}")
|
||||
if failed:
|
||||
logging.info(f"{len(failed)} book(s) could not be downloaded and were skipped")
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user