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 12-13-2020, 12:43 PM   #91
jbacelar
Interested in the matter
jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.
 
jbacelar's Avatar
 
Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3



Edit: Although I have taken a look at the Import List plugin, and unfortunately it does not work for me, since I have several csv files that do not use title, and some neither title nor author, (they are based on custom columns).

Last edited by jbacelar; 12-13-2020 at 02:09 PM. Reason: Disgusting surprise
jbacelar is offline   Reply With Quote
Old 12-13-2020, 05:01 PM   #92
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: 8,811
Karma: 62032371
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I'm not sure if it's worth fixing, but the "spinning cursor in dialog" appears for some of the Kobo Utilities dialogs (Store/Restore Bookmarks, Upload Cover, and Set Reader Font). I've otherwise run into no problems using those actions in a chain.
ownedbycats is online now   Reply With Quote
Advert
Old 12-13-2020, 06:09 PM   #93
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,118
Karma: 1954138
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
I'm not sure if it's worth fixing, but the "spinning cursor in dialog" appears for some of the Kobo Utilities dialogs (Store/Restore Bookmarks, Upload Cover, and Set Reader Font). I've otherwise run into no problems using those actions in a chain.
As I already mentioned before, not really possible unless someone knows a way to programmatically detect whether a calibre action pops up dialog. The other solution is to disable the busy cursor for all calibre actions which I don't want to do.

Quote:
Originally Posted by capink View Post
The plugin starts a busy cursor that remains active from the start of the chain until it ends. I will modify it to temporarily turn it off during the popups of single field dialogs. The same cannot be done however for dialogs from Calibre Actions (e.g. Edit metadata dialog) because I have to track every possible action and see whether it pops up a dialog or not.
Edit: I might add a checkbox in the calibre action settings dialog to enable/disable it.

Last edited by capink; 12-13-2020 at 06:12 PM.
capink is offline   Reply With Quote
Old 12-13-2020, 06:11 PM   #94
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: 8,811
Karma: 62032371
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Ah, either I missed or forgot about that post. Sorry.
ownedbycats is online now   Reply With Quote
Old 12-13-2020, 06:14 PM   #95
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,118
Karma: 1954138
Join Date: Aug 2015
Device: Kindle
As I said in the edit of the previous post, a possible solution is to present the user with a checkbox to turn it off/on as he sees fit for the particular action.
capink is offline   Reply With Quote
Advert
Old 12-13-2020, 06:17 PM   #96
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: 8,811
Karma: 62032371
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Also, I wonder if it would be possible to make an option to grey out certain chains if the device isn't plugged in. It's a bit of a niche thing though, and there's no harm if I try to run the chain with no device (it just fails).
ownedbycats is online now   Reply With Quote
Old 12-14-2020, 07:44 AM   #97
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,118
Karma: 1954138
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Also, I wonder if it would be possible to make an option to grey out certain chains if the device isn't plugged in. It's a bit of a niche thing though, and there's no harm if I try to run the chain with no device (it just fails).
The plugin cannot know in advance whether a chain depends on a device being plugged. The only way to do this is by adding checkbox in the chain dialog that would disable the chain when no devices are plugged. I really don't want to clutter the chain dialog with extra options unless absolutely necessary, so will leave it for now.
capink is offline   Reply With Quote
Old 12-14-2020, 07:42 PM   #98
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: 8,811
Karma: 62032371
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Also, this plugin puts this xkcd comic into mind:



ownedbycats is online now   Reply With Quote
Old 12-15-2020, 12:48 AM   #99
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,271
Karma: 11768331
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by ownedbycats View Post
Also, this plugin puts this xkcd comic into mind:



Terisa de morgan is offline   Reply With Quote
Old 12-16-2020, 07:41 AM   #100
compurandom
Guru
compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.
 
Posts: 919
Karma: 417282
Join Date: Jun 2015
Device: kobo aura h2o, kobo forma
I would like to calculate a value and then use it in a action chain.

Specifically, I want to check which of two devices is connected (I know how to do that), and then either search for books with a (device specific) tag along with other search parameters, or pick a specific premade search (depending on which device), and remove the tag, along with other device non-specific actions on the same set of books.

If I could branch within the chain, that would make this easy, but it would be easier if I could pick a search or use a calculated constant...

Is there a way to do this currently? (or could it be added?)

Edit: I think I figured out how to do it (untested yet) by just prefixing the chain with a search that will come up empty on the wrong device and then duplicating the chain for each device. But it would be more elegant if I could use a calculated value.

Last edited by compurandom; 12-16-2020 at 08:15 AM.
compurandom is offline   Reply With Quote
Old 12-16-2020, 08:57 AM   #101
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,774
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by compurandom View Post
I would like to calculate a value and then use it in a action chain.

Specifically, I want to check which of two devices is connected (I know how to do that), and then either search for books with a (device specific) tag along with other search parameters, or pick a specific premade search (depending on which device), and remove the tag, along with other device non-specific actions on the same set of books.

If I could branch within the chain, that would make this easy, but it would be easier if I could pick a search or use a calculated constant...

Is there a way to do this currently? (or could it be added?)

Edit: I think I figured out how to do it (untested yet) by just prefixing the chain with a search that will come up empty on the wrong device and then duplicating the chain for each device. But it would be more elegant if I could use a calculated value.
I confess I don't fully understand what you want to do, but it seems that using a template search might do the trick. See the description of template searches in https://manual.calibre-ebook.com/gui...arch-interface.

Last edited by chaley; 12-16-2020 at 09:00 AM.
chaley is offline   Reply With Quote
Old 12-16-2020, 11:52 AM   #102
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,118
Karma: 1954138
Join Date: Aug 2015
Device: Kindle
I don't understand what exactly you are trying to achieve, but I will address the question of branching in general. There are two ways to do it:

Edit: Starting with version 0.4.0, action chains introduced a conditions feature that allows the user to run actions based on conditions at runtime. This also allows branching.
  • For people who don't write code the only way to do it, is exactly as you discovered yourself (and as I pointed here before) by making search that return empty results (if condition is not met) in which case actions running will not have real effect, after that another search might return results that actions will act on and so so on.
  • The other alternative involves writing a custom action that does the branching for you, and creating a master chain that contains that action. You also have to create separate chains containing the different branches (they can be all grouped in one submenu). In your master chain's custom action, you test the conditions and call the appropriate chain like illustrated below.

    Code:
    from calibre_plugins.action_chains.chains import Chain
    from calibre_plugins.action_chains.actions.base import ChainAction
    import calibre_plugins.action_chains.config as cfg
    
    class RunChain(ChainAction):
    
        name = 'Run Chain'
    
        def run(self, gui, settings, chain):
            chain_name = 'Your Chain Name'
            chain_config = cfg.get_chain_config(chain_name)
            my_new_chain = Chain(chain.plugin_action, chain_config)
            my_new_chain.run()

On a side note, I thought about giving the users the ability to call other chains through Calibre Actions or through a separate action, and maybe supplementing that with a another flow control action. I dismissed the idea because it can cause problems like circular dependency. You can prevent a chain from directly calling itself, but it can do so indirectly through another chain that might reference it, and this would require a complicated dependency checking before running chains. You can write these action(s) for yourself as custom actions if you want this be a generalized solution, but I think it is opening a can of worms.

Last edited by capink; 04-09-2021 at 05:48 PM.
capink is offline   Reply With Quote
Old 12-16-2020, 12:12 PM   #103
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: 8,811
Karma: 62032371
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by capink View Post
I dismissed the idea because it can cause problems like circular dependency. You can prevent a chain from directly calling itself, but it can do so indirectly through another chain that might reference it, and this would require a complicated dependency checking before running chains. You can write these action(s) for yourself as custom actions if you want this be a generalized solution, but I think it is opening a can of worms.
- Start ActionChain#1
- It calls ActionChain#2
- But then that calls ActionChain#1
- Which again calls ActionChain#2
- And once again, it calls ActionChain#1...

I don't think there's any good way to halt a chain in progress, is there?
ownedbycats is online now   Reply With Quote
Old 12-16-2020, 12:21 PM   #104
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,118
Karma: 1954138
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
I don't think there's any good way to halt a chain in progress, is there?
You can cache the names of the chains as they run, and once you detect a chain running for the second time, halt the whole process with an exception. It is just not a good idea to halt a chain midway. The difficult part is checking before the chain runs.
capink is offline   Reply With Quote
Old 12-16-2020, 12:37 PM   #105
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: 8,811
Karma: 62032371
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I've accidentally fork bombed my computer while trying to put together a batch file. That was fun.

Last edited by ownedbycats; 12-16-2020 at 12:49 PM.
ownedbycats is online now   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 03:53 AM.


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