Skip to content

Add configurable upload template#32

Open
karimknaebel wants to merge 1 commit into
crosspoint-reader:masterfrom
karimknaebel:feat-upload-template
Open

Add configurable upload template#32
karimknaebel wants to merge 1 commit into
crosspoint-reader:masterfrom
karimknaebel:feat-upload-template

Conversation

@karimknaebel
Copy link
Copy Markdown

Add a upload template preference: Use the plugin template for upload paths when set, falling back to Calibre's send-to-device template when blank.

Relevant to issues #4 and #6

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3e8c980d-2138-4d28-b2e1-756a291b35f9

📥 Commits

Reviewing files that changed from the base of the PR and between 1877d96 and 275137a.

📒 Files selected for processing (3)
  • crosspoint_reader/README.md
  • crosspoint_reader/config.py
  • crosspoint_reader/driver.py
📜 Recent review details
🔇 Additional comments (9)
crosspoint_reader/README.md (1)

18-18: LGTM!

crosspoint_reader/config.py (6)

28-28: LGTM!


40-40: LGTM!


45-45: LGTM!


50-51: LGTM!


66-66: LGTM!


89-89: LGTM!

crosspoint_reader/driver.py (2)

213-213: LGTM!


222-226: ⚡ Quick win

Clarify/validate Calibre fallback behavior for self.save_template() when upload template is blank.

In crosspoint_reader/driver.py, a blank PREFS['upload_template'] triggers self.save_template() first, and only if that is falsy does it fall back to sconfig().parse().send_template. The plugin UI/README, however, states that leaving the field blank directly uses Calibre’s send-to-device template. The repo doesn’t define save_template() (so it’s inherited from Calibre), and the external findings so far don’t pin down whether Calibre’s save_template() returns an empty/falsy value when unset (which would make the behavior match the docs) or returns a non-empty default (which would contradict them).


📝 Walkthrough

Walkthrough

This PR introduces a user-configurable upload template preference for the Calibre CrossPoint plugin. Users can now set a custom upload template through the configuration UI, which is persisted and used with a defined fallback chain: the configured preference takes priority, followed by the internal save template, and finally the legacy Calibre send-to-device template if earlier sources are empty.

Changes

Upload Template Configuration

Layer / File(s) Summary
Configuration UI and preferences
crosspoint_reader/config.py
Adds upload_template to PREFS.defaults, creates a QLineEdit input field with placeholder text in CrossPointConfigWidget.__init__, includes it in the form layout, and persists the value in the save() method.
Template resolution with fallbacks
crosspoint_reader/driver.py
Updates _format_upload_path docstring and implements fallback resolution: prefers PREFS['upload_template'], falls back to self.save_template(), then to sconfig().parse().send_template.
Default settings documentation
crosspoint_reader/README.md
Documents the new "Upload template" default setting, clarifying that blank leaves it to Calibre's send-to-device template.

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add configurable upload template' accurately summarizes the main change: introducing a new configurable preference for upload templates.
Description check ✅ Passed The description clearly explains the feature being added: a user-configurable upload template preference with fallback behavior, and references relevant issues.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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