check for doubles
This commit is contained in:
@@ -64,6 +64,14 @@ def run_sync(limit: int | None = None) -> None:
|
||||
total_batches = -(-len(new_zips) // batch_size) # ceiling division
|
||||
client = CalibreClient(cfg.calibre)
|
||||
|
||||
# Pre-load existing book titles so duplicate detection doesn't need per-book OPDS searches
|
||||
try:
|
||||
from uploader import fetch_all_books
|
||||
existing = fetch_all_books(cfg.calibre)
|
||||
client.preload_existing_titles(existing)
|
||||
except Exception as exc:
|
||||
log.warning("Could not pre-load existing books (%s) — will fall back to per-book OPDS search", exc)
|
||||
|
||||
for batch_num, i in enumerate(range(0, len(new_zips), batch_size), start=1):
|
||||
chunk = new_zips[i : i + batch_size]
|
||||
log.info("Batch %d/%d — processing %d zip(s)", batch_num, total_batches, len(chunk))
|
||||
|
||||
Reference in New Issue
Block a user