View Single Post
Old 02-20-2011, 08:24 PM   #4
kiwidude
calibre/Sigil Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,230
Karma: 1345754
Join Date: Oct 2010
Location: London, UK
Device: Kindle Paperwhite 3G, iPad 3, iPad Air
Quote:
Originally Posted by tlindgren View Post
The error message it gives are: ERROR: Bad cover: The cover is not a valid picture
Example ISBN: 9780345379092
I've seen this situation before but I was not sure how prevalent it is.

The issue is the Goodreads website having missing images with broken links. For the "correct" pages for books with no cover they have a slightly different div structure and link to a "blank cover" type of image - that situation I can detect and handle fine.

However for other books such as that ISBN you sent me they basically have a broken link. There is no difference I could see from the web page itself when scraping as to whether the image linked to exists or not. I had hoped that this was a "rare enough" situation to not try to bother with at least until Kovid had made changes to the API but perhaps that is not the case.

Right now the way the API works is that a plugin is just responsible for returning a URL to an image. Later code in Calibre then takes responsibility for downloading the image, it assumes the link is a valid one and hence the "bad picture" message you get when it tries to convert the output into an image such as you get when parsing this image url from that ISBN above in Goodreads:
http://photo.goodreads.com/books/1173213624l/258872.jpg

My point being that the only thing I could do would be in the plugin to attempt to download the cover myself. I don't know if the response header would give me an error code to save me downloading the content, I'll look into that. Why I didn't do this previously was that it means an additional web call which will slow the downloads down further, and worst case for valid images it means they get downloaded twice (as I have no way of passing the image to the Calibre code, just the link to it).

I didn't realise that Goodreads returning a "dud" link would prevent other plugins from returning valid ones. That does make it more of a priority to look into.
kiwidude is offline   Reply With Quote