[Koha-devel] Amazon Cover Images
Frédéric Demians
frederic at tamil.fr
Tue Feb 5 07:39:14 CET 2013
> The enhancement I want to see is allowing a mix of sources. It's on
> bugzilla but I can't remember the number.
> http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7187
My thoughts on designing such a system:
- On a Koha community server (or cluster of servers, or Koha library
server), a repository of cached book covers URLs is maintained. It
associates a book/resource cover per covers provider with resource ID
(ISBN/EAN).
Covers providers could be: Amazon (aws), Google Books (gb), Open
Library (ol), Koha (kws), etc.
- On Koha pages, a JavaScript function grabs resource ID and send a
request to the central server (kws) asking for ID cover URLS:
http://kws.koha-community.org/cover/src=aws,gb,kws,ol&\
isbn=a,b,c,d&icallback=myjscallback
src: ordered list of targeted cover providers.
isbn: list of ISBN (EAD?)
callback: JS function to call back with ID URL
- kws server receive the request. Find directly URLs in its cache, send
them immediately to JS call back function. Not already cached URL are
searched in parallel, and send back if found. kws returns a JSON that
looks like that:
{
"0596000278":{
"id":"0596000278",
"cover":"http://books.google.com/books?id=ezqe....",
},
"ISBN0765304368":{
"id":"ISBN0765304368",
"cover":"http://amazon.fr/thumnail/xx.jpg",
},
}
A mechanism marks as failed, URLs not found from a provider at a time,
in order not to fetch them again and again. But periodically, a batch
task can retry fetching those URLs.
- On Koha pages, the JS call back function receive the result, get cover
for each ID, and modify HTML DOM accordingly.
More information about the Koha-devel
mailing list