Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 05-15-2026, 02:34 PM   #1576
Wiggo
Leftutti
Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.
 
Wiggo's Avatar
 
Posts: 624
Karma: 3671119
Join Date: Feb 2019
Location: Bavaria
Device: iPad Pro, Kobo Libra 2
Quote:
Originally Posted by bluefish2020 View Post
If no existing chains exist I'd probably make a new module like this one:

Spoiler:
Code:
from calibre_plugins.action_chains.actions.base import ChainAction
from calibre.utils.titlecase import titlecase

class MyAction(ChainAction):

    # replace with the name of your action
    name = 'Title Case'
    support_scopes = True

    def run(self, gui, settings, chain):
        api = gui.current_db.new_api

        selected_books = chain.scope().get_book_ids()
        old_titles = api.all_field_for("title", selected_books, None)
        new_titles = {k: titlecase(v) for k, v in old_titles.items()}
        updates = {k: v for k, v in new_titles.items() if v != old_titles[k]}
        changed_ids = api.set_field(f"title", updates)
        # updating marks and view might be useful too?
        #marks = {id: "Changed title" for id in changed_ids}
        #gui.current_db.set_marked_ids(marks)
        #gui.library_view.model().refresh_ids(changed_ids)
Thank you so much, bluefish2020, I only had to change it to my customn column.

Code:
from calibre_plugins.action_chains.actions.base import ChainAction
from calibre.utils.titlecase import titlecase

class MyAction(ChainAction):

    # replace with the name of your action
    name = 'Title Case Original Title'
    support_scopes = True

    def run(self, gui, settings, chain):
        api = gui.current_db.new_api

        selected_books = chain.scope().get_book_ids()
        old_titles = api.all_field_for("#original_title", selected_books, None)
        new_titles = {k: titlecase(v) for k, v in old_titles.items()}
        updates = {k: v for k, v in new_titles.items() if v != old_titles[k]}
        changed_ids = api.set_field(f"#original_title", updates)
        # updating marks and view might be useful too?
        #marks = {id: "Changed title" for id in changed_ids}
        #gui.current_db.set_marked_ids(marks)
        #gui.library_view.model().refresh_ids(changed_ids)
I also made the following additional changes with Claude.AI

Code:
from calibre_plugins.action_chains.actions.base import ChainAction
from calibre.utils.titlecase import titlecase

class MyAction(ChainAction):

    name = 'Mark Non-Titlecase Original Titles'
    support_scopes = False

    def run(self, gui, settings, chain):
        api = gui.current_db.new_api
        db = gui.current_db

        all_books = list(api.all_book_ids())
        titles = api.all_field_for("#original_title", all_books, None)
        
        marks = {book_id: "caps_title" for book_id, title in titles.items() if title and title != titlecase(title)}
        
        db.set_marked_ids(marks)
        gui.library_view.model().refresh_ids(list(marks.keys()))
Selection Modifier — "New search": marked:caps_title, "Select all books in current library view"
Wiggo is offline   Reply With Quote
Old 05-24-2026, 08:13 PM   #1577
rumplestiltskin
Zealot
rumplestiltskin ought to be getting tired of karma fortunes by now.rumplestiltskin ought to be getting tired of karma fortunes by now.rumplestiltskin ought to be getting tired of karma fortunes by now.rumplestiltskin ought to be getting tired of karma fortunes by now.rumplestiltskin ought to be getting tired of karma fortunes by now.rumplestiltskin ought to be getting tired of karma fortunes by now.rumplestiltskin ought to be getting tired of karma fortunes by now.rumplestiltskin ought to be getting tired of karma fortunes by now.rumplestiltskin ought to be getting tired of karma fortunes by now.rumplestiltskin ought to be getting tired of karma fortunes by now.rumplestiltskin ought to be getting tired of karma fortunes by now.
 
Posts: 107
Karma: 1835990
Join Date: Nov 2010
Location: West of the Pecos
Device: FireHD8, iPad
Wondering if Actions Chains would do the following:

I routinely eMail ePubs to my Amazon Kindle account from within Calibre. This normally works perfectly as long as I verify that the ePub isn't too large (in MB). Usually I lossy compress the images to 40% or so and this takes care of any MB issue.

So I eMail the ePub from within Calibre. I then check the "Jobs" to verify success. Finally, if successful, I have a custom column I've named "Sent" which I click upon and set the value to Yes which yields a green checkmark. A book I haven't yet sent displays a red "X".

So can I craft some sort of Action Chain that does this:
1. eMail the book.
2. Verify the Job completed successfully. (If not, show a modal "failure" dialog.)
3. if the Job completed successfully, set the "Sent" column to "Yes".

I seem to recall I asked a similar question some years ago and process #2 couldn't be done so process #3, therefore, wasn't done regardless of the success or failure of #2.

I hope I've been clear enough. Thanks in advance for any assistance.

Barry
rumplestiltskin is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Action Chains Resources capink Plugins 83 05-07-2026 02:16 AM
[Editor Plugin] Editor Chains capink Plugins 131 04-26-2026 05:33 AM
[GUI Plugin] Noosfere_util, a companion plugin to noosfere DB lrpirlet Plugins 2 08-18-2022 03:15 PM
[GUI Plugin] Save Virtual Libraries To Column (GUI) chaley Plugins 14 04-04-2021 05:25 AM


All times are GMT -4. The time now is 04:11 PM.


MobileRead.com is a privately owned, operated and funded community.