technology from back to front

Automagic Phone-to-Kindle with Calibre

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:

  • Retrieve and reprocess page: if it’s an HTML page, we need to download all the images and CSS and rewrite the outputted page to point to local copies of the image as we can only convert things we have a local copy of. PDFs we just save a copy of.
  • Run the page through Calibre to get a Mobipocket file (the standard format accepted by Kindles). Amazon will do their own conversion, but it strips out images and there’s in general much less choice and you’re usually better off doing it yourself. OTOH, Calibre is a bit picky, and sometimes it’ll fail (it’s particularly not fond of the New York Times for some reason), in which case we have a second go at the page, but this time passing it through the Skweezer mobile transcoder to get something a bit more friendly beforehand

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.

by
Tom Parker
on
29/06/11
  1. Hi! I would suggest instapaper.com, it simple and robust, and have nice integration via email or web api.

  2. Mikl: I tried out Instapaper, but I didn’t like it in various ways. For one, it wants to dump a whole collection of articles into a single unclearly named “book” (called “Instapaper” and a date). Secondly IIRC, it didn’t handle images very well. This way I’ve got more options about the conversion.

  3. Automagic Phone-to-Kindle with Calibre | Kindle Accessories Review
    on 28/08/11 at 10:34 am

    [...] Automagic Phone-to-Kindle with Calibre [...]

 
 


× five = 20

2000-14 LShift Ltd, 1st Floor, Hoxton Point, 6 Rufus Street, London, N1 6PE, UK+44 (0)20 7729 7060   Contact us