Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 06-06-2024, 12:17 PM   #1366
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,139
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by Zillion_ View Post
Hello,

since recently I'm getting the following error when running Chains from the main Calibre window, which call Editor change which include other Editor chains (worked fine before).
Any idea what's wrong please ? I've tried editing the chains and removing actions one by one but it doesn't help...
Spoiler:


calibre, version 7.12.0
ERROR: Unhandled exception: <b>TypeError</b>:cannot pickle 'ChainInterfaceAction' object

calibre 7.12 embedded-python: True
Windows-10-10.0.19045-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19045')
Python 3.11.5
Windows: ('10', '10.0.19045', 'SP0', 'Multiprocessor Free')
Interface language: None
EXE path: C:\Program Files\Calibre2\calibre.exe
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (2, 12, 0) && DeDRM (7, 2, 1) && Package KFX (from KFX Input) (2, 12, 0) && Action Chains (1, 20, 4) && Amazon.com Multiple Countries (1, 0, 0) && Annotations (1, 17, 13) && BOL_NL (5, 1, 3) && Baen (1, 1, 0) && Barnes & Noble (1, 5, 5) && CalibreSpy (1, 0, 92) && Count Pages (1, 13, 6) && Editor Chains (1, 1, 7) && EpubSplit (3, 7, 0) && Fantastic Fiction (1, 7, 0) && Favourites Menu (1, 3, 1) && FictionDB (1, 4, 2) && Find Duplicates (1, 10, 9) && Generate Cover (2, 3, 4) && Goodreads (1, 8, 1) && Goodreads More Tags (1, 2, 1) && ISFDB3 (1, 4, 0) && Job Spy (1, 0, 239) && KFX metadata reader (from KFX Input) (2, 12, 0) && From KFX (2, 12, 0) && KFX Input (2, 12, 0) && Set KFX metadata (from KFX Output) (2, 8, 0) && KFX Output (2, 8, 0) && Kindle hi-res covers (0, 5, 1) && KindleUnpack - The Plugin (0, 83, 1) && Kobo Books (1, 9, 2) && Last Modified (0, 8, 5) && Manage Series (1, 5, 2) && Modify ePub (1, 8, 3) && Open With (1, 8, 3) && Prettify Cover (1, 6, 0) && Quality Check (1, 13, 10) && Quick Preferences (1, 7, 1) && Reading List (1, 15, 4) && Reformat plugin (2, 4, 0) && Resize Cover (1, 2, 1) && Save To Format (0, 0, 6) && Search The Internet (1, 11, 2) && Skoob Books (1, 5, 5) && SmartEject (2, 5, 0) && TextDiff (1, 2, 4) && User Category (1, 6, 1) && View Manager (1, 10, 3)
Traceback (most recent call last):
File "calibre_plugins.action_chains.action", line 452, in run_chain
File "calibre_plugins.action_chains.chains", line 457, in run
File "calibre_plugins.action_chains.chains", line 239, in _run_loop
File "calibre_plugins.action_chains.chains", line 209, in _run_loop
File "calibre_plugins.editor_chains.action_chains", line 416, in run
File "calibre_plugins.editor_chains.headless", line 53, in run_editor_chain
File "calibre_plugins.editor_chains.chains", line 354, in run
File "calibre_plugins.editor_chains.chains", line 219, in _run_loop
File "calibre_plugins.editor_chains.chains", line 196, in _run_loop
File "calibre_plugins.editor_chains.actions.chain_calle r", line 150, in run
File "copy.py", line 146, in deepcopy
File "copy.py", line 231, in _deepcopy_dict
File "copy.py", line 146, in deepcopy
File "copy.py", line 231, in _deepcopy_dict
File "copy.py", line 172, in deepcopy
File "copy.py", line 271, in _reconstruct
File "copy.py", line 146, in deepcopy
File "copy.py", line 231, in _deepcopy_dict
File "copy.py", line 161, in deepcopy
TypeError: cannot pickle 'ChainInterfaceAction' object
Try version attached and report whether it solves the issue.

Last edited by capink; 06-10-2024 at 09:20 AM. Reason: Remove zip attachment
capink is offline   Reply With Quote
Old 06-10-2024, 04:53 AM   #1367
Zillion_
Enthusiast
Zillion_ began at the beginning.
 
Posts: 29
Karma: 10
Join Date: Jul 2023
Device: KindleOasis10thGen
Thumbs up Thanks !

Yes indeed, that fixes it !
Many thanks, capink

Zillion_ is offline   Reply With Quote
Advert
Old 06-27-2024, 11:09 AM   #1368
noahkiss
Junior Member
noahkiss began at the beginning.
 
Posts: 2
Karma: 10
Join Date: May 2024
Device: Kobo Clara Colour, Kindle Oasis
Question

hey all, sorry for the silly question. I've tried searching here and reviewing the template page, but I'm still stuck.

All I'm trying to do is find any $title which contains a colon or a hyphen, and move the second half to a custom #subtitle field.

Right now I have the find & replace working fine - the regex I use is two-stage (I don't know how to do it in one stage with the search and replace action) where I search for .+ ?[:-] (.+) and put the first match into the #subtitle field, then do a second search for (.+) ?[:-] .+ and replace the $title field with the first match, to remove the subtitle.

I'm trying to move these two saved searches into an action chain, though, and therefore I'd like to be able to just run it on any selection in my library. With the way I have it configured, though, this causes issues on books which don't have a [:-] in the title, due to how search & replace seems to work (if no capture groups exist, \1 just matches the whole search, so the full title will be transferred into #subtitle).

Anyway, what I'm trying to do now is to use a template scope to filter the action to only run on titles which contain [:-].

The problem I'm having is that I guess I'm just dumb and I can't figure out how exactly to just use a template to limit to a subset of my current scope. There's a contains(), but that seems to just give back text. I've tried downloading and reviewing a few chains posted here that have scopes, but it doesn't make much sense to me. I guess I haven't wrapped my brain around exactly how calibre templates work.

I'm sure this can all be done in one step, the main thing I have difficulty understanding is how incoming and outgoing variables are handled, or basically the 'state' of everything that I'm acting on.

Thanks for reading!

Last edited by noahkiss; 06-27-2024 at 11:13 AM. Reason: trying to fix formatting
noahkiss is offline   Reply With Quote
Old 06-27-2024, 03:19 PM   #1369
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,139
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by noahkiss View Post
Anyway, what I'm trying to do now is to use a template scope to filter the action to only run on titles which contain [:-].
You don't need to use templates for this. You can use Basic scope with the following search:

Code:
title:~.+:.+
Attached Thumbnails
Click image for larger version

Name:	Screenshot_20240627_211649.jpg
Views:	778
Size:	74.5 KB
ID:	209211  
capink is offline   Reply With Quote
Old 06-29-2024, 07:24 PM   #1370
tkshorty
Junior Member
tkshorty began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jun 2024
Device: Koba Aura
Hi all,

I am pretty sure that there is a really simple way to do this if you know Python and the calibre classes. Sadly I don't
So here is what I want to do:
1. display a message after a chain is completed and user has to press ok to close the message
2. display a message after a chain is completed and user has to press ok to close the message or message closes automatically after X seconds
3. query the user with a yes / no question and call a chain depending on answer (without using a new custom field to do that)
tkshorty is offline   Reply With Quote
Advert
Old 06-29-2024, 08:37 PM   #1371
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,139
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by tkshorty View Post
Hi all,

I am pretty sure that there is a really simple way to do this if you know Python and the calibre classes. Sadly I don't
So here is what I want to do:
1. display a message after a chain is completed and user has to press ok to close the message
2. display a message after a chain is completed and user has to press ok to close the message or message closes automatically after X seconds
3. query the user with a yes / no question and call a chain depending on answer (without using a new custom field to do that)
You can do no.1 and no.3 with this custom module. To add the module, go to Action Chains > Manage Modules > add > copy/paste. After which a new custom action called "Confirm" will be added, and can be used to splash a yes/no message with a customized message.

As for no.2 you simply add another "Run Python Code" action, with the following code:

Code:
import time

def run(gui, settings, chain):
    time.sleep(5)
Replace the digit in red with how many seconds you want.
capink is offline   Reply With Quote
Old 06-30-2024, 04:20 PM   #1372
tkshorty
Junior Member
tkshorty began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jun 2024
Device: Koba Aura
Thumbs up

Quote:
Originally Posted by capink View Post
You can do no.1 and no.3 with this custom module. To add the module, go to Action Chains > Manage Modules > add > copy/paste. After which a new custom action called "Confirm" will be added, and can be used to splash a yes/no message with a customized message.

As for no.2 you simply add another "Run Python Code" action, with the following code:

Code:
import time

def run(gui, settings, chain):
    time.sleep(5)
Replace the digit in red with how many seconds you want.
Thanks a lot
tkshorty is offline   Reply With Quote
Old 07-26-2024, 07:34 AM   #1373
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 9,534
Karma: 64960939
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Was the option to set a predefined value to the current datetime removed for some reason? template with today() works but it's odd.

Click image for larger version

Name:	2024-07-26 07_33_31-Single Field Edit.png
Views:	771
Size:	9.9 KB
ID:	209764

EDIT: Existing ones still work as expected.

Last edited by ownedbycats; 07-26-2024 at 09:15 AM.
ownedbycats is online now   Reply With Quote
Old 07-26-2024, 03:56 PM   #1374
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,139
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
It is working for me in both existing and new ones. Is this happening only with date columns? Also maybe the widget is resizing properly, so make it bigger manually and see if the option were hidden.
capink is offline   Reply With Quote
Old 07-26-2024, 07:37 PM   #1375
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 9,534
Karma: 64960939
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
It was a window size issue. The widget disappears if the window height too short.
ownedbycats is online now   Reply With Quote
Old 07-27-2024, 07:41 PM   #1376
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 9,534
Karma: 64960939
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Is it possible to use chain-caller on a specific variant of a chain?
ownedbycats is online now   Reply With Quote
Old 07-27-2024, 10:34 PM   #1377
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,139
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Is it possible to use chain-caller on a specific variant of a chain?
Theoretically it should be possible, but I have not tried it myself. So you have a go and tell how it went:
  • In the caller chain, define the following variable using the Chain Variables action:
    Code:
    _variant_argument = 'your_variant_argument'
  • In the chain caller action, enable the option to pass variables to the called chain.
capink is offline   Reply With Quote
Old 08-02-2024, 01:56 AM   #1378
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 9,534
Karma: 64960939
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by capink View Post
Theoretically it should be possible, but I have not tried it myself. So you have a go and tell how it went:
  • In the caller chain, define the following variable using the Chain Variables action:
    Code:
    _variant_argument = 'your_variant_argument'
  • In the chain caller action, enable the option to pass variables to the called chain.
I got around to finally testing this - I don't know if it failed or if I made a mistake.

My called chain has a variant called 'tbr'

Code:
program:
    add_chain_variant('Add to Backlog','rg','', 'statistics.png');
    add_chain_variant('Add to Backlog + TBR List','tbr','','statistics.png');
so I added this variable:

Click image for larger version

Name:	2024-08-02 01_54_30-Chain Variables.png
Views:	720
Size:	12.8 KB
ID:	209892

Click image for larger version

Name:	2024-08-02 01_54_37-Chain Caller.png
Views:	711
Size:	7.0 KB
ID:	209893

The two actions marked under 'tbr' didn't run, though.

EDIT: I figured it out, I misunderstood the instructions. I was only supposed to put tbr (no quotes and not the full thing) into the template.

Last edited by ownedbycats; 08-02-2024 at 02:03 AM.
ownedbycats is online now   Reply With Quote
Old 08-13-2024, 08:03 PM   #1379
foosion
Evangelist
foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.
 
Posts: 441
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
Before I get too far into the documentation, is it possible to create a chain that:

1) Runs Sync Now from the Reading List plugin
2) Runs the SmartEject plugin
foosion is offline   Reply With Quote
Old 08-13-2024, 08:39 PM   #1380
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 9,534
Karma: 64960939
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Probably not as expected. When I run "sync now" from an action chain it just silently fails half the time and I have to run it manually.
ownedbycats is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Editor Plugin] Editor Chains capink Plugins 94 07-03-2024 08:26 PM
Action Chains Resources capink Plugins 65 07-01-2024 04:12 PM
[GUI Plugin] Noosfere_util, a companion plugin to noosfere DB lrpirlet Plugins 2 08-18-2022 04:15 PM
[GUI Plugin] Save Virtual Libraries To Column (GUI) chaley Plugins 14 04-04-2021 06:25 AM


All times are GMT -4. The time now is 03:57 PM.


MobileRead.com is a privately owned, operated and funded community.