Skip to content
Miscellaneous Utilities for dealing with a Kindle (parsing logs, etc)
Python Shell
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore
LICENSE
README
apnx_parser.py
book_stats.py
fetch-logs
log_parser.py
mobibook.py

README

Kindle Utils
============

Various utilities for doing things with a Kindle.

* log_parser.py: Parse a kindle logfile, or a directory of log files and track
  the use of the kindle. Power states and book statistics are tracked.

* book_stats.py: Print a report on book reading time, based on the statistics
  collected by log_parser.py.

* mobibook.py: Parse and return the Mobi and EXTH metadata in a mobibook file.

* apnx_parser.py: Parse and return the page number/position information in a
  Kindle Page Number Sidecar (.apnx) binary file.

* fetch-logs: Shell script to assist in pulling log files off the Kindle.

How to Use
----------
You need a jailbroken Kindle with SSH access (either via usbnet, or wifi). Once
you've got one of those, use the fetch-logs script to pull logs from your
Kindle into a local directory, and then run kindle-stats.py pointing it at the
directory containing the logs. Voila. Make sure you run fetch-logs regularly
enough that you don't lose any logfiles (once a week seems sufficient) and
you've got all you need to calculate fairly accurate stats about your reading
habits.

The script will also attempt to read titles and page information from the
actual book files if it can find them, this makes the output much more useful
that just looking at a list of ASINs and Kindle positions. By default, the
script will expect to find the books at /media/Kindle/documents, which is where
a Kindle seems to appear when connected via USB on a recent Ubuntu system.
Alternatively, you could manually copy the books to a local directory on your
computer and point the script at that directory with -b. This can be done over
the wifi, so you don't need to mess around with USB, and also gives you a
backup of your books on your own computer, incase Amazon ever decides to delete
them off your Kindle!

e.g (assuming USB connection).
$ mkdir kindle-logs
$ cd kindle-logs
$ fetch-logs .
$ book_stats.py .

B000FC1PJI: Quicksilver: Read  1 times. Last Finished: Fri Mar 16 18:30:57 2012
 - Tue Feb 21 11:06:24 2012 => Fri Mar 16 18:30:57 2012. Reading time 19 hours, 29 mins (p9 => p914)

...

Read 51 books in total. 9 days, 2 hours, 29 mins of reading time

Alternatively (if you've copied the books locally):
$ book_stats.py -b /path/to/books .
Something went wrong with that request. Please try again.