06-20-2011, 12:27 PM | #1 |
Calibre Plugins Developer
Posts: 4,661
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
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. |
06-20-2011, 12:34 PM | #2 |
Calibre Plugins Developer
Posts: 4,661
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Ahhh - amazing what walking away from the keyboard for 10 seconds does - I can use model.db[id].application_id
|
Advert | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calibre Database cp Kindle Database | mitch13 | Library Management | 1 | 05-22-2011 07:33 PM |
ids - Best practice | drMerry | Library Management | 7 | 05-07-2011 11:02 AM |
unable to update your devices database.syncing cannot be completed? | baronrus | Kobo Reader | 5 | 12-20-2010 10:25 AM |
ids down ? | reaver121 | iRex | 0 | 01-16-2010 09:53 AM |
Cut the hype and get us working e-reader devices! | Alexander Turcic | Which one should I buy? | 13 | 08-31-2006 03:39 PM |