12-17-2020, 03:27 PM | #121 | |
Grand Sorcerer
Posts: 11,765
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Here is a copy of formatter.py with that change. EDIT: removed attachment now that the files are in the official calibre source. Last edited by chaley; 12-19-2020 at 06:03 AM. Reason: Removed attachment |
|
12-17-2020, 04:12 PM | #122 |
Wizard
Posts: 1,106
Karma: 1954138
Join Date: Aug 2015
Device: Kindle
|
Running the new copy I get the following error:
Code:
Traceback (most recent call last): File "/home/user/calibre-5.7.2/src/calibre/utils/formatter.py", line 884, in safe_format ans = self.evaluate(fmt, [], kwargs, global_vars) File "/home/user/calibre-5.7.2/src/calibre/utils/formatter.py", line 845, in evaluate ans = self._eval_program(kwargs.get('$', None), fmt[8:], File "/home/user/calibre-5.7.2/src/calibre/utils/formatter.py", line 753, in _eval_program tree = self.gpm_parser.program(self, self.funcs, self.lex_scanner.scan(prog)) File "/home/user/calibre-5.7.2/src/calibre/utils/formatter.py", line 325, in program tree = self.expression_list() File "/home/user/calibre-5.7.2/src/calibre/utils/formatter.py", line 333, in expression_list expr_list.append(self.infix_expr()) File "/home/user/calibre-5.7.2/src/calibre/utils/formatter.py", line 377, in infix_expr left = self.expr() File "/home/user/calibre-5.7.2/src/calibre/utils/formatter.py", line 418, in expr self.error(_('Unknown function {0}').format(id_)) File "/home/user/calibre-5.7.2/src/calibre/utils/formatter.py", line 168, in error raise ValueError(m) ValueError: Formatter: Unknown function globals near 'globals' debug: template_output: (TEMPLATE_ERROR: Formatter: Unknown function globals near 'globals') Last edited by capink; 12-17-2020 at 04:18 PM. |
Advert | |
|
12-17-2020, 04:27 PM | #123 |
Grand Sorcerer
Posts: 11,765
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Sorry, you also need this: calibre.utils.formatter_functions.py.
And no, the second version isn't suboptimal. The issue for me is that the behavior can seem "magic", but sometimes that is what one wants. EDIT: Removed attachment now that the files are in the official calibre source. Last edited by chaley; 12-19-2020 at 06:04 AM. Reason: Removed attachment |
12-18-2020, 12:00 AM | #124 |
Custom User Title
Posts: 8,754
Karma: 62032371
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
"Show Marked Books" seems to broken again in the newest update. I got this error upon validation:
Code:
Menu entry: Show marked books (plugin_name: Mark Books) cannot be found |
12-18-2020, 04:27 AM | #125 |
Hedge Wizard
Posts: 800
Karma: 19999999
Join Date: May 2011
Location: UK/Philippines
Device: Kobo Touch, Nook Simple
|
Yes thank you. That did the trick.
I just have to learn to use it now. When I was working I was the Guru and main user of a database progtam aimed specifically at auditors. They added a similar feature to "action Chains" called a "stack". I tested it out and found that, when used it would perform each task and end up with the correct number of records on completion. The problem was they were not the records required. Apparently no one else had spotted the problem. The "stack" feature was removed and as far as I know never replaced. Two or three years later I retired. |
Advert | |
|
12-18-2020, 08:56 AM | #126 | |
Wizard
Posts: 1,106
Karma: 1954138
Join Date: Aug 2015
Device: Kindle
|
Quote:
This is strange and I cannot reproduce it. The log even shows that the plugin is getting "Show marked books" and disregarding the number, which is the intended effect after the fix. Try and see if you can get a clear pattern of how to re-produce this. Last edited by capink; 12-18-2020 at 08:58 AM. |
|
12-18-2020, 09:00 AM | #127 | |
Wizard
Posts: 1,106
Karma: 1954138
Join Date: Aug 2015
Device: Kindle
|
Quote:
|
|
12-18-2020, 09:20 AM | #128 | |
Wizard
Posts: 1,106
Karma: 1954138
Join Date: Aug 2015
Device: Kindle
|
Quote:
1. New action to add to chain variables maybe call it "Chain Variables". Suggestions on a better name are welcome. 2. Conditional execution of actions. Have not settled on how to this yet. It can be done with one template column OR two name/value columns. Leaning towards starting with the former as a test version and see feedback. Still open to the other solution if people don't like the first one, I just think it gives more power to test multiple conditions. Edit: Maybe a template/template_result pair. e.g "program: current_library_name()"/my_library1. If they match the action runs? same for "program: globals(myvar)"/myvar_val Will initially call the template on the first selected book. Last edited by capink; 12-18-2020 at 11:21 AM. |
|
12-18-2020, 01:21 PM | #129 |
Interested in the matter
Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
|
12-18-2020, 01:25 PM | #130 | ||
Grand Sorcerer
Posts: 11,765
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
|
||
12-18-2020, 01:56 PM | #131 | |
Wizard
Posts: 1,106
Karma: 1954138
Join Date: Aug 2015
Device: Kindle
|
Quote:
If you don't want to post the whole thing, post the snippet correlating to that particular action. |
|
12-18-2020, 02:08 PM | #132 |
Wizard
Posts: 1,106
Karma: 1954138
Join Date: Aug 2015
Device: Kindle
|
You have been very helpful
|
12-18-2020, 02:32 PM | #133 |
Custom User Title
Posts: 8,754
Karma: 62032371
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Here's the JSON for my chain:
Code:
{ "active": true, "chain_settings": { "chain_links": [ { "action_name": "Calibre Actions", "action_settings": [ { "display": "Toggle mark for selected books", "path": [ "Mark Books", "Toggle mark for selected books" ], "paths_text": "Toggle mark for selected books" } ], "comment": "Mark books" }, { "action_name": "Calibre Actions", "action_settings": [ { "display": "Clean the selecteds Comments", "path": [ "Comments Cleaner", "Clean the selecteds Comments" ], "paths_text": "Clean the selecteds Comments" } ], "comment": "Run Comments Cleaner" }, { "action_name": "Search And Replace", "action_settings": { "case_sensitive": true, "comma_separated": true, "destination_field": "tags", "multiple_separator": " ::: ", "replace_func": "", "replace_mode": "Replace field", "replace_with": "", "results_count": 999, "s_r_dst_ident": "", "s_r_error": null, "s_r_src_ident": "amazon", "s_r_template": "", "search_field": "tags", "search_for": "@cleanup", "search_mode": "Regular expression", "starting_from": 1 }, "comment": "Remove @cleanup tag" }, { "action_name": "Selection Modifier", "action_settings": { "restriction": {}, "search": { "opt": "new", "search_text": "publisher:\"=Archive of Our Own\"" }, "selection": "chain_modified" }, "comment": "Select AO3 books" }, { "action_name": "Search And Replace", "action_settings": { "case_sensitive": true, "comma_separated": true, "destination_field": "identifiers", "multiple_separator": " ::: ", "replace_func": "", "replace_mode": "Replace field", "replace_with": "\\1", "results_count": 999, "s_r_dst_ident": "ao3", "s_r_error": null, "s_r_src_ident": "url", "s_r_template": "", "search_field": "identifiers", "search_for": "https://archiveofourown.org/works/(\\d+)", "search_mode": "Regular expression", "starting_from": 1 }, "comment": "Add ao3: identifiers" }, { "action_name": "Selection Modifier", "action_settings": { "restriction": {}, "search": { "opt": "new", "search_text": "publisher:\"=FanFiction.net\"" }, "selection": "chain_modified" }, "comment": "Select FFnet books" }, { "action_name": "Search And Replace", "action_settings": { "case_sensitive": false, "comma_separated": true, "destination_field": "identifiers", "multiple_separator": " ::: ", "replace_func": "", "replace_mode": "Replace field", "replace_with": "\\1", "results_count": 999, "s_r_dst_ident": "ffnet", "s_r_error": null, "s_r_src_ident": "url", "s_r_template": "", "search_field": "identifiers", "search_for": "https://www.fanfiction.net/s/(\\d+)/1/", "search_mode": "Regular expression", "starting_from": 1 }, "comment": "Add ffnet: identifiers" }, { "action_name": "Selection Modifier", "action_settings": { "restriction": {}, "search": { "opt": "new", "search_text": "not #fanficstatus:\"=Anthology\" and not #fanficstatus:\"=In-Progress\"" }, "selection": "chain_modified" }, "comment": "Select Completed/Oneshot books" }, { "action_name": "Search And Replace", "action_settings": { "case_sensitive": false, "comma_separated": true, "destination_field": "identifiers", "multiple_separator": " ::: ", "replace_func": "", "replace_mode": "Replace field", "replace_with": "", "results_count": 999, "s_r_dst_ident": "url", "s_r_error": null, "s_r_src_ident": "", "s_r_template": "", "search_field": "identifiers", "search_for": "(.*)", "search_mode": "Regular expression", "starting_from": 1 }, "comment": "Remove url: identifiers" }, { "action_name": "Calibre Actions", "action_settings": [ { "display": "Fanfiction", "path": [ "View Manager", "Fanfiction" ], "paths_text": "Fanfiction" } ], "comment": "Switch to Fanfiction view/VL" }, { "action_name": "Calibre Actions", "action_settings": [ { "display": "Show marked books", "path": [ "Mark Books", "Show marked books" ] } ], "comment": "Show marked books" } ], "refresh_gui": true }, "image": "Fanfiction.png", "menuText": "Cleanup: Fanfiction", "subMenu": "" } ] } |
12-18-2020, 04:31 PM | #134 |
Wizard
Posts: 1,106
Karma: 1954138
Join Date: Aug 2015
Device: Kindle
|
Can you please uninstall the plugin, re-download and tell me if it makes a difference? I am still unable to replicate this behavior.
|
12-18-2020, 04:38 PM | #135 |
Custom User Title
Posts: 8,754
Karma: 62032371
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
1. Reinstall plugin. Restart Calibre.
2. Run it on a fanfic. It works successfully this time. 3. Use "Clear all marked books." 4. Re-add the url: identifier to the test fic. 5. Run it again. This time get the validation error (same as what I posted before). |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Action Chains Resources | capink | Plugins | 62 | 05-17-2024 12:54 AM |
[Editor Plugin] Editor Chains | capink | Plugins | 90 | 04-29-2024 12:21 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 |