|
|
#1 |
|
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Sep 2016
Device: Tolino Shine 3 HD
|
Custom column GPM
Hey,
I'm trying to create a column called Collection but I'm failing. Code:
program:
library_name = current_library_name();
rating = field('rating');
read_state = field('#read');
if read_state != "Read":
output = "{0}: {1} Stars".format(library_name, rating);
else:
output = "{0}: {1}".format(library_name, read_state);
return output;
This template doesn't compile, even though I don't see no reason why it wouldn't. I'm not a Python programmer but this seems to me absolutely fine. Thanks in advance. |
|
|
|
|
|
#2 |
|
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
GPM is not python, it is a mini-language documented in the calibre manual and compiled TO python.
You can also write custom template functions in python, and use those in GPM. Last edited by eschwartz; 09-04-2016 at 08:20 PM. Reason: typo |
|
|
|
| Advert | |
|
|
|
|
#3 | |
|
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Sep 2016
Device: Tolino Shine 3 HD
|
Quote:
Thanks for the pointer. |
|
|
|
|
|
|
#4 |
|
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Happy to help.
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Custom column returns value based on value of another custom column? | calvin-c | Calibre | 3 | 09-14-2013 03:24 PM |
| Custom yes/no column built from long text column | Philantrop | Library Management | 7 | 03-23-2013 08:44 PM |
| how to move value(s) of tag column to a custom made column | zoorakhan | Library Management | 0 | 12-08-2012 04:53 AM |
| custom date column from two state column | Dopedangel | Library Management | 7 | 01-03-2012 09:20 AM |
| Can custom book data be displayed in a custom column? | kiwidude | Development | 9 | 03-02-2011 06:35 AM |