coherence.extern.covers_by_amazon (module)

Covers by Amazon

methods to retrieve covers/album art via the Amazon E-Commerce WebService v4 http://docs.amazonwebservices.com/AWSECommerceService/2007-04-04/DG/

The licence agreement says something about only one request per second, so we need to serialize and delay the calls a bit.

The AWSAccessKeyId supplied is _ONLY_ for the use in conjunction with Coherence, http://coherence.beebits.net

If you use this library in your own software please apply for your own key @ http://www.amazon.com/webservices and follow the rules of their license.

Especially you must add the following disclaimer in a place that is reasonably viewable by the user of your application:

PLEASE KEEP IN MIND THAT SOME OF THE CONTENT THAT WE MAKE AVAILABLE TO YOU THROUGH THIS APPLICATION COMES FROM AMAZON WEB SERVICES. ALL SUCH CONTENT IS PROVIDED TO YOU “AS IS.” THIS CONTENT AND YOUR USE OF IT ARE SUBJECT TO CHANGE AND/OR REMOVAL AT ANY TIME.

Furthermore if you save any of the cover images you have to take care that they are stored no longer than a maximum of one month and requested then from Amazon again.

class WorkQueue(method, *args, **kwargs)[source]

Bases: object

_instance_ = None
queue = []
workers = []
max_workers = 1
queue_run()[source]
remove_from_workers(result, d)[source]
class CoverGetter(filename, aws_key, callback=None, not_found_callback=None, locale=None, image_size='large', title=None, artist=None, asin=None)[source]

Bases: object

retrieve a cover image for a given ASIN,
a TITLE or an ARTIST/TITLE combo

parameters are:

filename: where to save a received image
if NONE the image will be passed to the callback
callback: a method to call with the filename

or the image as a parameter after the image request and save was successful can be: - only a callable - a tuple with a callable,

  • optional an argument or a tuple of arguments
  • optional a dict with keyword arguments
not_found_callback: a method to call when the search at Amazon failed

can be: - only a callable - a tuple with a callable,

  • optional an argument or a tuple of arguments
  • optional a dict with keyword arguments

locale: which Amazon Webservice Server to use, defaults to .com image_size: request the cover as large|medium|small image

resolution seems to be in pixels for large: 500x500, medium: 160x160 and small: 75x75

asin: the Amazon Store Identification Number artist: the artists name title: the album title

if the filename extension and the received image extension differ, the image is converted with PIL to the desired format http://www.pythonware.com/products/pil/index.htm

send_request(url, *args, **kwargs)[source]
got_image(result, convert_from='', convert_to='')[source]
got_response(result)[source]
got_error(failure, url)[source]