09-26-2020, 01:02 PM | #1 |
Grand Sorcerer
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. |
09-26-2020, 04:57 PM | #2 | |
Grand Sorcerer
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
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'. |
|
09-26-2020, 05:08 PM | #3 | |
Grand Sorcerer
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:
|
|
09-26-2020, 05:15 PM | #4 |
Grand Sorcerer
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
|
09-26-2020, 05:49 PM | #5 |
Wizard
Posts: 1,090
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
|
|
09-26-2020, 05:54 PM | #6 |
Grand Sorcerer
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
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.
|
09-26-2020, 06:06 PM | #7 |
Wizard
Posts: 1,090
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
|
|
09-27-2020, 02:52 AM | #8 | |
Grand Sorcerer
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:
|
|
|
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 |