12-24-2020, 05:24 PM | #181 |
Wizard
Posts: 1,134
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
Edit: Will change the icon for the final release.
Last edited by capink; 12-24-2020 at 05:31 PM. |
12-24-2020, 05:38 PM | #182 |
Custom User Title
Posts: 9,361
Karma: 63297233
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Thank you.
|
Advert | |
|
12-24-2020, 06:16 PM | #183 |
Custom User Title
Posts: 9,361
Karma: 63297233
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Could the template conditions be used in place of selection modifiers?
In my fanfiction cleanup chain, I have a "Select AO3 books" modifier (publisher:"=Archive of Our Own"), then "Add ao3: modifiers" search & replace. I'm thinking I could just tag the second action with a conditional to only run it if the template matches Archive of Our Own. Is this an intended use, or are there any problems with it I should know about? Last edited by ownedbycats; 12-24-2020 at 06:19 PM. |
12-24-2020, 06:27 PM | #184 |
Wizard
Posts: 1,134
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
It is not going to work for two reasons, conditions work on a one metadata object (the first selected book, on an empty metadata object if no book is selected). This may or may not change in the future, but even if it does, if the books you want to apply actions to are not selected, conditions will not apply to them.
|
12-24-2020, 06:35 PM | #185 |
Custom User Title
Posts: 9,361
Karma: 63297233
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Ok, that makes sense. I just thought it might be nice to avoid the book list going a bit nuts when multiple selection modifiers are run in a chain (I know there's no real way around this).
|
Advert | |
|
12-25-2020, 03:18 PM | #186 |
Guru
Posts: 941
Karma: 418804
Join Date: Jun 2015
Device: Rocketbook, kobo aura h2o, kobo forma, kobo libra color
|
Wow, that's a lot of new neat features all at once! It'll take me a while to digest this, mostly because I have to upgrade everything and then test each feature.
I think this will let me merge a couple of action chains I've been running one at a time, and also remove a few more manual steps. The danger of this is that eventually I won't remember what the chains do anymore or what steps I'm suppose to perform without them. |
12-25-2020, 04:03 PM | #187 | |
Custom User Title
Posts: 9,361
Karma: 63297233
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Quote:
|
|
12-25-2020, 04:27 PM | #188 | |
Grand Sorcerer
Posts: 11,961
Karma: 7225107
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
|
|
12-25-2020, 04:28 PM | #189 |
Guru
Posts: 941
Karma: 418804
Join Date: Jun 2015
Device: Rocketbook, kobo aura h2o, kobo forma, kobo libra color
|
Yes, and I'm VERY greatful for that option. I comment the actions too.
The point though, is that action chains is going to make me lazy and I'll forget to the point where I'll just run the chain automatically, and if I have to run any part if it by hand I'll have to go back into the chain to remind myself of what it does. |
12-25-2020, 04:39 PM | #190 |
Custom User Title
Posts: 9,361
Karma: 63297233
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
|
12-25-2020, 10:22 PM | #191 | |
Custom User Title
Posts: 9,361
Karma: 63297233
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Quote:
I selected a single book and went to restore the bookmark. It didn't activate. The other actions ran okay with both single and multiple books selected. I made sure the datatype, comparison, and value were all correct Is this condition only meant to run on full chains? EDIT: moved agent ransack crap to new post Last edited by ownedbycats; 12-26-2020 at 12:05 AM. |
|
12-26-2020, 12:05 AM | #192 |
Custom User Title
Posts: 9,361
Karma: 63297233
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Also, how experimental is the "use multiple selections" feature? Agent Ransack fails to launch entirely with this:
Code:
{ "active": true, "chain_settings": { "chain_links": [ { "action_name": "Open With", "action_settings": { "allow_multiple": true, "args": "-d", "path_opt": "folder", "path_sep": ";", "path_to_binary": "C:\\Program Files\\Mythicsoft\\Agent Ransack\\AgentRansack.exe", "use_default_app": false }, "comment": "" } ], "refresh_gui": true }, "image": "", "menuText": "Search with Agent Ransack", "subMenu": "" }, "C:\Program Files\Mythicsoft\Agent Ransack\AgentRansack.exe" -d "D:\Test1";"D:\Test2" The action works if multiple selections is disabled. Note that nothing appeared in Ransack's error log (it does if I send it a -d with no paths). EDIT: Debug log: Code:
Action Chains: Starting chain: Search with Agent Ransack Action Chains: Search with Agent Ransack: starting action No. 1: Open With Open: C:\Program Files\Mythicsoft\Agent Ransack\AgentRansack.exe (file): "D:\Documents\My Books\Jenny Oldfield\Starlight (5627)";"D:\Documents\My Books\Jenny Oldfield\Steamboat Charlie (5626)" (args): -d mutiple: True About to run a command: C:\Program Files\Mythicsoft\Agent Ransack\AgentRansack.exe Job Spy: self.gui.tags_view.recount() is enhanced for showing icons of user category child values... Action Chains: chain (Search with Agent Ransack) finished in: 0.2760617733001709 Code:
Action Chains: Starting chain: Search with Agent Ransack Action Chains: Search with Agent Ransack: starting action No. 1: Open With Open: C:\Program Files\Mythicsoft\Agent Ransack\AgentRansack.exe (file): D:\Documents\My Books\Jenny Oldfield\Steamboat Charlie (5626) (args): -d mutiple: False About to run a command: C:\Program Files\Mythicsoft\Agent Ransack\AgentRansack.exe Job Spy: self.gui.tags_view.recount() is enhanced for showing icons of user category child values... Action Chains: chain (Search with Agent Ransack) finished in: 0.2923429012298584 Last edited by ownedbycats; 12-26-2020 at 03:59 AM. |
12-26-2020, 05:53 AM | #193 | |
Wizard
Posts: 1,134
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
Quote:
Code:
Action Chains: Starting chain: single field ask at runtime Action Chains: single field ask at runtime: Conditions are not met for action No. 1 (Single Field Edit) Action Chains: chain (single field ask at runtime) finished in: 0.8641304969787598 Last edited by capink; 01-19-2021 at 10:38 AM. |
|
12-26-2020, 06:17 AM | #194 | |
Wizard
Posts: 1,134
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
Quote:
However, from looking at your debug, one possible problem is that I did not account for program paths with spaces (missed this because it does not happen on linux). The version I will post later today will correct this by double quoting the program we are calling. If this does not help, I cannot offer much assistance with this. Last edited by capink; 12-26-2020 at 07:22 AM. |
|
12-26-2020, 11:20 AM | #195 |
Wizard
Posts: 1,134
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
Remove format(s) custom action
Code:
# calibre Python 3 compatibility. import six from six import text_type as unicode from six.moves import range from PyQt5.Qt import (Qt, QWidget, QVBoxLayout, QHBoxLayout, QGridLayout, QFrame, QGroupBox, QCheckBox, QLineEdit, QRadioButton) from calibre.gui2.widgets2 import Dialog from calibre.ebooks.metadata.meta import metadata_from_formats from calibre_plugins.action_chains.actions.base import ChainAction class ConfigWidget(QWidget): def __init__(self, plugin_action): QWidget.__init__(self) self.plugin_action = plugin_action self.gui = plugin_action.gui self.db = self.gui.current_db self._init_controls() def _init_controls(self): l = self.l = QVBoxLayout(self) self.setLayout(l) line = QFrame(self) line.setFrameShape(QFrame.HLine) line.setFrameShadow(QFrame.Sunken) l.addWidget(line) group_box = QGroupBox(_('Formats options')) group_box_l = QVBoxLayout() group_box.setLayout(group_box_l) l.addWidget(group_box) self.all_opt = QRadioButton(_('Remove all formats')) self.all_opt.setChecked(True) group_box_l.addWidget(self.all_opt) self.include_opt = QRadioButton(_('Remove only specified formats (comma separated list)')) self.include_edit = QLineEdit() group_box_l.addWidget(self.include_opt) group_box_l.addWidget(self.include_edit) self.exclude_opt = QRadioButton(_('Remove all formats except spcefied (comma separated list)')) self.exclude_edit = QLineEdit() group_box_l.addWidget(self.exclude_opt) group_box_l.addWidget(self.exclude_edit) l.addStretch(1) def load_settings(self, settings): if settings: if settings['opt'] == 'all': self.all_opt.setChecked(True) elif settings['opt'] == 'include': self.include_opt.setChecked(True) self.include_edit.setText(settings['include']) elif settings['opt'] == 'exclude': self.exclude_opt.setChecked(True) self.exclude_edit.setText(settings['exclude']) def save_settings(self): settings = {} if self.all_opt.isChecked(): settings['opt'] = 'all' elif self.include_opt.isChecked(): settings['opt'] = 'include' settings['include'] = self.include_edit.text() elif self.exclude_opt.isChecked(): settings['opt'] = 'exclude' settings['exclude'] = self.exclude_edit.text() return settings class RemoveFormats(ChainAction): name = 'Remove Formats' 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: fmts_to_delete = set() fmts_string = db.formats(book_id, index_is_id=True) if fmts_string: available_fmts = [ fmt.strip().upper() for fmt in fmts_string.split(',') ] else: available_fmts = [] if settings['remove_opt'] == 'all': if available_fmts: fmts_to_delete = available_fmts elif settings['remove_opt'] == 'include': fmts_to_delete = [ fmt.strip().upper() for fmt in settings.get('include', '').split(',') ] elif settings['remove_opt'] == 'exclude': fmts_to_keep = set([ fmt.strip().upper() for fmt in settings.get('exclude', '').split(',') ]) fmts_to_delete = set(available_fmts).difference(fmts_to_keep) for fmt in fmts_to_delete: fmt = fmt.upper() if fmt in available_fmts: db.remove_format(book_id, fmt, index_is_id=True, notify=False) def default_settings(self): return {'opt': 'all'} def config_widget(self): return ConfigWidget Last edited by capink; 08-26-2021 at 05:23 PM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Editor Plugin] Editor Chains | capink | Plugins | 94 | 07-03-2024 07:26 PM |
Action Chains Resources | capink | Plugins | 65 | 07-01-2024 03:12 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 |