OK. Now the problem is to match the book in the database with that in the library. The KoboTouch driver does this during the connection, so fetching extra information in a plugin like this is easy. If there is a reference in the database to the book file, that should be usable. Otherwise, you have to ask to match the books when you retrieve the status. The Annotations plugin works that way for the Kindle devices.
If you want to look at the Kobo Utilities plugin, the starting method is store_current_bookmark in action.py. That does the fetch for the currently selected books. It generates the ids to search the device database. Then calls _store_current_bookmark which reads the database and updates the calibre library. There is also a batch mechanism so that the fetch runs in the background and can be triggered when the device is connected.
To use this, you would need to:
- Modify the device detection.
- Change the database id generation in store_current_bookmark
- Replace the database fetch in _store_current_bookmark
There is some clumsy code in there, but most of what you need is in there.
|