![]() |
#1051 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Unexpected behaviour:
1. Create a chain with single-field edit that modifies an HTML longtext column. (I use it to add series descriptions to the aptly-named #seriesdescription.) 2. Run it on multiple books. 3. Without editing anything, switch to 'HTML source' tab and then back to 'Normal view' The 'Apply to all' button will then enable itself as though the user had edited something. Last edited by ownedbycats; 03-24-2023 at 06:21 PM. |
![]() |
![]() |
![]() |
#1052 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
This is harmless. It comes from the original Comment Editor in calibre, which is not designed with bulk editing in mind. And I don't feel like rewriting it and maintaining a separate version just for this.
|
![]() |
![]() |
![]() |
#1053 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Quick question on interaction between AC and Last Modified:
If a single-field edit with a predefined value doesn't change the value, will it trigger a last modified datechange on that column? Example: I have a book with #booktype set to Fiction. I run a chain where the only action is to set #booktype to Fiction. I'm also curious how this works with templates. In pretty much all cases I have a "else $columnname" to return the currently-existing value rather than nulling it out. Would this count as a modificaiton or not? |
![]() |
![]() |
![]() |
#1054 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Quote:
|
|
![]() |
![]() |
![]() |
#1055 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
You could of course test this easily enough... |
|
![]() |
![]() |
![]() |
#1056 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Quote:
The checking of values with the template option precedes chaley's change to the db. I will look into removing this step to improve performance. |
|
![]() |
![]() |
![]() |
#1057 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Thanks
![]() |
![]() |
![]() |
![]() |
#1058 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Question: Is there a method that runs a regex on a column and then copies the substituted value to clipboard? I'd like to extract a string from FanFicFare-populated #fanficmetadata column.
![]() EDIT: Copy to clipboard, template using re. Last edited by ownedbycats; 04-02-2023 at 12:59 AM. |
![]() |
![]() |
![]() |
#1059 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
New question:
Can Action Chains be used to insert links into the author table? (Or, post 6.14.1+, other normalized tables as well.) In my specific case I'd like to: 1. Use template to extract a string from #fanficmetadata. 2. Insert it into the author (or series) table. Multiple authors may be a problem -- I would probably just do those ones manually. Last edited by ownedbycats; 04-02-2023 at 01:12 AM. |
![]() |
![]() |
![]() |
#1060 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Here are two python stored templates you can use for this.
This one returns the link associated with a value in a column. Code:
python: def evaluate(book, context): arguments = context.arguments if arguments is None or len(arguments) != 2: raise ValueError('template needs 2 arguments: column, value') db = context.db.new_api links = db.get_link_map(arguments[0]) return links.get(arguments[1], '') Code:
program: get_links_for_value('series', '1632') This template sets a link for a value in a column: Code:
python: def evaluate(book, context): arguments = context.arguments if arguments is None or len(arguments) != 3: raise ValueError('template needs 3 arguments: column, value, link') to_set_map = {arguments[1]:arguments[2]} db = context.db.new_api db.set_link_map(arguments[0], to_set_map) return arguments[2] Example call: Code:
program: set_link_for_value('series', 'Bah', 'some link') |
![]() |
![]() |
![]() |
#1061 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I'd like to make a single-field edit that changes series_index to '0' if a template returns true. However, series_index is not available for selection in the dropdown menu.
Are there other options or a workaround using the 'series' column? ![]() EDIT: Search & replace may work. ANOTHER EDIT: What's going on with the width of the dialog? lol Last edited by ownedbycats; 04-04-2023 at 11:02 PM. |
![]() |
![]() |
![]() |
#1062 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I'm having a bit of trouble figuring out how formulas work and am wondering if I'm misusing it here.
![]() Code:
program: ## Field guides, fanfiction exchanges, and various other unordered series collections = first_non_empty( 'Golden Guides' in $series, 'Mass Effect Big Bang \d{4}' in $series, 'Spectre Requisitions \d{4}' in $series, 'N7 Exchange \d{4}' in $series, 'Across Dark Space \d{4}' in $series, ); if collections then columnupdate_seriesindex(0) fi This works as expected if I run it on a single book - if the series matches 'collections' it changes series_index to 0. It also works if I run it on two books that match or two books that don't match. If I run it on two books where one matches and the other doesn't, it just results in an empty window (and the matched book fails to update). I'm thinking it's checking both books at once instead of each one separately. |
![]() |
![]() |
![]() |
#1063 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Or a Search using Templates followed by a Selection Modifer to select all books in the current library view. |
|
![]() |
![]() |
![]() |
#1064 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
That makes sense I'll try it. Thanks.
|
![]() |
![]() |
![]() |
#1065 | |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Quote:
Use-case 1: Running a single-field MDE with ask-at-runtime. Use-case 2: Using an action with a conditional that checks something from the current book. Use-case 3: This. EDIT: Use-case 1 didn't work. I ran it on two books. Book selection didn't change (thought it would) and I got the information I entered for the second book on both. I wonder now if this is something I can fudge with selection modifiers. Last edited by ownedbycats; 04-07-2023 at 04:26 PM. Reason: spellcheck is misbehaving |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Editor Plugin] Editor Chains | capink | Plugins | 106 | 06-17-2025 05:36 PM |
Action Chains Resources | capink | Plugins | 77 | 06-16-2025 12:45 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 |