|
|
#1 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,687
Karma: 12595249
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 02:05 PM. |
|
|
|
|
|
#2 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
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'. |
|
|
|
|
|
|
#3 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,687
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
Quote:
|
|
|
|
|
|
|
#4 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
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
|
|
|
|
|
|
#5 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,216
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
|
|
|
|
|
|
#6 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
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.
|
|
|
|
|
|
#7 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,216
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
|
|
|
|
|
|
#8 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,687
Karma: 12595249
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 01:14 AM |
| Accessing the database from Python | richlyon | Development | 2 | 12-13-2011 12:43 PM |
| Most often used calibre functions | thearr | Calibre | 17 | 08-07-2011 03:44 PM |
| Bad database and python | tobarefeet | Calibre | 1 | 03-31-2010 02:55 PM |
| Help Understanding Calibre Functions | Knocka | Calibre | 8 | 04-09-2009 12:31 AM |