View Single Post
Old 02-26-2025, 04:41 PM   #1439
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
Quote:
Originally Posted by WorldTeacher View Post
Hi,

i want to use action chains to make my management a bit easier. For that, I would like to have two chains:

Chain 1:
runs when books are added though "Add books > add books from folder and subfolders" and uses the plugin "count pages" to count the pages

I have the basics of this chain working, but it only counts the pages of the last book that was added, not every book added in the process

Chain 2:
runs on calibre shutdown and:
for all books added that day:
runs pluin "embed metadata"
runs plugin "epub extended metadata"
copies the books to another library

how would I create these chains?

any help is welcome, thanks in advance
I never used "Count Pages" or "epub extended metadata", so any specific advice regarding these two plugins I will leave to people who actually use them.

But in general, plugins can be called from an action called "Calibre Actions". But there are two caveats:
  • The plugin must have an action that can be associated menu item. Most plugins do.
  • Any interactive dialogs that are popped up by the plugins, will have to be dealt with manually, you cannot pre-answer them.

As for the first chain, you can use the event manager, with a custom event called "Books added", which you can get from here. You can attach the chain to the event, and it will fire every times new book(s) are added. This event has an option to select all added books, which I guess was the problem you had with count pages acting on only one books.

Note: The event posted above can be added to the plugin by copy/pasting the code into the plugin's module editor: Action Chains > Manage Modules > add > copy/paste

For the second chain, you can use the event manager with the builtin event "Shutting down". All the actions should be doable with "Calibre Actions", with the two caveats mentioned above holding.
capink is offline   Reply With Quote