View Single Post
Old 01-01-2012, 09:04 AM   #318
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,733
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
@davidfor - thanks for that, try the attached version. Probably something I broke when refactoring for this API stuff.

@JimmXinu - try the attached version. The relevant methods now have a display_warnings parameter which you can set to False.

Bearing in mind that these methods should still be called from a GUI thread and not a background thread, because adding/removing from a list can result in changes to the database if the user has rules setup to modify tags/custom columns based on list add/remove. Any database updates need to be done on the UI thread to be sure there is no conflict with the user currently editing data manually etc. So hence why plugins like metadata downloads force the operation back onto the GUI thread by prompting with a dialog after the background work is done. I suggest you follow the same pattern if the rest of your plugin is doing background work stuff.

I have also exposed for your convenience:
get_book_list(list_name)
get_list_names(exclude_auto=True)

Let me know if I broke anything else, I have only given this a quick test.

Last edited by kiwidude; 01-12-2012 at 05:06 PM. Reason: Removed attachment as latest version officially released
kiwidude is offline   Reply With Quote