View Single Post
Old 05-20-2015, 11:42 AM   #662
AJvK
Member
AJvK knows the square root of minus one.AJvK knows the square root of minus one.AJvK knows the square root of minus one.AJvK knows the square root of minus one.AJvK knows the square root of minus one.AJvK knows the square root of minus one.AJvK knows the square root of minus one.AJvK knows the square root of minus one.AJvK knows the square root of minus one.AJvK knows the square root of minus one.AJvK knows the square root of minus one.
 
Posts: 24
Karma: 7940
Join Date: Jun 2013
Device: Kindle Voyage, Kobo Aura (normal and HD)
Question

Quote:
Originally Posted by pchrist7 View Post
Do you have a Kindle ?
Did you ever want Calibre to show "Read Status" of your books in a column ?
Automagically ?
I just updated from a Kobo to a Kindle Voyage - I had a read status working on my old Kobo and tried your method for the Kindle. Sorry if it's been asked and answered - couldn't find it in the long long thread - but I can't get it working...

When I try to create the Template Function, I get an error:

Quote:
calibre, version 2.28.0
ERROR: Template functions: Exception while compiling function

Traceback (most recent call last):
File "site-packages/calibre/gui2/preferences/template_functions.py", line 170, in create_button_clicked
File "site-packages/calibre/utils/formatter_functions.py", line 1534, in compile_user_function
File "<string>", line 5
def evaluate(self, formatter, kwargs, mi, locals, val, is_read_pct, is_reading_str, no_page_read_str): try: test_val = int(is_read_pct) except: return 'is_read_pct is not a number' import re mg = re.match('.*\s(\d+[-/]\d+[-/]\d+).*?Last Page Read: Location \d+ \((\d+)%\)', val, re.I + re.DOTALL); if mg is None: return no_page_read_str date = mg.group(1) pct = mg.group(2) try: f = int(pct) if f > test_val: return date elif f > 0: return is_reading_str + ': ' + pct + '%' except: pass return no_page_read_str
^
SyntaxError: invalid syntax
I can of course create the custom column, but all I get beneath it is

kindle_read_status: unknown function

Quick update: I fixed the syntax error. Dunno why, but it didn't work when I copied the code from the mobile site. When I tried it from the .com version, I could create the Template Function without error.
However, now when I connect my Kindle Voyage and fetch annotations, I get the following error message:

EXCEPTION: evaluate() takes exactly 10 arguments (9 given)

What is going wrong here? Any help is still greatly appreciated

Last edited by AJvK; 05-20-2015 at 01:22 PM. Reason: new information
AJvK is offline   Reply With Quote