Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 09-26-2020, 01:02 PM   #1
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,233
Karma: 11768331
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Python functions in database and calibre 5

Hi,

I have some template functions in the database that are not python 3 compatibles (that pesky '<>'). Problem is, they give an error starting calibre 5 and I cannot modify them. Is there any way to modify them in calibre 5 or do I have to write down all the functions that fail, open the database in calibre 4, modify them and open again with calibre 5?

Last edited by Terisa de morgan; 09-26-2020 at 01:05 PM.
Terisa de morgan is online now   Reply With Quote
Old 09-26-2020, 04:57 PM   #2
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,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Terisa de morgan View Post
Hi,

I have some template functions in the database that are not python 3 compatibles (that pesky '<>'). Problem is, they give an error starting calibre 5 and I cannot modify them. Is there any way to modify them in calibre 5 or do I have to write down all the functions that fail, open the database in calibre 4, modify them and open again with calibre 5?
No, there isn't a way to modify failing functions in calibre, be it 4 or 5. The assumption in the code is that the functions compile.

You can get the text of the functions using an sqlite data browser like this one. Open metadata.db and show the preferences table. The text of all of the functions are json-encoded in the row 'user_template_functions'.
chaley is offline   Reply With Quote
Old 09-26-2020, 05:08 PM   #3
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,233
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 chaley View Post
No, there isn't a way to modify failing functions in calibre, be it 4 or 5. The assumption in the code is that the functions compile.

You can get the text of the functions using an sqlite data browser like this one. Open metadata.db and show the preferences table. The text of all of the functions are json-encoded in the row 'user_template_functions'.
Thank you, I'll do that... and that assumption, when we are changing the compiler... is a bit heavy, from my POV. But no problem, I can update it in that way.
Terisa de morgan is online now   Reply With Quote
Old 09-26-2020, 05:15 PM   #4
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,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Something that might help in the future: I am in process of implementing callable template functions. The new GPM parser/interpreter scheme already implemented makes these possible with good performance. The idea is to store a calibre GPM template as a pseudo user function. You can reference these functions using the new "call" expression. GPM now supports if-then-else and infix relationals so perhaps it will now be easier for you to use. And yes, I know that having the function name as the first argument is strange, but it fits in with the language scheme
chaley is offline   Reply With Quote
Old 09-26-2020, 05:49 PM   #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,090
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by chaley View Post
Something that might help in the future: I am in process of implementing callable template functions.
That would be a welcome addition. I was looking or something like this when I was working on the find duplicates plugin. Is there a time frame for this?
capink is offline   Reply With Quote
Old 09-26-2020, 05:54 PM   #6
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,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by capink View Post
That would be a welcome addition. I was looking or something like this when I was working on the find duplicates plugin. Is there a time frame for this?
Could be a week or two, probably not months. The code is mostly done. The issue is that Kovid is entirely (and rightly) consumed with the calibre 5 release. He will review the changes when he has time.
chaley is offline   Reply With Quote
Old 09-26-2020, 06:06 PM   #7
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,090
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by chaley View Post
Could be a week or two, probably not months. The code is mostly done. The issue is that Kovid is entirely (and rightly) consumed with the calibre 5 release. He will review the changes when he has time.
That's great
capink is offline   Reply With Quote
Old 09-27-2020, 02:52 AM   #8
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,233
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 chaley View Post
Something that might help in the future: I am in process of implementing callable template functions. The new GPM parser/interpreter scheme already implemented makes these possible with good performance. The idea is to store a calibre GPM template as a pseudo user function. You can reference these functions using the new "call" expression. GPM now supports if-then-else and infix relationals so perhaps it will now be easier for you to use. And yes, I know that having the function name as the first argument is strange, but it fits in with the language scheme
Thank you, I'll give it a try when it appears in calibre.
Terisa de morgan is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Certain Functions of Calibre Not Working? BasilGrows Calibre 1 06-08-2012 12:14 AM
Accessing the database from Python richlyon Development 2 12-13-2011 11:43 AM
Most often used calibre functions thearr Calibre 17 08-07-2011 02:44 PM
Bad database and python tobarefeet Calibre 1 03-31-2010 01:55 PM
Help Understanding Calibre Functions Knocka Calibre 8 04-08-2009 11:31 PM


All times are GMT -4. The time now is 06:28 AM.


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