View Single Post
Old 03-02-2011, 05:05 AM   #7
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 4,926
Karma: 802238
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by kiwidude View Post
So now you have committed the new identifier stuff, would I be correct in saying that the correct way to display one of the new identifiers in a custom column is to use a program template and do something like:
Code:
name:GoodreadsId
def evaluate(self, formatter, kwargs, mi, locals, val):
    return mi.get_identifiers().get('goodreads_id','')
and then in my custom column I do this:
{'':GoodreadsId()}

Or is there a better way?
The first thing you must do is add the identifier to the book using db2.set_identifier. Once that is done, then to see the identifier in a custom column, use the new 'select' function, which is a generalized version of what you proposed. Something like {identifiers:select(goodreads_id)}.

To search, use 'identifiers:goodreads_id:what-have-you.' This is a keypair search (something new), searching for key:value pairs. Matching the key and the value are independent, and can use contains, exact, and regexp matching. For example, identifiers:good:true will find all books with a key containing 'good'.
chaley is offline   Reply With Quote