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-30-2020, 11:44 AM   #226
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,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
There was a regression in checking templates. Check the new version in the first post, and please report back.
capink is offline   Reply With Quote
Old 12-30-2020, 12:05 PM   #227
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
Quote:
Originally Posted by capink View Post
There was a regression in checking templates. Check the new version in the first post, and please report back.
All right.
jbacelar is offline   Reply With Quote
Advert
Old 12-30-2020, 12:17 PM   #228
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,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Small idea:

I can see several uses for an "add/remove specified amount" to Single Field Edit > Integer-type, e.g. a column tracking how many times the book's been read. Possibly can already done via template though.

I'm not planning anything requiring its use in the near future, but something to consider.
As you said yourself, this is what the template option is for. That is why I don't think it is worth adding it. You can do it with the following one line:

Code:
program:
    add(re(raw_field('#my_int_column'), 'None', 0), 1)
The number in blue is the increment.

Update: As of calibre 5.13, template language supports several operator types including arithmetic operators. So people using calibre version >= 5.13 can replace the above code with this:

Code:
program:
    re($$#testint,'None','0') + 1

Last edited by capink; 05-03-2021 at 08:19 PM.
capink is offline   Reply With Quote
Old 12-31-2020, 05:25 AM   #229
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: 11,000
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Running a chain (by accident, admittedly) with "Open with: Book format" (default application) errors if the book doesn't have the specified format.

Code:
Traceback (most recent call last):
  File "calibre_plugins.action_chains.action", line 237, in run_chain
  File "calibre_plugins.action_chains.chain_tools", line 120, in run_loop
  File "calibre_plugins.action_chains.chain_tools", line 100, in run_loop
  File "calibre_plugins.action_chains.actions.open_with", line 309, in run
  File "calibre\gui2\__init__.py", line 1297, in open_local_file
  File "ntpath.py", line 452, in normpath
TypeError: expected str, bytes or os.PathLike object, not NoneType

Last edited by ownedbycats; 12-31-2020 at 05:30 AM.
ownedbycats is online now   Reply With Quote
Old 12-31-2020, 08:09 AM   #230
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,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
I will look at this and try to handle it more gracefully. But I suggest you set the following condition on the chain to disable it for books that do not have the appropriate format:

Code:
template:
program: if selection_count() == 1 then str_in_list(approximate_formats(), ',', 'EPUB', 'true', 0) fi
datatype: text comparison: = Condition value = true icon = epub.png tooltip = Single book with an epub format
Replace EPUB with whatever format you want, but in capitalized letters. And maybe find a nice epub icon to use it as the condition icon.

Edit1: Modified template to add another test for selection count.
Edit2: Remove redundant if statement.

Last edited by capink; 01-19-2021 at 10:37 AM. Reason: simplify template
capink is offline   Reply With Quote
Advert
Old 12-31-2020, 02:45 PM   #231
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: 11,000
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Thank you.

To save you a bit of extra testing, I got a different error opening a book cover when there is none:

Code:
calibre, version 5.8.1
ERROR: Unhandled exception: <b>IndexError</b>:tuple index out of range

calibre 5.8.1 [64bit]  embedded-python: True is64bit: True
Windows-10-10.0.19041 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19041')
Python 3.8.5
Windows: ('10', '10.0.19041', '', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: Action Chains (0, 5, 3) && Barnes & Noble (1, 2, 16) && Calibre Power Search Plugin (1, 7, 0) && Comments Cleaner (1, 3, 1) && Count Pages (1, 11, 0) && Embed Comic Metadata (1, 5, 2) && EpubCheck (0, 2, 3) && EpubMerge (2, 11, 0) && Extract ISBN (1, 5, 0) && FanFicFare (3, 27, 2) && Fantastic Fiction (1, 4, 0) && Favourites Menu (1, 0, 5) && Find Duplicates (1, 8, 3) && Generate Cover (2, 0, 1) && GetFileName (0, 1, 1) && Goodreads (1, 5, 1) && Import List (1, 5, 4) && Job Spy (1, 0, 189) && Kindle hi-res covers (0, 5, 0) && Kobo Books (1, 8, 0) && Kobo Utilities (2, 11, 8) && KoboTouchExtended (3, 4, 2) && Library Codes (1, 0, 50) && Manage Series (1, 2, 11) && Modify ePub (1, 6, 2) && Open With (1, 5, 13) && Quality Check (1, 11, 0) && Reading List (1, 7, 1) && Save To Format (0, 0, 6) && Save Virtual Libraries To Column (2, 0, 1) && Save Virtual Libraries To Column GUI (2, 3, 0) && Search The Internet (1, 8, 1) && SmartEject (2, 3, 0) && Sum Column (0, 3, 1) && View Manager (1, 6, 0)
Traceback (most recent call last):
  File "calibre_plugins.action_chains.actions.open_with", line 283, in run
  File "calibre_plugins.action_chains.actions.open_with", line 246, in get_file_path
calibre_plugins.action_chains.actions.open_with.OpenError: ('Cannot open with', 'Book has no cover')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "calibre_plugins.action_chains.action", line 237, in run_chain
  File "calibre_plugins.action_chains.chain_tools", line 120, in run_loop
  File "calibre_plugins.action_chains.chain_tools", line 100, in run_loop
  File "calibre_plugins.action_chains.actions.open_with", line 288, in run
  File "calibre\db\legacy.py", line 872, in func
  File "calibre\db\view.py", line 145, in get_property
IndexError: tuple index out of range
Thankfully this error shouldn't be applicable to path.

Last edited by ownedbycats; 12-31-2020 at 02:47 PM.
ownedbycats is online now   Reply With Quote
Old 12-31-2020, 03:06 PM   #232
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,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Thanks for your reports, fixed for next release.
capink is offline   Reply With Quote
Old 12-31-2020, 07:29 PM   #233
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: 11,000
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Something I've discovered:

Windows has a limit of 2047 characters in a single command-line prompt. This mostly comes into effect when sending a lot of books to an "open with" action. (This is why I usually run Power Search first, then send the files to Ransack.)

Code:
Traceback (most recent call last):
  File "calibre_plugins.action_chains.action", line 237, in run_chain
  File "calibre_plugins.action_chains.chain_tools", line 120, in run_loop
  File "calibre_plugins.action_chains.chain_tools", line 100, in run_loop
  File "calibre_plugins.action_chains.actions.open_with", line 319, in run
  File "calibre_plugins.action_chains.actions.open_with", line 361, in launch_app
  File "subprocess.py", line 854, in __init__
  File "subprocess.py", line 1307, in _execute_child
FileNotFoundError: [WinError 206] The filename or extension is too long
I doubt there's much to be done about this, aside from providing a more informative dialog.

Last edited by ownedbycats; 12-31-2020 at 07:34 PM.
ownedbycats is online now   Reply With Quote
Old 12-31-2020, 08:24 PM   #234
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,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
I don't really want to get into platform specific fixes. Maybe will look at this later to see if simple fixes exist. Problem I cannot test on Windows so difficult to do anything.

This link seems to have some solutions, one of them is changing a registry key. Give it a go and see if it helps.
capink is offline   Reply With Quote
Old 01-01-2021, 09:50 AM   #235
compurandom
Wizard
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: 1,013
Karma: 500000
Join Date: Jun 2015
Device: Rocketbook, kobo aura h2o, kobo forma, kobo libra color
windows command line limit: Unix has similar limits I think. Maybe an option (like xargs) to split up the arguments and run the command multiple times? Likely this isn't always a good idea, so I think it needs to be an option. (Or maybe a way to do it slowly?)
compurandom is offline   Reply With Quote
Old 01-01-2021, 09:54 AM   #236
compurandom
Wizard
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: 1,013
Karma: 500000
Join Date: Jun 2015
Device: Rocketbook, kobo aura h2o, kobo forma, kobo libra color
I've got a couple of action chains that for various reasons are not able to process every book in the set.

I'd like a way to end the chain with a search for the entire set, but only select the books the chain was able to process, so the user can see the results.

It would kind of like need two searches. Like, @fixthese:true and then select marked:updated

edit: maybe I can already do this? doing more testing.

edit2: One of the chains, I don't know how to do the search, because the last action in the search removes the tag the search is based on. So I'd need tags:updateme or marked:true or something like that.

Last edited by compurandom; 01-01-2021 at 10:12 AM.
compurandom is offline   Reply With Quote
Old 01-01-2021, 10:52 AM   #237
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,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by compurandom View Post
windows command line limit: Unix has similar limits I think. Maybe an option (like xargs) to split up the arguments and run the command multiple times? Likely this isn't always a good idea, so I think it needs to be an option. (Or maybe a way to do it slowly?)
I tested this on Linux yesterday, and the limit for command line argument is 2mb. I was able to process more than 2000 books withe no problem. So, it can happen if you choose a really huge set of args, but that is a corner case not worth complicating the code for.

Last edited by capink; 01-01-2021 at 10:56 AM.
capink is offline   Reply With Quote
Old 01-01-2021, 10:56 AM   #238
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,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by compurandom View Post
I've got a couple of action chains that for various reasons are not able to process every book in the set.

I'd like a way to end the chain with a search for the entire set, but only select the books the chain was able to process, so the user can see the results.

It would kind of like need two searches. Like, @fixthese:true and then select marked:updated

edit: maybe I can already do this? doing more testing.

edit2: One of the chains, I don't know how to do the search, because the last action in the search removes the tag the search is based on. So I'd need tags:updateme or marked:true or something like that.
Selection modifier > check the option books modified by chain.
capink is offline   Reply With Quote
Old 01-01-2021, 11:58 AM   #239
compurandom
Wizard
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: 1,013
Karma: 500000
Join Date: Jun 2015
Device: Rocketbook, kobo aura h2o, kobo forma, kobo libra color
Quote:
Originally Posted by capink View Post
Selection modifier > check the option books modified by chain.
Ya, found that. But can I include books that no longer match the search?
How does that work?
compurandom is offline   Reply With Quote
Old 01-01-2021, 12:10 PM   #240
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,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
If you want all the books, tick the option of all books modified by chain without choosing a search, then in the next action mark them with whatever you want, and then use another selection modifier (or the custom template based search I posted before) that searches for your marked books.
capink is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Editor Plugin] Editor Chains capink Plugins 106 06-17-2025 05:36 PM
Action Chains Resources capink Plugins 77 06-16-2025 12:45 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 09:09 AM.


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