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 01-16-2021, 08:58 AM   #256
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,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
No. Action chains does not give you the ability to name templates. This can already be done in calibre using stored templates (preferences > template functions).

Action chains only gives you the ability to set an icon and a tooltip for the condition, to be used as kind of visual cue of which conditions this action/chain will run under.
capink is offline   Reply With Quote
Old 01-16-2021, 09:43 AM   #257
compurandom
Wizard
compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.
 
Posts: 1,013
Karma: 500000
Join Date: Jun 2015
Device: Rocketbook, kobo aura h2o, kobo forma, kobo libra color
Quote:
Originally Posted by capink View Post
No. Action chains does not give you the ability to name templates. This can already be done in calibre using stored templates (preferences > template functions).
Ahh! So that's where the button is hidden.

Would it be possible to either add a button in the plugin dialog to bring that up, or at least mention it in the post documenting conditions? Or is it there and I missed it?
compurandom is offline   Reply With Quote
Advert
Old 01-16-2021, 09:48 AM   #258
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,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
What version of the plugin are you using? The tooltip and icon fields are in the conditions dialog right at the bottom. If you mean you want a button to calibre's stored templates, I can add that.
capink is offline   Reply With Quote
Old 01-16-2021, 09:51 AM   #259
compurandom
Wizard
compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.
 
Posts: 1,013
Karma: 500000
Join Date: Jun 2015
Device: Rocketbook, kobo aura h2o, kobo forma, kobo libra color
I just noticed clicking on the pulldown like a button opens the template editor.
Somehow I never thought to try that before.
compurandom is offline   Reply With Quote
Old 01-16-2021, 10:05 PM   #260
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,011
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by capink View Post
It refers to the ability to set it for more than one chain simultaneously. Maybe this is not grammatically right, I am not sure. If so, I will modify it in the next release.

Note that you can set multiple conditions using one template. As an example, this template tests for two conditions (selection_count + book format). The following boolean template functions can be useful for setting multiple conditions: and(), or(), not().
That makes sense. I think I was confusing "multiple conditions" for "multiple templates."

Another question: If I want to switch to a saved search at the end of a chain, is Selection Modifier the right way to do that?
ownedbycats is offline   Reply With Quote
Advert
Old 01-16-2021, 11:35 PM   #261
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,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Another question: If I want to switch to a saved search at the end of a chain, is Selection Modifier the right way to do that?
It is the most straightforward way to do it. But you will also have to choose one selection option with it.

If you want to just display the search results without making any selections, you can use this custom action instead, just type the following in the template dialog:

Code:
search:"=my_saved_search"
A third option would be through the view manager plugin.
capink is offline   Reply With Quote
Old 01-17-2021, 06:06 AM   #262
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,636
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
I have a doubt. Let's say I have an action that includes to set some custom columns, that doesn't exist in all the libraries. Is it possible to execute the part that is common in all the libraries and the part about custom columns only in the libraries where they exist?
Terisa de morgan is offline   Reply With Quote
Old 01-17-2021, 07:12 AM   #263
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,448
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Terisa de morgan View Post
I have a doubt. Let's say I have an action that includes to set some custom columns, that doesn't exist in all the libraries. Is it possible to execute the part that is common in all the libraries and the part about custom columns only in the libraries where they exist?
You can use current_library_name() in a template to determine if an action should run. However, this isn't ideal because the mapping from library name to columns is in your head and can change. Better would be an field_exists('name') boolean function. I will look at adding that.
chaley is offline   Reply With Quote
Old 01-17-2021, 08:01 AM   #264
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,636
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by chaley View Post
You can use current_library_name() in a template to determine if an action should run. However, this isn't ideal because the mapping from library name to columns is in your head and can change. Better would be an field_exists('name') boolean function. I will look at adding that.
Thank you very much! This would work for me in a lot of places (yes, I have a lot of custom columns and libraries )
Terisa de morgan is offline   Reply With Quote
Old 01-17-2021, 09:20 AM   #265
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,448
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Terisa de morgan View Post
Thank you very much! This would work for me in a lot of places (yes, I have a lot of custom columns and libraries )
Done. The function field_exists(name) is in source now and will be in the next calibre release.
chaley is offline   Reply With Quote
Old 01-17-2021, 12:08 PM   #266
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,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
chaley's new template function is a lot better than setting conditions with library name.

The problem with both approaches is that the plugin will validate each action in the chain before running it, and if single action has problems (e.g custom column not in current library) the whole chain will be disabled.

I will see what is the best approach to deal with this.
capink is offline   Reply With Quote
Old 01-17-2021, 12:23 PM   #267
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,636
Karma: 12595249
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
chaley's new template function is a lot better than setting conditions with library name.

The problem with both approaches is that the plugin will validate each action in the chain before running it, and if single action has problems (e.g custom column not in current library) the whole chain will be disabled.

I will see what is the best approach to deal with this.
That was going to be my next question. So, the condition is for the whole chain, not for a single action, right?
Terisa de morgan is offline   Reply With Quote
Old 01-17-2021, 12:59 PM   #268
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,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
The condition chaley suggested is per action. It is currently not going to work. I think the solution to this would be to validate only actions that are going to run under the current conditions. So if you set a condition on an action using chaley's new function, the action will only be validated if the condition is true. I hope the explanation makes sense.
capink is offline   Reply With Quote
Old 01-17-2021, 01:22 PM   #269
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,448
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by capink View Post
The condition chaley suggested is per action. It is currently not going to work. I think the solution to this would be to validate only actions that are going to run under the current conditions. So if you set a condition on an action using chaley's new function, the action will only be validated if the condition is true. I hope the explanation makes sense.
Validating only actions that will be run makes sense.

However, unless I am misunderstanding I don't think the problem is as large as you indicate, at least for template actions. Looking at check_template() I see that the template is run to see if it produces an error. Assume the template looks something like this
Code:
program:
    if field_exists('#somefield') then
        do_something();
        do_something_else()
    fi
This template won't produce an error if #somefield doesn't exist so it would validate. Of course it might not do what the action requires, which is a different problem.
chaley is offline   Reply With Quote
Old 01-17-2021, 01:30 PM   #270
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,636
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by chaley View Post
Validating only actions that will be run makes sense.

However, unless I am misunderstanding I don't think the problem is as large as you indicate, at least for template actions. Looking at check_template() I see that the template is run to see if it produces an error. Assume the template looks something like this
Code:
program:
    if field_exists('#somefield') then
        do_something();
        do_something_else()
    fi
This template won't produce an error if #somefield doesn't exist so it would validate. Of course it might not do what the action requires, which is a different problem.

So, essentially, instead of using "Edit Metadata", I use a function with that template that set the value of the column if it exists.
Terisa de morgan is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Editor Plugin] Editor Chains capink Plugins 106 06-17-2025 05:36 PM
Action Chains Resources capink Plugins 77 06-16-2025 12:45 PM
[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:50 PM.


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