View Single Post
Old 03-04-2012, 10:43 PM   #1
sumpin
Enthusiast
sumpin is a splendid one to beholdsumpin is a splendid one to beholdsumpin is a splendid one to beholdsumpin is a splendid one to beholdsumpin is a splendid one to beholdsumpin is a splendid one to beholdsumpin is a splendid one to beholdsumpin is a splendid one to beholdsumpin is a splendid one to beholdsumpin is a splendid one to beholdsumpin is a splendid one to behold
 
Posts: 29
Karma: 19952
Join Date: Sep 2011
Location: USA & UK
Device: down to just a PW4
[Kindle Touch] Calibre Kindle Collections Plug-in Hooks


This extension converts the collections in the Content Catalog (/var/local/cc.db) on the Kindle Touch to a JSON file (/mnt/us/system/collections.json) that can be read and updated by the Calibre Kindle Collections Plug-in. It then inserts/updates the collections managed by Calibre in Content Catalog. The script is compatible with collections and content that only exist on the Kindle and not in Calibre per the plug-in and books may exist in multiple collections.

Requirements:
1. Jailbreak - https://www.mobileread.com/forums/sho...d.php?t=160454
2. Launcher - https://www.mobileread.com/forums/sho...d.php?t=161263
3. Calibre - http://calibre-ebook.com/download
4. Calibre managed data stored on the Kindle in documents/calibre (i.e., under Calibre Preferences > Sending books to devices, Save template starts with: calibre)
5. Sqlite3 built with loadable extension support to run on the Kindle (included)

Install:
1. Extract both tar files to /mnt/us/extensions (If your zip file extractor has a setting like "TAR file smart CR/LF conversion", make sure it is disabled or the scripts cannot run)
2. Restart Kindle

To Use:
1. Select “Create input for Calibre” to export the existing collections
2. Connect Kindle to computer, run Calibre Kindle Collections Plug-in, eject Kindle
3. Select “Import data from Calibre and reboot” to import the new/modified collections

Note:
By default, when the Calibre data is loaded, the access times of all books is updated (avoid by changing –uat to +uat in menu.json) and the database is cleaned up by deleting the Collections Journal and by issuing an SQL VACUUM command (avoid by changing –vacuum to +vacuum in menu.json). To disable removing collections with no entries on import, add +rec to the command line of json2db.sh in menu.json.

By default, 5 copies of cc.db are maintained in /mnt/us/system. This can be changed by modifying the command line params of the json2db.sh script in menu.json.

If you run the import procedure too soon after loading data via Calibre, you may find that some books that are in a collection show up as not in a collection. Simply run the import again.

This supersedes my input to https://www.mobileread.com/forums/sho...d.php?t=160855 as that thread has taken the directory structure driven approach of CollectionSync https://www.mobileread.com/forums/sho...1&postcount=16.

I've split the release up into two parts. One tar file contains the sqlite3 binary and loadable extension needed and the other contains the Launcher hooks and scripts that do all the work.

I added a "progress bar" to the non-verbose import/export screens to give feedback that it's ticking along when importing large databases and I added verbose import/export to the menu to aid in trouble shooting and boredom reduction.

Updated for firmware 5.1.0 (use dynamic launcher menu, eips command line changes). Add menu item to update access times and remove this as default behavior.

Attachment d2j2d.tar.gz last updated on April 26th, 2012.
Attached Files
File Type: gz d2j2d-sql.tar.gz (884.8 KB, 1100 views)
File Type: gz d2j2d.tar.gz (11.3 KB, 980 views)

Last edited by sumpin; 04-26-2012 at 03:41 PM.
sumpin is offline   Reply With Quote