View Single Post
Old 05-09-2011, 03:46 PM   #1
kiwidude
calibre/Sigil 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,224
Karma: 1334002
Join Date: Oct 2010
Location: London, UK
Device: Kindle Paperwhite 3G, iPad 3, iPad Air
Device connectivity related questions

I wanted to confirm some behaviour that I see with my Kindle to see if it is an across devices/Calibre "design" feature. This is building on top of some information given previously by chaley regarding some signals posted here on the BookSync thread.

If anyone could confirm the following for me as some have relevance for my next version of Book Sync:
  1. If I have any kind of dialog open at the time I connect my device, the "connection" attempt is ignored. I have to unplug the device and plug it in again (while no dialogs open)?
  2. Likewise once I click Eject on the device button, there is no way of getting Calibre to see my device again until I unplug it and plug it in again?
  3. Connecting to iTunes as a "device", it has no uuid/device info type structure. So the assumption is there can be only one instance of iTunes, and it is identified as being connected to iTunes by get_current_device_information()['info'][0] being 'iTunes'?
  4. All "other" devices (connecting to folder, or to a genuine device) will have the drive info information in ['info'][4] to retrieve a name, uuid etc. And ['info'][0] contains some kind of "device class" information, that does not change regardless of how a user renames their device?
  5. I see that driveinfo information from ['info'][4] potentially could contain multiple locations. Not owning a device that has such capabilities, is this something I should be concerned with? It seems each location would have its own name and uuid?
  6. Related to this, release 0.7.45 had some info about sending news preferentially to main memory and falling back to other locations on the device if no space available. I have no idea where this logic lives. chaley suggested I could use self.gui.sync_to_device() - does that contain the logic within it?

I'm thinking about how I can configure the Book Sync plugin. I would have a section on the plugin configuration dialog which the user can use to add a device, delete and rename it.

I will require a device to be connected to interrogate the driveinfo. So if the user does not have a device connected, they must cancel out of the dialog, plug their device in, go back into the configuration dialog, and at that point I can detect what they have connected and automatically stick it in the list of devices for them (with some "enabled" checkboxes and a delete button). They will also be able to rename a device, which I will write back using the set_driveinfo_name() function.

Sync lists will then be per device per library stored in my config file.

I think my biggest question right now relates to which location(s) to support. I think my "easy way" is to only support "main" just like existing news does, and trust that if I call sync_to_device() it will take care of any issues like space etc.

However I know from people who have posted in the past that there are users who want to have their books on a different storage card other than "main". They can do this I believe for normal books by setting a default storage card? However for news they cannot. Presumably for me to support this I would need to list all the locations retrieved from driveinfo as potential sync lists, leaving it to the user to uncheck ones they are not interested in storing. How does sync_to_device() respond if there was not sufficient space to put the books on the chosen non-main location?

Thoughts appreciated.
kiwidude is offline   Reply With Quote