Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using calibredb for upload processing #3087

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jgoguen
Copy link

@jgoguen jgoguen commented Jun 26, 2024

Some things calibre is able to do via plugins that would be helpful to handle in calibre-web, but there's not much point in re-implementing those in calibre-web directly. Things like importing ACSM files and getting the resulting ebook directly, or importing KFX files that require extra processing. Currently, to keep the ability to use the Kobo sync service, the solution is to run both calibre-web and calibre-server and switch between them. Running calibre-server adds to smooth usability issues since using GUI calibre risks conflicting with calibre-server unless you remember to stop it every time you use GUI calibre. If your calibre library is stored on a shared folder, such as Google Drive or OneDrive or Dropbox, a conflict with calibre-server is guaranteed when using GUI calibre since the modified metadata.db is moved into place as a new file, with a new inode, causing calibre-server to be unable to continue using its existing database connection.

To accommodate using calibredb for uploads, avoiding conflicts between calibre and calibre-server, and allowing everything to happen in one interface instead of switching between calibre and calibre-web, this PR:

  • Adds a new setting, linked to the main upload permission, to use calibredb for uploading files. Default value, or the behaviour if calibredb is not found, is to keep the existing behaviour of having calibre-web process the uploaded books and add them to the calibre database.
  • Adds the location the linuxserver Docker image installs calibre to the list of paths searched for calibre binaries
  • Adds the chunk of code to upload() in editbooks.py to shell out to calibredb
  • Appends the original file extension to the temporary file path, since calibredb needs that for format detection

Some things calibre is able to do via plugins that would be helpful to handle in calibre-web, but there's not much point in re-implementing those in calibre-web directly. Things like importing ACSM files and getting the resulting ebook directly, or importing KFX files that require extra processing. To accommodate this, and allowing everything to happen in one interface instead of switching between calibre and calibre-web, this PR adds:

- A new setting, linked to the main upload permission, to use calibredb for uploading files
- The location the linuxserver Docker image installs calibre to the list of paths searched for calibre binaries
- The chunk of code to `upload()` in `editbooks.py` to shell out to `calibredb`
- The original file extension to the temporary file path, since calibredb needs that for format detection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant