check for doubles
This commit is contained in:
+2
-2
@@ -174,9 +174,9 @@ def fetch_all_books(cfg: CalibreConfig) -> list[dict]:
|
|||||||
data = resp.json()
|
data = resp.json()
|
||||||
# Calibre-Web uses DataTables format: "data"/"recordsTotal", older versions use "rows"/"total_count"
|
# Calibre-Web uses DataTables format: "data"/"recordsTotal", older versions use "rows"/"total_count"
|
||||||
rows = data.get("rows") or data.get("data") or []
|
rows = data.get("rows") or data.get("data") or []
|
||||||
total = data.get("total_count") or data.get("recordsTotal") or data.get("recordsFiltered") or 0
|
total = data.get("total") or data.get("totalNotFiltered") or 0
|
||||||
all_books.extend(rows)
|
all_books.extend(rows)
|
||||||
log.info("Books fetched: %d so far (page start=%d, page_size=%d, total=%d)", len(all_books), start, len(rows), total)
|
log.info("Books fetched: %d / %d", len(all_books), total)
|
||||||
if not rows or len(all_books) >= total:
|
if not rows or len(all_books) >= total:
|
||||||
break
|
break
|
||||||
start += len(rows)
|
start += len(rows)
|
||||||
|
|||||||
Reference in New Issue
Block a user