coherence.extern.covers_by_amazon (module) — Cohen3 0.8.0 documentation

# 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)

  Bases: `object`

  `_instance_` = None
  `queue` = []
  `workers` = []
  `max_workers` = 1
  `queue_run`()
  `remove_from_workers`(result, d)

class `CoverGetter`(filename, aws_key, callback=None, not_found_callback=None, locale=None, image_size='large', title=None, artist=None, asin=None)

  Bases: `object`

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

  Note

  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).

  Parameters: | filename (str) – where to save a received image if None the image will be passed to the callback. aws_key (str) – The aws key callback (object) – 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 (object) – 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 (str) – which Amazon Webservice Server to use, defaults to .com. image_size (str) – request the cover as large|medium|small image resolution seems to be in pixels for large: 500x500, medium: 160x160 and small: 75x75. title (str) – the album title artist (str) – the artists name asin (str) – the Amazon Store Identification Number

  `__init__`(filename, aws_key, callback=None, not_found_callback=None, locale=None, image_size='large', title=None, artist=None, asin=None)

    Parameters: | filename (str) – where to save a received image if None the image will be passed to the callback. aws_key (str) – The aws key callback (object) – 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 (object) – 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 (str) – which Amazon Webservice Server to use, defaults to .com. image_size (str) – request the cover as large|medium|small image resolution seems to be in pixels for large: 500x500, medium: 160x160 and small: 75x75. title (str) – the album title artist (str) – the artists name asin (str) – the Amazon Store Identification Number

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