I've just generalised and extended the previous script a bit more to take proper care of Kindle collections.
The attached version does the following by default:
1) Creates collections from all of your authors who have at least 4 books
2) Creates collections from all tags which start with a dash (-) character
3) Cleans out any files from collections where the file is not on the kindle (or has been changed or moved from where it was when it was added to the kindle)
4) Deletes any empty collections from the kindle
All of the above activities can be switched off using command-line switches, which can also be used to *enable* creating collections based on your series (I switched this off by default as personally I prefer not to do this en masse).
There's also a command-line switch to decide whether to update your existing collections or to recreate them from scratch based solely on the data in calibre (warning: The latter will remove all pre-existing collections and create new ones based *just* on what's in calibre).
There are a few config options at the head of the python file, to define minimum thresholds for each collection type and standard prefixes for collection names of each type. Those can be edited to define your own personal preferences.
The simplest way to use the script under Windows is to download and install Python v2.6, copy the script to the root folder of your Kindle and then just double-click the script file. If you want to add command-line switches, open a command-line prompt first.
Before running this script (or the earlier ones on this thread for that matter) make sure that your kindle contains the up to date metadata from your calible. The simplest way to do this is to set "Metadata Management" in Calibre to "Automatic management" (in Preferences -> Sending books to devices) and then exit calibre completely and then start it up again (or, alternatively, disconnect your kindle and then re-connect it). That will force calibre to send its current metadata to the kindle.
Last edited by mornington; 12-04-2010 at 08:30 AM.
Reason: Removes attachment - see later post for replacement script
|