View Single Post
Old 03-15-2021, 03:33 PM   #390
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,203
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Version 1.4.0

Version 1.3.2
  • Minor changes to TemplateBox.
  • Minor changes to category_items() template function.

Version 1.3.3
  • Fix: Calibre Actions: Always persist non translated strings in settings. This is done to avoid the settings being invalid if the the user switches languages.

Version 1.4.0
  • Update: Add a new Action: Search Using Templates.
  • Update: Change actions/events combobox into tree combobox.
  • Update: Import/Export: Include schema version plus other minor changes.
  • Update: Conditions Evaluator: Add option to turn off action validation of conditions are not met. The default as of this version if to verify all actions regardless of conditions unless this option is checked.
  • Update: (Experimental) Add two API methods: action_chains_resources(), on_action_chains_modules_update(). The first enables other plugins to provide action chains with resources (actions, events, template_functions). The second method makes the modules manager available for other plugins.
  • Code refactoring.

The API changes are experimental at this stage. For those interested you can read more about them here.

The newly added action is a modified version of an action that was posted in this thread as a custom. It gives the user the ability to construct calibre search using calibre template language. The only modificatoin is the addition of a checkbox to enable selecting the books resulting from the search.

This action could not be added to the selection modifier, because the selection modifier has to validate the search when the user configures the action to make sure it will always return a valid search. This is done because if a user combines a search with the option to select all books in current view, and the search turns out to invalid, all books in current view (the whole library most likely) will be selected and acted upon by subsequent actions.

Since the new action constructs a search from a template it cannot be verified at configure time. It was also dangerous to combine the old iteration of the action (the one posted previously as a custom action) with the selection modifier to select all books in current view because it would have led to the same problem outlined above. So the modification to this action, is to make it able to select the books resulting from the search, but only if the search yields valid results, otherwise no books will be selected.

@Terisa De Morgan: The behavior of the plugin changes in that if you have an action that operates on a field that does not exist in the current library, the chain will fail to validate and will not run even if you set a condition using field_exists(). You have to take one additional step, by explicitly setting the newly introduced option in the condition evaluator to not validate the action whenever the conditions are not met. This change was necessary because the old behavior did lead to some strange and inconsistent behavior.
capink is offline   Reply With Quote