View Single Post
Old 08-05-2022, 11:06 AM   #903
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,200
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by nqk View Post
Dear you guys,

I'm totally new to this plugin. I would like to do a regex search and replace in the book content whenever it is modified. Is it possible?

Please be kind and help me if it is. (I'm no python dev to be familiar with the code)
I don't understand exactly what you want to do. But I have two things to point out:
  • While Action Chains has an event manager that makes it possible to launch chains in reaction to certain events, it does not currently have an event that is triggrered by modifying book(s). I decided no to include such an event because it is not uncommon for a lot of books to modified successively very rapidly (some examples of this are the check quality and modify epubs plugins). Having chains launched in response to event that can be fired multiple times per second can wreak havoc.

    One solution for this would be caching the events and and firing one event for all books when calibre is idle. However, this is in the future for now.

  • What you can do is include the modifying actions as a part of chain, and adding your search/replace action at the end of same chain. You can use the Editor Chains plugin to search/replace supported formats from Action Chains. It has an action that can use saved searches from the calibre editor for this.
capink is offline   Reply With Quote