Calibre content server - #89
Open
benjitobz wants to merge 5 commits into
Open
Conversation
Pushes imported ebooks to a calibre content server (e.g. Calibre-Web Automated) one at a time, skipping duplicates. Optional edit and delete sync, off by default: when enabled, book deletes, retags and upgrades in Chaptarr are propagated to the content server. Connection URL is required; username and password are optional and the connection can be verified with the standard test button.
Calibre stores the title embedded in the pushed file, which can carry series decorations the Chaptarr title lacks (and vice versa), so both sides are compared with trailing parentheticals stripped and punctuation-insensitive normalization. No-match on delete now logs at info so it is visible without debug logging.
Testing with a read endpoint gave false passes: the shared credential cache answers auth challenges with credentials cached by other requests to the same host, and open-mode servers accept anonymous reads while rejecting remote anonymous writes. The test now POSTs an empty body to cdb/add-book (no side effects) with sentinel credentials when none are configured, so missing or wrong credentials fail deterministically. Empty URL now validates with a clear message instead of a raw placeholder.
Calibre answers malformed Basic credentials (empty password) with 400 rather than 401, which the connection test read as passing the auth gate. Validation now rejects a username without a password before any request is made, mirroring the existing password-without-username rule.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a connect notification for the "Calibre Content Server":
"Allow Edits & Deletes" checkbox that's off by default.
cdb/add-book, sequentially — thecontent server would rather take them one at a time. Audiobook files are skipped.
add_duplicates=0, so a book the library already has is skipped and loggedinstead of duplicated.
matching book on the server, and a retag or an upgrade replaces it. With it off none of those
handlers do anything, so the integration stays add-only until you opt in.
Quick note on "edits and deletes":
Edits and deletes have to find the book in the calibre db first. That match is by author, then by title, with case and punctuation removed and a trailing parenthetical stripped from both sides. calibre takes its title from inside the epub, and those usually carry decorations the Chaptarr title doesn't — "Out of Spite, Out of Mind (Magic 2.0 Book 5)" where Chaptarr has plain "Out of Spite, Out of Mind" — so comparing the two literally matches nothing, quietly. Normalising keeps it an equality test rather than a fuzzy one, so it can't wander onto a neighbouring book in the same series, and a delete that comes up empty logs that instead of reporting success.
Validation
cdb/add-book, the same endpoint pushes use.calibre checks auth and the write permission before it looks for a body, so a server that
would accept books answers
400("A request body containing the file data must bespecified") and one that wouldn't answers
401or403. Nothing is added — checked againsta live library by count.
credential cache can't answer the challenge on its behalf.
400for that case is indistinguishable from the "authenticated, no body"
400the test wants.Invalid Url: '{url}'with the placeholder unfilled.401reports authentication failed,403reports that the server doesn't accept anonymouschanges and needs credentials,
404and redirects report that the URL isn't a content server— pointing at Calibre-Web's web UI instead of the content server port lands here.
Related PRs
Calibre-Web can't run calibre's content server itself, which is the other half of this. PRs are
up for Calibre-Web and both forks:
Database Migration
NO.
How was this tested?
tracked download push and show up in the library, re-imports skip as duplicates, a delete
with the option off leaves the server alone and with it on removes the right book, and each
of the failing test cases above against both an authenticated and an anonymous server.
Screenshots - Not really a change but this is how it looks