View Single Post
Old 04-27-2011, 08:23 AM   #30
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: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kiwidude View Post
I guess another possible implementation that comes to mind is to ask chaley (if there isn't already) to add some signals in which would allow this plugin to effectively replicate what "news" syncing does, but in my own independent sync lists.
I think you already have what you need. You can get notified about a device connection by connecting to gui2.device_signals.device_connection_changed(bool ). If you need to look at the device_db, then also connect to gui2.device_signals.device_metadata_available.

You can use the device_information list, and in particular the driveinfo dict in the fifth element, to manage individual devices. If you want to see this list, then connect to gui2.device_signals.device_metadata_available. When it fires, call foo=gui.device_manager.get_current_device_informat ion() and get the driveinfo dict from foo[4]. That dict has the device UUID and a bunch of other info you can use to determine whether or not to send the queued documents. You would use gui.sync_to_device if you want calibre to select between formats and do auto-conversion. You could use gui.upload_books if you don't care about format checking and will supply the formats to send.
chaley is offline