Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 09-04-2016, 05:18 PM   #1
foobarius
Junior Member
foobarius began at the beginning.
 
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;
Where the #read column is a multiple-choice column with values such as "Read" or "In Progress" or "DNF"

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.
foobarius is offline   Reply With Quote
Old 09-04-2016, 06:01 PM   #2
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
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 07:20 PM. Reason: typo
eschwartz is offline   Reply With Quote
Advert
Old 09-04-2016, 07:06 PM   #3
foobarius
Junior Member
foobarius began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Sep 2016
Device: Tolino Shine 3 HD
Quote:
Originally Posted by eschwartz View Post
GPM is not python, it is a mini-language documented in the calibre manual and compiled TO python.

You can alo write custom template functions in python, and use those in GPM.
I got tripped up by the "TO python" as I didn't thoroughly read it.

Thanks for the pointer.
foobarius is offline   Reply With Quote
Old 09-04-2016, 07:20 PM   #4
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
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.
eschwartz is offline   Reply With Quote
Reply


Forum Jump

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 02:24 PM
Custom yes/no column built from long text column Philantrop Library Management 7 03-23-2013 07:44 PM
how to move value(s) of tag column to a custom made column zoorakhan Library Management 0 12-08-2012 03:53 AM
custom date column from two state column Dopedangel Library Management 7 01-03-2012 08:20 AM
Can custom book data be displayed in a custom column? kiwidude Development 9 03-02-2011 05:35 AM


All times are GMT -4. The time now is 04:57 AM.


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