Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 04-21-2021, 06:24 PM   #1
Xwang
Connoisseur
Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.
 
Posts: 77
Karma: 2136220
Join Date: Sep 2012
Device: none
Pass a parameter to external viewer using a custom column vaue

Hi,
I've added a custom column in the calibre database which contains the last read page for each book.
I would like to use that value with the -p parameter of okular so that to open the file at the last read page.
Is it possible?
Xwang is offline   Reply With Quote
Old 04-21-2021, 06:40 PM   #2
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
Yes, there are currently two plugins that can do this (both has a template option that can read values from custom columns):
Edit: Currently it is not possible to pass an argument value from a template, only the book format. So this probably not going to work of you.

Last edited by capink; 04-21-2021 at 06:51 PM.
capink is offline   Reply With Quote
Advert
Old 04-21-2021, 09:21 PM   #3
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 is a workaround to this in the Action Chains plugin. The chain to run you program is attached to this post. (Action chains > add/modify chains > import).

You will need to edit the template in the first action (Copy To Clipboard) to replace the "#my_int_col" with your custom column name.

The attached chain constructs a temporary shell script containing the appropriate command, and then runs it.

Next version of the plugin will allow using template for command arguments.
Attached Files
File Type: zip Open with Okular.zip (551 Bytes, 147 views)
capink is offline   Reply With Quote
Old 04-22-2021, 06:32 AM   #4
Xwang
Connoisseur
Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.
 
Posts: 77
Karma: 2136220
Join Date: Sep 2012
Device: none
Quote:
Originally Posted by capink View Post
There is a workaround to this in the Action Chains plugin. The chain to run you program is attached to this post. (Action chains > add/modify chains > import).

You will need to edit the template in the first action (Copy To Clipboard) to replace the "#my_int_col" with your custom column name.

The attached chain constructs a temporary shell script containing the appropriate command, and then runs it.

Next version of the plugin will allow using template for command arguments.
Is it possible to add bash stile if logic so that to check if the custom column last read page is present or not?
I've a huge library and the value is populated only for files which I've read or I'm reading currently.

EDIT: I've seen it is not possible and so I've changed the "#my_int_col" with
ifempty($#last_read_page, 1)
Is it correct?
The issue is that I do not seen any additional button or contextual menu entry and it seems to ignore the plugin and keep calling okular directly.
Maybe I've done something wrong?

Last edited by Xwang; 04-22-2021 at 06:51 AM.
Xwang is offline   Reply With Quote
Old 04-22-2021, 06:49 AM   #5
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
It should be possible. But it is better to add a third action to open the file with okular without specifying the page number. You will also need to add conditions to each action specifying when to run. The first and second actions will only run if the custom column has a value. The third action will run if does not have a value.

Attached is modified version of the chain with the above conditions set. Note that you still have to replace all instances of #my_int_col with your custom column, including in the condition templates for all three actions.
Attached Files
File Type: zip Open with Okular.zip (682 Bytes, 130 views)
capink is offline   Reply With Quote
Advert
Old 04-22-2021, 07:00 AM   #6
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 Xwang View Post
EDIT: I've seen it is not possible and so I've changed the "#my_int_col" with
ifempty($#last_read_page, 1)
Is it correct?
The issue is that I do not seen any additional button or contextual menu entry and it seems to ignore the plugin and keep calling okular directly.
Maybe I've done something wrong?
That is good idea, better than adding a third action. It should work.
capink is offline   Reply With Quote
Old 04-22-2021, 07:17 AM   #7
Xwang
Connoisseur
Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.
 
Posts: 77
Karma: 2136220
Join Date: Sep 2012
Device: none
Quote:
Originally Posted by capink View Post
That is good idea, better than adding a third action. It should work.
As I said I do not see any additional menu or button and when I open a pdf calibre starts it without the -p parameter (I've checked the running processes)
Xwang is offline   Reply With Quote
Old 04-22-2021, 07:30 AM   #8
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
It is the same menu entry called "Open with Okular" under "Action Chains". There is no additional buttons or menu entries. You have to remove the old chain to be able to import the new one because they have the same name.
capink is offline   Reply With Quote
Old 04-22-2021, 09:23 AM   #9
Xwang
Connoisseur
Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.
 
Posts: 77
Karma: 2136220
Join Date: Sep 2012
Device: none
Quote:
Originally Posted by capink View Post
It is the same menu entry called "Open with Okular" under "Action Chains". There is no additional buttons or menu entries. You have to remove the old chain to be able to import the new one because they have the same name.
Sorry, but I am not understanding.
I've installed the plugin action chains this morning and configured the command wth the ifempty.
So I've not installed the second zip you send me, because it seems that it should work.
However it is not working (the -p parameter is not present in the called process and to be sure I've made a test changing the okular command name in the plugin with blablabla which does not exists and when I double click the book in calibre it keeps opening the file with okular) and I am not understanding why.
Xwang is offline   Reply With Quote
Old 04-22-2021, 09:53 AM   #10
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 it is not working for whatever reason, use the second zip I attached. You have to remove the old entry first before you import the second one because they have the same name.
capink is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using RE to extract pattern from custom column into another custom column activedirectory Library Management 1 12-15-2019 08:07 PM
Adding custom column with any lookup-name gives me empty column as a result? Ahu Lee Library Management 16 06-09-2019 12:14 PM
Browser Viewer: Long-text Custom Column nqk Server 8 08-05-2018 08:25 AM
Move selected data from series column to a new custom column fvdham Library Management 3 06-02-2017 03:49 PM
Custom column returns value based on value of another custom column? calvin-c Calibre 3 09-14-2013 02:24 PM


All times are GMT -4. The time now is 07:10 AM.


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