To be able to remove damaged, large or old books from my Kobo ereader device programmatically. As my Kobo (Kobo Wifi) only has a D-pad and poor software interface, I wanted more efficiency and accuracy. (Similarly, the Desktop app doesn't seem to communicate with it well about deleting things either.)
I did a fair amount of reading on mobileread.com about my model of Kobo (Kobo Wifi, Model N647, circa 2010) and on Kobo systems in general. I found a very helpful dive at kobodb-schema.sourceforge.net where someone had dissected their kobo device db and determined the schema and relations. I took that a step further and used a tool called sqlacodegen to generate a sqlalchemy mapping of my personal device db. Now I can start using object oriented mappings to manuplate and update the data in my db.
(For those of you wondering why I didn't just SQL this jazz, my SQL foo is poor and rusty. My Python foo is much better. And its easier to share a project if its got code associated with it :D )
The database has funny connections to other tables. Many not sharing names...
content.ContentID-->content_keys.volumeIdShelf.InternalName-->ShelfContent.ShelfNameuser.UserID-->content.___UserID
There is also a quirk in that, chapter markers are stored in the content table, in addition to the books. So, a book is denoted by having a NULL BookTitle and NULL BookID. While a chapter in that book uses the Title and ContentID of its parent in the BookTitle and BookID.
book.ContentID=chapter.BookID;chapter.ContentID=book.adobe_location;chapter.adobe_locationmaps to a location within the file location as best I can tellbook.Title=chapter.BookTitle;chapter.Titlethen becomes the chapter titlebook.ContentType= 6;chapter.ContentType= 9
Unknowns....
- what is
content.ContentType= 899 ???
Mappings
content.ContentID(for the book type) maps to .kobo/kepub; alsocontent.adobe_locationshows a mounted path to the same filecontent.ImageIDmaps to .kobo/imagescontent.___FileSizeis the size in bytescontent.___UserID= 'removed' is related to previews or collections not stored on the device...?