More Cover Art

I’ve updated Booko to now check multiple sites for cover art.  All the sites I use for data will return “No Image” style images for books which they don’t have covers for.

Such as this:

There’s no way to tell from the URL of the image if it’s one of these pretend covers, so I had to be a bit more clever about it. Since the image itself is always the same, I calculate the md5 sum of the image – if it matches a known “No Image” image, I move on to the next site.

Given an image URL, I calculate the md5 sum like this:

digest = Digest::MD5.hexdigest(open(url).read)

Which downloads the image and calculates the hash in one nice easy step.  So, from now on, Books will be far more likely to have correct cover art images.