Need information on the calibre object model

Bug #771992 reported by David Nemeskey
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Fix Released
Undecided
Unassigned

Bug Description

Hey,

I have been using Calibre for a few days now, and although I checked the homepage and googled around a bit, I could not find information on the calibre object model. More specifically, there is only a sentence about the parameters formatter, kwargs, mi and locals passed to the template functions, and that's not really enough to use them.

For example, if I would like to extract the number of books associated with a certain author, I am stuck because such information is not available in the manual.

So please, extend the manual with information on calibre's essentials, the meaning of the parameters, etc; and even a few examples would not hurt.

Related branches

Revision history for this message
Charles Haley (cbhaley) wrote :

Are you referring to the template functions definition preference? If so, that box has access to the source of all the built-in template functions. It is hard to imagine better examples.

As for the "object model", the best documentation available is the calibre source.

FYI: template functions operate on a book-by-book basis. General queries are not possible. The only way to do the query you described is to write SQL directly against the database.

Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 771992

The template language is comprehensively documented, with
examples, here: http://calibre-ebook.com/user_manual/template_lang.html

At least it is as comprehensively documented as we have the patience for.
If you need more, use the source, Luke :)

Offhand, I'd say there's no easy way to do what you want via the template
language. calibre maintains all metadata in a nice, normalized, SQLite
database, use that.

 status invalid

Changed in calibre:
status: New → Invalid
Revision history for this message
David Nemeskey (nemeskeyd) wrote :

Thanks for the reply, too bad it's not possible.

However, I don't think this feature request should have been marked invalid. What I asked for was documentation not on the template language, but on the python API, which is nowhere to be found, and it would be nice to have. I understand if you don't have the time to update the manual; however, in this case the status should be changed to Won't fix instead.

On a related note (I know it should be a separate bug report), but the box does not show the code for predefined template functions, only those I created. I'm using Ubuntu 10.10 and the calibre version downloaded two days ago from the homepage.

Revision history for this message
Charles Haley (cbhaley) wrote :

Pushed a fix (I hope) for not seeing the source for template functions when not running from calibre source.

Revision history for this message
Kovid Goyal (kovid) wrote :

All those objects your are asking for API documentation of are really trivial, with the mi object being the only exception. I've added API documentation for it to the tutorial.

Changed in calibre:
status: Invalid → Fix Released
Revision history for this message
David Nemeskey (nemeskeyd) wrote :

Thanks guys, looking forward to the next version.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.