mirror of
https://git.pumpin.online/funkpower/catena.git
synced 2026-11-14 08:05:40 +00:00
bookmeta, bibfetch, bindings: what a caller needs to trust a cover
bookmeta: Cover::guessed says the file left the choice open — a Kindle book's first image record, or an EPUB image picked because its name says cover — so a caller with a register to ask can prefer that. A cover the file names is never a guess. Cover::extension matches bibfetch's. bibfetch: Open Library answers 403 to more than a hundred covers by ISBN in five minutes from one address. That is now Error::Limited, not Unreachable: the other form of the ISBN is not asked, the cover id still is, since those are not limited, and the CLI exits 75. Covers asked by ISBN are kept three seconds apart across the process (Covers::pace), which stays under the limit however long a run goes. A deadline too long to add to the clock no longer panics; it is no deadline. bindings: fetch_cover and search_title for Python, and catena.Limited, which fetch_identifier raises too when a register refuses for being asked too often. corpus-core: exit 75, a service refused for now.
This commit is contained in:
14 files changed
+334
-16
No files matched your search
@@ -136,6 +136,14 @@ redirect included, stops after two minutes. The two minutes start once it is
|
||||
the fetch's turn, so a fetch queued behind others in the same process can wait
|
||||
that long again first.
|
||||
|
||||
Open Library allows a hundred covers by ISBN every five minutes from one
|
||||
address, and refuses the rest with `403`. Covers asked by ISBN are kept three
|
||||
seconds apart across the whole process (`Covers::pace`), which stays under that
|
||||
limit however long a run goes. A refusal all the same is not mistaken for an
|
||||
outage: the other form of the ISBN is not asked, the cover id is, because
|
||||
Open Library does not limit those, and with no cover found that way the fetch
|
||||
fails with `Error::Limited`, which means ask again later.
|
||||
|
||||
| Option | Effect |
|
||||
|---|---|
|
||||
| `-o`, `--output <FILE>` | Where to write the image |
|
||||
@@ -144,7 +152,8 @@ that long again first.
|
||||
|
||||
Exit `0` the cover was written, `1` Open Library has none, `65` the argument
|
||||
was not an ISBN or the answer was not an image, `69` Open Library could not be
|
||||
reached, `74` the file could not be written.
|
||||
reached, `74` the file could not be written, `75` Open Library refused for
|
||||
being asked too often and will answer later.
|
||||
|
||||
From Rust, `bibfetch::cover(&agent, isbn, cover_id, size)` returns
|
||||
`Ok(None)` when there is no cover, and a [`Cover`](src/cover.rs) with the
|
||||
|
||||
Reference in new issue
Block a user