![]() |
#1426 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,167
Karma: 1988646
Join Date: Aug 2015
Device: Kindle
|
Not really. The Run Python Code in intended to interact with the calibre API, which has some documentation. Besides the issue of variables we just mentioned, I don't think there anything in the action chains code could be of help to someone using this action.
|
![]() |
![]() |
![]() |
#1427 |
Member
![]() Posts: 20
Karma: 10
Join Date: Jun 2016
Location: France
Device: PocketBook Touch Lux 2
|
Sorry to bother you again, but I can now transfer my variable from one Run Python module to another. But my goal is to modify the value of a field (title in this case) and I can't get my variable from a Single Field Edit module.
What should I do? |
![]() |
![]() |
![]() |
#1428 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,167
Karma: 1988646
Join Date: Aug 2015
Device: Kindle
|
Quote:
|
|
![]() |
![]() |
![]() |
#1429 |
Member
![]() Posts: 20
Karma: 10
Join Date: Jun 2016
Location: France
Device: PocketBook Touch Lux 2
|
Hello everyone
I'm back with a new problem. I wrote this template for the Single Field Edit module, the idea being to copy author names into a dialog box and format them before assigning them to the authors field. Everything works perfectly, except that my dialog box opens twice, and also opens when I save the code. It works, so it's not too bad, but a bit annoying. What should I do to solve the problem? And once again, thank you so much for this incredible plugin, which has saved me a lot of time! Code: Code:
python: def evaluate(book, context): from PyQt5.QtWidgets import QInputDialog sortie = "" nom = ", ".join(book.authors) source, ok = QInputDialog.getText(None, "Modification des auteurs", "Entrez les auteurs :") if not ok: return nom source = source.replace(" (Auteur)", "").replace(" & ", ", ").replace(" et ", ", ").strip() nom_transforme = [] for auteur in source.split(", "): parts = auteur.split(" ", 1) if len(parts) == 2: prenom, nom_famille = parts nom_transforme.append(f"{nom_famille.upper()}, {prenom.title()}") else: nom_transforme.append(auteur) return " & ".join(nom_transforme) |
![]() |
![]() |
![]() |
#1430 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,269
Karma: 71500357
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Is there a way to do an action (chain caller) only if the previous selection modifier took anything?
Last edited by ownedbycats; 02-10-2025 at 09:00 PM. |
![]() |
![]() |
![]() |
#1431 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,167
Karma: 1988646
Join Date: Aug 2015
Device: Kindle
|
Quote:
|
|
![]() |
![]() |
![]() |
#1432 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,167
Karma: 1988646
Join Date: Aug 2015
Device: Kindle
|
|
![]() |
![]() |
![]() |
#1433 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,269
Karma: 71500357
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
If the selection modifier... has anything. I can't think of word.
Last edited by ownedbycats; 02-12-2025 at 06:08 AM. |
![]() |
![]() |
![]() |
#1434 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,167
Karma: 1988646
Join Date: Aug 2015
Device: Kindle
|
If you mean Selection Modifier has resulted in books selection as opposed to none, you can test that with this condition:
Code:
program: list_count(from_selection('id'),',') Comparison: > Condition value: 0 |
![]() |
![]() |
![]() |
#1435 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,269
Karma: 71500357
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Yes, thank you.
|
![]() |
![]() |
![]() |
#1436 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,269
Karma: 71500357
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
|
![]() |
![]() |
![]() |
#1437 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,167
Karma: 1988646
Join Date: Aug 2015
Device: Kindle
|
No. Your best bet to re-create those with templates.
|
![]() |
![]() |
![]() |
#1438 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Apr 2019
Device: Calibre
|
Question on how to create two chains
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 |
![]() |
![]() |
![]() |
#1439 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,167
Karma: 1988646
Join Date: Aug 2015
Device: Kindle
|
Quote:
But in general, plugins can be called from an action called "Calibre Actions". But there are two caveats:
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. |
|
![]() |
![]() |
![]() |
#1440 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Apr 2019
Device: Calibre
|
thanks for the help ^^
I have managed to create both chains, they work without issues. |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Action Chains Resources | capink | Plugins | 68 | 01-20-2025 01:06 PM |
[Editor Plugin] Editor Chains | capink | Plugins | 94 | 07-03-2024 07:26 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 |