![]() |
#616 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,200
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Quote:
Code:
from calibre.ebooks.covers import generate_cover from calibre.gui2.covers import CoverSettingsWidget from calibre_plugins.action_chains.actions.base import ChainAction class ConfigWidget(CoverSettingsWidget): def __init__(self, plugin_action): CoverSettingsWidget.__init__(self) self.plugin_action = plugin_action self.gui = plugin_action.gui self.db = self.gui.current_db def load_settings(self, settings): self.apply_prefs(settings) def save_settings(self): return self.prefs_for_rendering class GenerateCover(ChainAction): name = 'Generate Cover' support_scopes = True def run(self, gui, settings, chain): db = gui.current_db book_ids = chain.scope().get_book_ids() for book_id in book_ids: mi = db.get_metadata(book_id, index_is_id=True) cdata = generate_cover(mi, settings) db.new_api.set_cover({book_id:cdata}) def config_widget(self): return ConfigWidget Last edited by capink; 07-13-2021 at 06:45 AM. |
|
![]() |
![]() |
![]() |
#617 |
Enthusiast
![]() Posts: 30
Karma: 10
Join Date: Jul 2021
Device: Kindle Paperwhite, Kobo Libra 2
|
|
![]() |
![]() |
Advert | |
|
![]() |
#618 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,054
Karma: 75568269
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
A possible slight bug:
While exporting a chain, I noticed that "current time" actually renders like this: Code:
{ "action_name": "Single Field Edit", "action_settings": { "col_name": "#lastread", "value": [ { "__class__": "datetime.datetime", "__value__": "2021-03-30T00:13:43.637933+00:00" }, true ], "value_type": "predefined" }, "comment": "Set #lastread to current time" }, |
![]() |
![]() |
![]() |
#619 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,200
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Quote:
|
|
![]() |
![]() |
![]() |
#620 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,054
Karma: 75568269
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Thanks
![]() |
![]() |
![]() |
Advert | |
|
![]() |
#621 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,054
Karma: 75568269
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
A strange bug I discovered, if you're able to replicate it:
While adding an icon for a chain, I renamed it to library.png. After doing this though it instead displayed the library.png that Calibre has in its resources/images folder. Upon a restart, it changed back to the icon I'd added. |
![]() |
![]() |
![]() |
#622 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,200
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Quote:
I have no intention of changing this right now, maybe I will revisit it in the future. |
|
![]() |
![]() |
![]() |
#623 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,054
Karma: 75568269
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Thanks.
![]() New question: I added an action to my "mark fanfic as read on device" to remove the book from a certain reading list. To prevent it constantly popping up messages about books not being on the list, I attached this condition to it: Code:
program: if $#readorder == 'To Be Read: In-Progress Fanfics' then 'True' fi Code:
text = True Which... removed every book from that list. Oops. How do I change the template (and other gpms) to also specify only selected books? Last edited by ownedbycats; 07-24-2021 at 04:50 AM. |
![]() |
![]() |
![]() |
#624 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,200
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
I do not use Reading List so I do not follow what you are trying to do here. But here is a couple of points to consider:
Edit: Scopes do not work with Calibre Actions. Use the Selection Modifier instead. Last edited by capink; 07-24-2021 at 06:00 AM. |
![]() |
![]() |
![]() |
#625 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,054
Karma: 75568269
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I ran the chain against one book but for some reason all the books on that list got removed. I'll do some more testing when I'm less tired to see if it wasn't some user error.
|
![]() |
![]() |
![]() |
#626 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,054
Karma: 75568269
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Ok I did some more testing and wasn't able to replicate the "adding all books to the reading list" thing again. So I'm thinking I accidentally had all the books selected when it happened.
![]() But a new queston: how do I make a condition on a Calibre action evaluate each book individually? I have an action to add a book to a Reading List under certain circumstances. It only works if I run it on one book at a time, though, or I suppose if all the books match (I've not had a chance to test that though). Code:
{ "action_name": "Calibre Actions", "action_settings": { "disable_busy_cursor": false, "selection": [ { "display": "Add to list: To Be Read", "path": [ "Reading List", "Add to list", "Add to list: To Be Read" ] } ], "wait_jobs": false, "wait_progress": false }, "comment": "Add updated fanfics to reading list (TEMPLATE)", "condition_settings": { "affect_validation": false, "cmp_type": "=", "datatype": "text", "icon": "", "template": "program:\n\n\tif\n\t\t\t$#fanficcat\n\t\t&&\n\t\t\t$#currentlyreading\n\t\t&&\n\t\t\t$#readinglist != 'To Be Read'\n\t\t&&\n\t\t\t$$#percentread == '100'\n\tthen\n\t\t'True'\n\tfi", "tooltip": "", "value": "True" } }, Code:
program: if $#fanficcat && $#currentlyreading && $#readinglist != 'To Be Read' && $$#percentread == '100' then 'True' fi Last edited by ownedbycats; 08-02-2021 at 04:46 PM. |
![]() |
![]() |
![]() |
#627 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,200
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Don't use conditions, use the following search in the Selection Modifier to limit the view to the books meeting the criteria:
Code:
#fanficcat:true and #currentlyreading:true and #percentread:"=100" and not #readinglist:"=To Be Read" |
![]() |
![]() |
![]() |
#628 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,054
Karma: 75568269
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Will putting a "select books modified since the start of this chain" after the action select all the books I'd originally selected, or only those that have actually changed?
|
![]() |
![]() |
![]() |
#629 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,200
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Quote:
Edit: You need to remove or rename the original chain before importing the modified version because they have the same name. Last edited by capink; 08-02-2021 at 06:17 PM. |
|
![]() |
![]() |
![]() |
#630 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,054
Karma: 75568269
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Thanks.
![]() I noticed that re-importing an exported chain didn't work before. I think it might make sense if it could automatically be appended with a number, Send to Device 01 for instance. |
![]() |
![]() |
![]() |
|
![]() |
||||
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 |