View Single Post
Old 09-06-2010, 09:51 AM   #6
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,704
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by timlegge View Post
Done, I have been seeing the Manage Collections item on the popup menu and the Collections column however, double-clicking on the book in the Collections column does not do anything.
Ahhh... you also need to add
CAN_SET_METADATA = True
in your driver. Try putting it after line 29
FORMATS = ['epub', 'pdf']
Quote:
playlist_map = {}

if readstatus == 1:
if lpath not in playlist_map:
playlist_map[lpath] = []
playlist_map[lpath].append("I\'m Reading")

and later:
book.device_collections = playlist_map.get(book.lpath, [])

That does display "I'm Reading" in the correct books in the gui.
Good. At least that much is working.
Quote:
I am still trying to understand how the tags interact. I am assuming that if I tag a book in the Library with an I'm Reading tag that the collections functionality can use that to create a Device Collection (if the driver is told to do something with that tag). I just need to parse the tags and ensure that the metadata file holds the device collections and that the database on the device is updated to set the reading status to 0 or 1 depending on the tags for the books. I may be missing the point totally...
You have it right. That said, you need to decide what functionality you are trying to support.

You have already shown that you can create a collection from the Kobo's I'm_Reading flag, and that the user can see this collection on the device view. Once you add the CAN_SET_METADATA, the user will be able to change that field. The question is 'what is supposed to happen'? For example, what if the user adds 'Foobar' to the collection list? What is the Kobo supposed to do with that? What if the user adds 'I'm Reading'? Is the Kobo supposed to set the bit in the database? If the user sets a tag 'Reading' (or some such), is the Kobo driver supposed to turn the bit on? Is it possible to use the Kobo to turn the bit off? If so, what is calibre supposed to do?

My guess is that as a first iteration, you should report the I'm Reading status back to the user in a collection. Second iteration: allow the user to edit a book's collections, either adding or removing I'm Reading, than having the Kobo driver either set or clear the bit. We might want to add another interface method so that the GUI can enquire of the driver whether the collection list is valid for the device, to handle the Foobar case. Third iteration: associate a tag with I'm Reading. If the tag is present, then set the Kobo's bit. If the tag is absent, then clear the Kobo's bit. You may want to require that Manage Metadata be set to Automatic, so that editing the collections on the device view is prohibited. Otherwise there will be unpleasant interactions between the processing of the tag and the user's manual changes. Just random thoughts...
chaley is offline   Reply With Quote