Database ids when working with devices
Ok, my head hurts from looking through this code for the last few hours so I shall ask instead for someone who knows...
For my Reading List plugin, I have added the ability to remove books from a device based on them being in a list.
I had to copy/paste a chunk of code from gui2.actions.delete.py with some tweaks for my requirements.
The problem I have is that when looping through the (model, id, path) values coming back from the "DeleteMatchingFromDeviceDialog", I want to translate that supposed "id" into a book id. As that id isn't actually an "id" as I require, it appears to be more an index into the model.db (retrieved earlier using model.paths_for_db_ids())
So I need to know the "real Calibre id" for each "supposed id". There is undoubtedly some stupidly simple lookup I can do to translate this. For instance I can do "model.db[id].title" and I can see that gives me the "book" (Metadata) I am after, but if I do model.db[id].id I get an AttributeError.
|