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 09-17-2025, 03:48 PM   #1546
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,584
Karma: 81412473
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Suggestion: Add link to AC Resources in the first post of thread.
ownedbycats is offline   Reply With Quote
Old 09-18-2025, 01:55 AM   #1547
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,222
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Suggestion: Add link to AC Resources in the first post of thread.
There has been a link from the start under the entry: Custom actions and events.
capink is offline   Reply With Quote
Old 09-18-2025, 05:49 AM   #1548
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,222
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
@un_pogaz, @ownedbycats

I posted a custom action here that addresses the filtering problem, without the need for using templates.
  • The user can use the action to save current selections to a named variable (e.g. chain_selected_ids, previously_selected_ids, third_action_ids .... etc)
  • The user can restore the selections from a named variable.
  • The user can apply a regular calibre search that will limit the selection to a subset of one of the following:
    • Currently selected books.
    • Book ids stored in a variable
    • Books in current scope

Notes:
  • Regular calibre search allows for using templates. You consult the calibre search documentation, looking for the section named: "Search using templates"
  • The selection is going to be limited by the current library view including the search vls applied. To clear those, you can use the builtin "Selection Modifier". There is no need to duplicate the same functionality.
  • The action is called "Subset Selector" for lack of better name. More descriptive suggestions are welcome.
  • The action will not be part of the stock plugin until it fully matures and has a stable api.
Attached Thumbnails
Click image for larger version

Name:	1.jpg
Views:	154
Size:	43.0 KB
ID:	218138   Click image for larger version

Name:	2.jpg
Views:	137
Size:	38.1 KB
ID:	218139  
capink is offline   Reply With Quote
Old 09-18-2025, 11:55 AM   #1549
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,222
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by Terisa de morgan View Post
Here it is
Please export the chain into an importable zip file (right click the chain in the chain dialog > export).
capink is offline   Reply With Quote
Old 09-18-2025, 04:46 PM   #1550
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,744
Karma: 13151503
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by capink View Post
Please export the chain into an importable zip file (right click the chain in the chain dialog > export).
Yes, sorry. Export is attached.
Attached Files
File Type: zip Chain.zip (438.1 KB, 128 views)
Terisa de morgan is offline   Reply With Quote
Old 09-19-2025, 02:02 AM   #1551
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,222
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
There are two issues I can detect:
  • The following condition does not result in a consistent type of output

    Code:
    program:
        if field_exists("#ong") then
            1.00
        fi
    It should be modified as follows:

    Code:
    program:
        if field_exists("#ong") then
            1.00
        else
            0
        fi
    Because the condition evaluator is expecting a number even if the "if statement" evaluates to false. They way you wrote the condition, when the "#ong" column is absent, the template output is an empty string. The condition evaluator tries to convert the empty string to number and fails.
  • If you modify the condition as described, the chain is still not going to run if either the #lector or #prox columns are absent, because unlike what you did with the #ong condition, you did not tick the checkbox "Disable action validation if conditions are not met"

I tried the chain after modifying the condition above, and after creating the #lector and #prox columns in a test library, and it runs fine (I deleted the My Tools action as I do not have it on my system).
capink is offline   Reply With Quote
Old 09-19-2025, 03:04 AM   #1552
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,744
Karma: 13151503
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by capink View Post
There are two issues I can detect:
  • The following condition does not result in a consistent type of output

    Code:
    program:
        if field_exists("#ong") then
            1.00
        fi
    It should be modified as follows:

    Code:
    program:
        if field_exists("#ong") then
            1.00
        else
            0
        fi
    Because the condition evaluator is expecting a number even if the "if statement" evaluates to false. They way you wrote the condition, when the "#ong" column is absent, the template output is an empty string. The condition evaluator tries to convert the empty string to number and fails.
  • If you modify the condition as described, the chain is still not going to run if either the #lector or #prox columns are absent, because unlike what you did with the #ong condition, you did not tick the checkbox "Disable action validation if conditions are not met"

I tried the chain after modifying the condition above, and after creating the #lector and #prox columns in a test library, and it runs fine (I deleted the My Tools action as I do not have it on my system).
Thank you very much! The change to number was only to try something different, and it's bad luck I checked the only one with that checkbox ticked. And yes, My Tools is a personal plugin, sorry not having removed it.

Terisa de morgan is offline   Reply With Quote
Old 10-05-2025, 04:10 AM   #1553
un_pogaz
Chalut o/
un_pogaz ought to be getting tired of karma fortunes by now.un_pogaz ought to be getting tired of karma fortunes by now.un_pogaz ought to be getting tired of karma fortunes by now.un_pogaz ought to be getting tired of karma fortunes by now.un_pogaz ought to be getting tired of karma fortunes by now.un_pogaz ought to be getting tired of karma fortunes by now.un_pogaz ought to be getting tired of karma fortunes by now.un_pogaz ought to be getting tired of karma fortunes by now.un_pogaz ought to be getting tired of karma fortunes by now.un_pogaz ought to be getting tired of karma fortunes by now.un_pogaz ought to be getting tired of karma fortunes by now.
 
un_pogaz's Avatar
 
Posts: 656
Karma: 719376
Join Date: Dec 2017
Device: Kobo
The latest version of Quality Check (1.14.4) contain a support for the Actions Chains API. This is limited only to the Fix actions because that the only one that edit book metadata (when the other are only lookup actions that don't realy match with the scope of Actions Chains).
Technically, it was added into the 1.14.3, but it never was published and deployed on Mobilread.

Also, some Fix actions of Quality Check can replace certain User Action (Bulk Sort Key and Re-calc Book Size for example).

Last edited by un_pogaz; 10-05-2025 at 04:14 AM.
un_pogaz is offline   Reply With Quote
Old 10-06-2025, 07:28 AM   #1554
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 82,230
Karma: 150871427
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by un_pogaz View Post
The latest version of Quality Check (1.14.4) contain a support for the Actions Chains API. This is limited only to the Fix actions because that the only one that edit book metadata (when the other are only lookup actions that don't realy match with the scope of Actions Chains).
Technically, it was added into the 1.14.3, but it never was published and deployed on Mobilread.

Also, some Fix actions of Quality Check can replace certain User Action (Bulk Sort Key and Re-calc Book Size for example).
It would also be good if Action Chains can also work with the search from Quality Check. Then you can do what you want based on the output of the search.
JSWolf is online now   Reply With Quote
Old 10-23-2025, 12:48 AM   #1555
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,584
Karma: 81412473
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Just curious:

A FanFicFare-related chain opens a dialog so I can copy something, then SFE to paste it into a longtext column. Is action to insert clipboard contents directly to column?
ownedbycats is offline   Reply With Quote
Old 10-23-2025, 07:48 AM   #1556
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,222
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Just curious:

A FanFicFare-related chain opens a dialog so I can copy something, then SFE to paste it into a longtext column. Is action to insert clipboard contents directly to column?
Create a custom from_clipboard() template function, by copy/paste into the module manager:

Code:
from qt.core import QApplication
from calibre_plugins.action_chains.templates import TemplateFunction

class FromClipboard(TemplateFunction):

    name = 'from_clipboard'
    arg_count = 0

    def evaluate(self, formatter, kwargs, mi, locals):
        return QApplication.clipboard().text()
capink is offline   Reply With Quote
Old 10-26-2025, 02:09 PM   #1557
ThreeLizards
Enthusiast
ThreeLizards began at the beginning.
 
Posts: 25
Karma: 10
Join Date: Feb 2025
Device: Kindle Paperwhite 2024
Hi!

I'm trying to get action chain to do a thing where if the title contains 'Anthology' then it'll pick a update anthology in fanficfare. But I can't get the title thing working. It only seems to recognize the full title, like not just if it contains something. How do I work that in the evaluate condition thing?

Thank you for the help!
ThreeLizards is offline   Reply With Quote
Old 01-19-2026, 01:16 PM   #1558
shinykari
Member
shinykari doesn't littershinykari doesn't litter
 
Posts: 22
Karma: 128
Join Date: Jan 2020
Device: Kobo Libre2
Is there a way to use AC to open the Generate Cover (default) prompt screen at runtime?

Currently, the Single Field Edit > cover option won't let me select "Ask at Runtime." (Unless I am missing an option somewhere.) So at the moment, my options are to use my defaults or to create a new condition for each cover option and then add that to a separate chain.

Also, I have noticed that AC's version of Generate Cover doesn't allow me to load in saved settings that the main Generate Cover window has. Is it possible to add this?
shinykari is offline   Reply With Quote
Old 02-24-2026, 12:54 PM   #1559
justinmiller87
Junior Member
justinmiller87 began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Feb 2026
Device: Kindle Colorsoft & Kindle Scribe
I am trying to figure out what I am doing incorrectly here. I have a chain that sorts my authors by lastname firstname when there are multiple authors. Inside the edit template, it works properly. Here is the code:
Quote:
python:
def evaluate(book, context):
import re
authors = book.authors
if not authors:
return ''

# Function to extract sort key (Last Name)
# Assumes "First Last" format
def get_last_name(name):
parts = name.strip().split()
return parts[-1].lower() if parts else ''

# Sort the list of authors based on their last names
sorted_authors = sorted(authors, key=get_last_name)

# Join them back together
return ' & '.join(sorted_authors)
This turns this:
Alan Fine & Axel Alonso & Dan Buckley & Daniel Freedman & David Aja & Joe Caramagna & Joe Quesada & John Cassaday & Peter Milligan & Sebastian Girner & Tomm Coker

Into this:
David Aja & Axel Alonso & Dan Buckley & Joe Caramagna & John Cassaday & Tomm Coker & Alan Fine & Daniel Freedman & Sebastian Girner & Peter Milligan & Joe Quesada

When I go back to the main Calibre GUI, select a book, and then select the action chain, nothing happens. Am I setting it up to work incorrectly somehow?
justinmiller87 is offline   Reply With Quote
Old 02-25-2026, 07:06 AM   #1560
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,222
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by justinmiller87 View Post
I am trying to figure out what I am doing incorrectly here. I have a chain that sorts my authors by lastname firstname when there are multiple authors. Inside the edit template, it works properly. Here is the code:


This turns this:
Alan Fine & Axel Alonso & Dan Buckley & Daniel Freedman & David Aja & Joe Caramagna & Joe Quesada & John Cassaday & Peter Milligan & Sebastian Girner & Tomm Coker

Into this:
David Aja & Axel Alonso & Dan Buckley & Joe Caramagna & John Cassaday & Tomm Coker & Alan Fine & Daniel Freedman & Sebastian Girner & Peter Milligan & Joe Quesada

When I go back to the main Calibre GUI, select a book, and then select the action chain, nothing happens. Am I setting it up to work incorrectly somehow?
If my memory serves me right, the plugin checks if the new value is equal to the old value (and in case of authors column it doesn't take different author order as different), and if they are, it does not apply the value to prevent changing last_modified column, which would in turn trigger changing opf files on disk and slow things unnecessarily.

Chaley has since introduced a change in calibre source that does a similar thing, so when I get time to look at the code I might remove this.

In the mean time, to get around this, the solution is to change the author string by adding an action that adds a "temporary" to the author list, and then sort and remove the temporary string in the next action.

Attached is a chain that does what I describe above.
Attached Files
File Type: zip sort_authors.zip (697 Bytes, 3 views)
capink is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Editor Plugin] Editor Chains capink Plugins 120 12-25-2025 09:14 AM
Action Chains Resources capink Plugins 80 09-18-2025 05:45 AM
[GUI Plugin] Noosfere_util, a companion plugin to noosfere DB lrpirlet Plugins 2 08-18-2022 04:15 PM
[GUI Plugin] Save Virtual Libraries To Column (GUI) chaley Plugins 14 04-04-2021 06:25 AM


All times are GMT -4. The time now is 06:14 PM.


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