Hello Davidfor,
I can confirm that the third method, copy-pasting to the KT, works. That's how I manage my ebooks.
I will run some tests on your suspision that the database is not properly closed. I will also take a closer look at my suspision that by manually upgrading the KT Firmware the database version does not agree with the schema expectations of the new firmware.
I'll get back to you.
EDIT:
I have run a couple more tests. As a premise, I took as granted that my database is somehow corrupted or the firmware garbled, so I performed a hard reset (restored firmware to 2.1.0) and then reupdated to 2.4.0. I then deleted the database and had the firmware create a blank one.
First of, the database version after that was 71, confirming that a manual updating in the order 2.1.0 to 2.3.1 to 2.3.2 to 2.4.0 somehow ends up having the database version getting stuck at 69.
Starting with a blank database, I uploaded a series of books with series information and shelves set.
In no case was the KT ejected via calibre during these tests. It was always ejected from the OS using HAL.
Here's what I found:
Database closing
After starting calibre and uploading the books, the database was always closed after the job was completed. That applies to both a running instance of calibre as well as having calibre closed. In all cases, the following was returned when checking for open instances:
Quote:
ichrispa@Cassandra:/> lsof | grep -E "/sqlite/ && /KOBO/"
ichrispa@Cassandra:/>
|
The database is always closed correctly.
Database corruption
The database corruption scenario is the same as described above. It might however be ebook specific, as it appears to only happen with certain books and not with others. While I was testing around, I used the Harry Potter series this time. No corruption occured. When using A Song of Ice and Fire, the database got busted. I will later try to find out what attribute of an epub triggers this behavior.
I did try to restore my old database by reinserting all values from the backup into the fresh database:
Quote:
ichrispa@Cassandra:/media/KOBOeReader/.kobo> echo .dump | sqlite3 KoboReader-sqlite-20130310.bak \
awk '/INSERT/' | sqlite3 KoboReader.sqlite
Error: near line 1: PRIMARY KEY must be unique
Error: near line 2: column ContentID is not unique
Error: near line 3: column ContentID is not unique
Error: near line 1195: near "file": syntax error
Error: near line 2078: near "file": syntax error
Error: near line 2880: columns volumeId, shortcoverId are not unique
...
|
Although the "pragma integrity_check;" returns "ok" for the backup, when I tried to "dump" the table contents of the backup into the fresh database, numerous errors occured. That includes mutliple instances of primary key violations and non unique values where required errors. However this might be attributed to the different database version, since the backup was version 69 and the fresh instance was version 71.
Setting series/shelve information
Here's the strange part. The behavior of this is very similar to what I described in my previous test: The books transfered show up, but the series/shelves information appears not to be set. Shelves appear empty if newly created.
Since I did not eject using calibre I inspected the changes the driver made to the database.
After adding the books using calibre, the contents table
does not include the series and bookshelve information. In fact, the books are not present in the contents table at all!
After unmounting/disconnecting the device the KT goes into the "Processing contents" mode. No shelves or series information show up. When reconnecting the KT and reinspecting the database, the books are in the contents database, but have (obviously) no series/shelves information set.
Restarting calibre and running "Tranfer to device" again (on the books already on the device), then disconnecting the KT, results in skipping the "Processing contents" dialog, since the books are already in the database.
After that, both shelve information and series are shown properly.
(My) conclusion
I cannot conclude to what the database corruption is attributed. But it appears to be related to specific epubs.
When the KT processes new content, all information is derived from the metadata included in the epub. Any manual changes to the database are effectively overwritten by "Processing contents". Only if an ebook is already in the database, the series and shelves information are kept.
I would conclude that the driver does not add entries to the database when transferring books. It only runs UPDATE, not INSERT. Only if a book is already in the database by having run "Processing Contents" the driver is capable to set the proper information.
ReEDIT:
While finishing up the tests I made a little mistake that proved to be very conclusive: I deleted all file/folders on the kobo, then unplugged it.
Since there was no database present and no more contents to be scanned, the KT should not show any books. However, the contents show by the KT where identical to what was there before I accidentally deleted everything. Books, shelves, metainfo - everything was accessable.
I would deduce that the KT does not close its handle of the database when connecting to a PC.