Automagic Phone-to-Kindle with Calibre

29 Jun 2011


Originally posted at

I’ve recently acquired a Kindle, and although it’s major use-case is for reading books, it’s also pretty good for reading long articles. This is particularly useful when I find out about said article via my phone (e.g. on Twitter) as my phone isn’t exactly good for reading anything really big. I started using the Send To Kindle app, but as it turns out that it does exactly what the name might suggest is actually a bad thing! The app attempts to do everything on it’s own, and as Amazon need to be sent an entire document to get stuff onto a Kindle, my phone gets tied up for multiple minutes in some cases, and that’s in the good case when I’ve got lots of bandwidth…

What would be a slightly more sensible option is just being able to send the URL of the article to Amazon, but as that isn’t an option, we need an intermediary, something else willing to do all the hard work of grabbing a page and sending it off for me.

To do the first step i.e. getting the URL off my phone I’m using the Phone 2 Chrome application. It’s original intended purpose is as a counterpart to the “Chrome To Phone” app (which some of you may know as one of the Android Cloud to Device Messaging Framework example apps) in that it’s capable of sending links from a phone to a browser. However, as browsers aren’t setup for that sort of message, Phone 2 Chrome cheats a bit by instead creating a JSON file in your Dropbox account and using that to sync a phone and a browser with an extension installed. This has several major advantages: it’s asynchronous but reliable over the longer term, which given I just want the articles “at some point in the future” is good, and the app returns pretty much immediately after starting to share a link and does all of it’s other work in the background which is very nice when I want to get back to doing other things with my phone rather than staring at a progress indicator for the link sharing. We’re just going to use the Android app, not the browser extension, and then do our own thing with the shared links.

Ok, so we’ve got the link in a JSON file. Now, we need a random always-on machine to be the server, and connect this up to your Dropbox account. You’ll then need to setup a copy of my convertor code (there’s a README in there that says what to do). This will sit there and keep an eye on your JSON file using pyinotify (a wrapper around the inotify file change notification system in Linux) and reprocess it every time, keeping track of which URLs have been already done using another JSON file.

Conversion goes in two steps:

Converted files are then mailed to your Kindle’s address (which you should have set during the converter program setup stage). Remember that if you’ve got the 3G Kindle, you might get charged some fees for this as they’re “Personal Documents”, but otherwise enjoy! Oh, and if you’ve got random other articles you want to send to your Kindle, try running the converter with the URLs you want to send as arguments and it’ll convert them in the same way.

Previously: Don’t use IEnumerable for table references in C# Next: The real world behind Glee