Hmmm. I seem to be back at the beginning again...
Create Collections is still running before the books are recognized as being on the device - even though they have been sent to the device!
I have modified the code to use jobs, and I've used the latest 0.8.5 code. I clearly see the Book sync job get kicked off, then the create job, and at some point the send metadata job. The send to device definitely finished before the create runs, but the books are not seen on the device by create when I run a query to check
Code:
Job starting Get device information
Job starting Get list of books on device
Job starting Upload 4 books to device:Life, the Universe and Everything, So Long, and Thanks For All the Fish, The Hitchhiker’s_Guide_to the Galaxy, The_Restaurant_at the End of the Universe
Job starting Create Kindle Collections
Job starting Send metadata to device
I've added a debug line in my calibre code to indicate if a book is seen as on device or not on the device. I use this code to check if on device:
Code:
query = 'ondevice:True'
self.ids_on_device = self.db.search_getting_ids(query, None)
query = ''
self.all_ids = self.db.search_getting_ids(query, None)
debug_print('%d ids, %d on device' % (len(self.all_ids), len(self.ids_on_device)))
Execution shows that if I mark a new book for syncing, the book gets sent to the device but when Create runs it sees the book as not on the device. When I run create again just after, its seen as on the device.
Is the db updated with on device status at the end of send to device, during send metadata, or in a parallel job kicked off from send to device? Is there a way to make sure the ondevice info is correct before finishing send to device?
I've tried changing the Send to Device manual/on send/automatic, but all that did on automatic is kick off an extra send metadata before book sync. Oh, and I found I had a call to get device info in my code that was setting my percent job done line to 100% - I changed it to just use the current values for the device since calibre already called the get device info routine.
Oh look, Ubuntu 11.04 hasn't crashed in a few hours - guess that proposed change for the X server might have worked (hope I haven't jinxed it

)