![]() |
#496 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,046
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Another suggestion:
Along with the 'export' option on chains, another option to open the chain json in a dialog for copying. This will make it easier to post it somewhere for troubleshooting or sharing. Speaking of, here's another useful chain I made to make bulk generation + embedding of covers over many small batches slightly less painful. Code:
{ "ActionsChainMenus": { "Menus": [ { "active": true, "chain_settings": { "chain_links": [ { "action_name": "Calibre Actions", "action_settings": { "disable_busy_cursor": true, "selection": [ { "display": "Generate Cover", "path": [ "Generate Cover" ], "paths_text": "" } ], "wait_jobs": true, "wait_progress": true }, "comment": "Open Generate Covers dialog" }, { "action_name": "Calibre Actions", "action_settings": { "disable_busy_cursor": true, "selection": [ { "display": "Polish books", "path": [ "Polish Books" ], "paths_text": "" } ], "wait_jobs": true, "wait_progress": true }, "comment": "Open Polish Book dialog" } ], "refresh_gui": true }, "image": "cleanup.png", "menuText": "Generate Cover", "subMenu": "" } ] }, "schemaVersion": 1.4 } Last edited by ownedbycats; 04-05-2021 at 02:21 AM. |
![]() |
![]() |
![]() |
#497 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
|
![]() |
![]() |
Advert | |
|
![]() |
#498 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,046
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Likely something specific to my setup then.
|
![]() |
![]() |
![]() |
#499 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Version 1.6.2
Since not everyone is going to be satisfied with whatever icons I choose, the best solution for those who want to change icons is to override the stock icons by putting their icons of choice in these locations: Code:
{Calibre Config Directory}/resources/images/Action Chains/condition.png {Calibre Config Directory}/resources/images/Action Chains/no_condition.png {Calibre Config Directory}/resources/images/Action Chains/scope.png {Calibre Config Directory}/resources/images/Action Chains/no_scope.png {Calibre Config Directory}/resources/images/Action Chains/scope_unsupported.png Same technique can be used if you want certain state to show no icons, you simply override the target icon with a transparent png (e.g. if you want the no_condition icon to not show like before, override it with a transparent png) |
![]() |
![]() |
![]() |
#500 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,046
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I like the new icons
![]() |
![]() |
![]() |
Advert | |
|
![]() |
#501 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,046
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Does a submenu always take on the icon of the first chain in it?
|
![]() |
![]() |
![]() |
#502 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Yes, for the time being it is. Adding a way to configure the icons for the submenus would be an overkill. The same goes for making the icons optional. It is either this or disabling icons for submenus altogether.
Last edited by capink; 04-07-2021 at 09:28 AM. |
![]() |
![]() |
![]() |
#503 |
Member
![]() Posts: 13
Karma: 10
Join Date: Apr 2013
Device: lots of, frequently changing
|
Conditions / book_vars - maybe I'm on the wrong track?
Hello,
I want to differentiate actions depending on the title format type of the selected books. There are lots of different actions depending on this formats. The format types change quite often. So I want to test the title format only once at the beginning, storing the result with set_book_vars('otyp', "Title Format Type") and then setting conditions on this book var. This does not work for me and I fear I did not understand the concept of the book vars ... I create a "Test" chain: 1st Action: "Chain Variable" OYTP with template Code:
program: otyp = switch(field('title'), ".*\s+\(\d\d\.\d\d\.\d\d\d\d\)\s*", "Zeitung", ".*\s+\(\d\d/\d\d\d\d\)\s*", "Zeitschrift", "Unbekannt"); set_book_vars('otyp',otyp); book_vars('otyp') Code:
program: book_vars('otyp'); Code:
program: book_vars('otyp'); Code:
program: book_vars('otyp'); Unfortunately the condition for "#feltes1" only works as expected if only one book is selected ... You may find the chain export attached ... P.S. Puha, that plugin definitely is more capable then my template skills |
![]() |
![]() |
![]() |
#504 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Your understanding of the concept of book_vars is fine. The problem is with your understanding of Conditions. The condition does not work per book, it works per action. So if the condition is True, the action will run for all selected books. If the condition is False the action will not run at all.
Since the condition does not iterate over all books, It only fetches one metadata object (active index in case of multiple selections). This explains what happened when you selected only one. (conditions in case of multiple selections are meant to be used for general things like selection_count, connected_device_name, current_library_name .... etc) I am not sure whether the above is explained clearly. Anyway, to achieve what you want, the solution is to store the ids for books that should be processed in step 2. Attached below is a zip with a modified chain that should achieve this. It uses the scopes feature. Last edited by capink; 04-10-2021 at 11:00 AM. |
![]() |
![]() |
![]() |
#505 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Also another way to do this more easily is by using only two single field edit actions, and do away with the first chain variables. The single field edit actions should use a modified version of the template you used in the chain variables. The first one should modify the template to return an the same field value if if otyp != 'Zeitschrift'
Edit: Attached another chain that does the same without the need to use scopes. Last edited by capink; 04-10-2021 at 11:33 AM. |
![]() |
![]() |
![]() |
#506 |
Member
![]() Posts: 13
Karma: 10
Join Date: Apr 2013
Device: lots of, frequently changing
|
![]()
It is explained clearly, I just create a list of IDs for every format type and set the scope for the corresponding actions to these ID lists:
Code:
program: # Get existing lists of book_ids zeitung_ids = globals(zeitung_ids); zeitschrift_ids = globals(zeitschrift_ids); # Set the book variable otyp to the type otyp = switch(field('title'), ".*\s+\(\d\d\.\d\d\.\d\d\d\d\)\s*", "Zeitung", ".*\s+\(\d\d/\d\d\d\d\)\s*", "Zeitschrift", "Unbekannt"); set_book_vars('otyp',otyp); # Add to correspdonding id list if otyp == 'Zeitschrift' then zeitschrift_ids = list_union(zeitschrift_ids, field('id'), ','); set_globals(zeitschrift_ids) elif otyp == 'Zeitung' then zeitung_ids = list_union(zeitung_ids, field('id'), ','); set_globals(zeitung_ids) fi ![]() |
![]() |
![]() |
![]() |
#507 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,637
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 question, because I cannot grab all the concepts here. I want that, inside of an action chain, one of the actions only applies to books with a custom column not set or set to False. Is is possible with the current plugin? I'm sure that, if I study all the information, I will get the answer, but this is one of those situations where I prefer to ask for a summary
![]() ![]() |
![]() |
![]() |
![]() |
#508 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
You have two options depending on the action:
Last edited by capink; 04-15-2021 at 03:11 PM. |
![]() |
![]() |
![]() |
#509 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,455
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Assuming the action you want to run supports scopes, the simple approach is to apply a "Basic Scope" / "Act on books resulting from a search" to the action. The search would be "not #column:yes", which finds books with False or not set. The action applies to all books that match the search. Another way to do it that is more general would be to use a "Chain Variables" action to do the computation(s) and set book variables for the metadata you want to change. The ChainVars action would process the books you want using selections or searches or whatever. Inside that action I would use two book_vars per field you want to change (#field), one saying providing the value to store (field_value) and another saying a value has been provided (field_value_provided). In this example, 'field' is the lookup name without the '#' as in 'genre_value' and 'genre_value_provided'. You would then use Single Field Edit that would
EDIT: Ninja'ed by capink. ![]() |
|
![]() |
![]() |
![]() |
#510 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Action Chains Resources | capink | Plugins | 78 | 08-05-2025 04:01 AM |
[Editor Plugin] Editor Chains | capink | Plugins | 106 | 06-17-2025 05:36 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 |