Skip to content

feat: adding support for output to litara#897

Closed
deranjer wants to merge 1 commit intocalibrain:mainfrom
deranjer:de/litara-output-option
Closed

feat: adding support for output to litara#897
deranjer wants to merge 1 commit intocalibrain:mainfrom
deranjer:de/litara-output-option

Conversation

@deranjer
Copy link
Copy Markdown

@deranjer deranjer commented Apr 17, 2026

Following booklore's setup, this adds support for litara ereader upload to book drop. Unlike booklore litara does not support uploading directly to libraries, it must go through the book drop process. This allows shelfmark to submit a file directly to litara's book drop, which allows the admin to approve the book and that adds it to the library.

EDIT: Ah, should have looked at the Makefile closer. Let me run all the required tests, add a test file for litara, then update this PR.

Copilot AI review requested due to automatic review settings April 17, 2026 01:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Litara (API) delivery output so Shelfmark can upload completed ebook downloads to Litara’s Book Drop flow (admin-approved ingestion), mirroring the existing Booklore/Grimmory output integration patterns.

Changes:

  • Added a new litara output handler that logs in, uploads prepared files to Litara Book Drop, and optionally triggers a library scan.
  • Exposed Litara configuration and a “Test Connection” action in the Settings UI (plus per-user output mode override option).
  • Updated docs to include the new output mode, environment variables, and custom-script output details.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/frontend/src/components/settings/users/UserOverridesSection.tsx Adds Litara to per-user output mode override UI and normalization.
shelfmark/download/outputs/litara.py New Litara output handler (login, upload to book drop, scan, custom-script context, staging cleanup).
shelfmark/download/outputs/init.py Ensures Litara output handler is loaded into the output registry.
shelfmark/config/settings.py Adds Litara output mode option + Litara settings fields and connection test button.
shelfmark/config/litara_settings.py Implements “Test Connection” action using Litara login.
docs/users-and-requests.md Documents Litara as an available per-user output mode choice.
docs/environment-variables.md Documents Litara env vars + adds litara to BOOKS_OUTPUT_MODE options.
docs/custom-scripts.md Documents Litara in output-mode/phase semantics and JSON payload output.details.
docs/configuration.md Notes Litara (API) behaves like Booklore (API) (API upload vs writing to /books).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 21 to +24
{ value: 'folder', label: 'Folder' },
{ value: 'email', label: 'Email (SMTP)' },
{ value: 'booklore', label: 'Grimmory (API)' },
{ value: 'litara', label: 'Litara (API)' },
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The frontend has a shared BooksOutputMode union type (used by AppConfig.books_output_mode) that still only allows 'folder' | 'booklore' | 'email'. With this new mode option, that type (and any related switch/guards) should be updated to include 'litara' so TypeScript can correctly represent the config value and downstream UI logic can handle the new mode explicitly.

Copilot uses AI. Check for mistakes.
{
"value": "litara",
"label": "Litara (API)",
"description": "Upload files directly to Litara",
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output-mode option description says "Upload files directly to Litara", but this integration uploads to Litara Book Drop (admin approval flow) rather than directly into a library. Updating this description to explicitly mention Book Drop will prevent user confusion and better match the behavior/heading text below.

Suggested change
"description": "Upload files directly to Litara",
"description": "Upload files to Litara Book Drop",

Copilot uses AI. Check for mistakes.
Comment on lines +363 to +369
@register_output(LITARA_OUTPUT_MODE, supports_task=_supports_litara, priority=10)
def process_litara_output(
temp_file: Path,
task: DownloadTask,
cancel_flag: Event,
status_callback: StatusCallback,
*,
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is good test coverage for the Booklore output handler (upload endpoint selection, unsupported formats, router integration, custom-script payload). This new Litara output handler introduces similar behavior (login, upload, unsupported-format rejection, post_upload script context), but there are no corresponding tests yet. Adding unit tests for litara_login/litara_upload_file and an integration-style router test for BOOKS_OUTPUT_MODE=litara would help prevent regressions.

Copilot uses AI. Check for mistakes.
@deranjer deranjer marked this pull request as draft April 17, 2026 02:24
@alexhb1
Copy link
Copy Markdown
Collaborator

alexhb1 commented Apr 17, 2026

Hi, appreciate the work, but given Litara looks very new i'd prefer to avoid the precedent of adding too many custom output options immediately when a new app is launched. I presume Litara has a bookdrop folder that would work with shelfmark's folder output, no API required?

@alexhb1 alexhb1 closed this Apr 17, 2026
@deranjer
Copy link
Copy Markdown
Author

Yes, it has a bookdrop folder.

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.

3 participants