View Single Post
Old 07-03-2011, 06:34 AM   #1
chaley
Grand Sorcerer
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: 12,453
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Some API changes in the current release (0.8.8) and the next one

API changes in 0.8.8
  • The API for gui2.tag_browser changed in 0.8.8. The file gui2.tag_browser.py no longer exists, having been split into 4 files found in gui2.tag_browser.*.py. Functions like searching and boxing tag items are in ui.py. Other functions have moved around to model.py or view.py.
  • The API for starting EditAuthorsDialog changed in 0.8.8. It requires an additional argument "select_link", which if true will cause the new author_link column to be selected for the id also passed in. This new argument has been added to gui2.tag_browser.ui.do_author_sort_edit(), defaulting to false.
Not API changes but worth noting:
  • the authors table now contains a column for storing a URL associated with that author. This link is set/modified using Manage Authors. The URL is used in book details. If an author has no URL, then the URL template set in preferences -> book details is used. A new template function, swap_around_comma(), has been provided to facilitate turning LN, FN names into FN LN for use in this (and other) templates. This function would be used when the library is LN, FN but the resulting URL must use FN LN order. Swap_around_comma is a convenience function, equivalent to calling re('^(.*?),(.*$)', '\2 \1').
  • Composite columns now have a "show as HTML in book details" check box. The intent is to indicate that the composite column should be rendered as HTML in situations where it is appropriate, such as book details or in the content server.
API change in 0.8.9:
  • database2.format_metadata() now caches during a given calibre session the data returned by os.stat(). If a format is changed outside of calibre, then the cache will be incorrect, containing stale data. For example, calibre won't know the file has changed if you use open_with and sigil to change it, so format_metadata can return stale data.

    The cache is not persistent. It is rebuilt every time calibre starts, which limits the lifetime of the stale data. Also, you can force format_metadata() to refresh the cache for a book by using a new additional argument "allow_cache".
  • New template functions: The metadata for formats will be available in templates via two new template functions, formats_modtimes() and formats_sizes(). You can use these to create composite columns showing the information, or in coloring rules, or what-have-you. In addition, two template functions are provided for formatting numeric information: human_readable() and format_number(). Finally, a new function has_cover() returns whether or not a book has a cover associated with it.
chaley is offline   Reply With Quote