coherence.extern (package)

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]

coherence.extern.db_row (module)

get_rows(cursor, sql)[source]

Return a list of ResultRow objects from an SQL query.

getdict(results, description)[source]

Return the list of DBRows in results with a given description.

class DBRow(row, fields)[source]

Bases: object

A single row in a result set.

Each DBRow has a dictionary-style and list-style interface.

Called by ResultSet function. Don’t call directly

__init__(row, fields)[source]

Called by ResultSet function. Don’t call directly

set_extra_attr(attr, value)[source]
keys()[source]

Return the field names

keymappings()[source]

Return a dictionary of the keys and their indices in the row

has_key(key)[source]

Return whether the given key is valid

as_dict()[source]

coherence.extern.louie (module)

Wrapper module for the louie implementation

class Any[source]

Bases: object

class All[source]

Bases: object

class Anonymous[source]

Bases: object

class Dummy[source]

Bases: object

class GlobalDispatcher[source]

Bases: coherence.dispatcher.Dispatcher

connect(signal, callback, *args, **kw)[source]
_get_receivers(signal)[source]
_merge_results_and_receivers(result, receivers)
deferred_emit(signal, *args, **kwargs)
disconnect(receiver)
emit(signal, *args, **kwargs)
save_emit(signal, *args, **kwargs)
reset()[source]

Reset the state of Louie.

Useful during unit testing. Should be avoided otherwise.

connect(receiver, signal=<class 'coherence.extern.louie.All'>, sender=<class 'coherence.extern.louie.Any'>, weak=True)[source]
disconnect(receiver, signal=<class 'coherence.extern.louie.All'>, sender=<class 'coherence.extern.louie.Any'>, weak=True)[source]
send(signal=<class 'coherence.extern.louie.All'>, sender=<class 'coherence.extern.louie.Anonymous'>, *arguments, **named)[source]
send_minimal(signal=<class 'coherence.extern.louie.All'>, sender=<class 'coherence.extern.louie.Anonymous'>, *arguments, **named)[source]
send_exact(signal=<class 'coherence.extern.louie.All'>, sender=<class 'coherence.extern.louie.Anonymous'>, *arguments, **named)[source]
send_robust(signal=<class 'coherence.extern.louie.All'>, sender=<class 'coherence.extern.louie.Anonymous'>, *arguments, **named)[source]

coherence.extern.simple_plugin (module)

real simple plugin system meant as a replacement when setuptools/pkg_resources are not available

class Plugin[source]

Bases: object

a new style class that betrays all its sub-classes

class Reception(plugin_path=None, log=None)[source]

Bases: object

singleton class which holds information about known plugins

currently a singleton, and even a class, seems to be overkill for this, but maybe we’ll add some more functionality later

initializes the class and checks in if a path is provided

_instance_ = None
__init__(plugin_path=None, log=None)[source]

initializes the class and checks in if a path is provided

checkin(plugin_path)[source]

import all valid files from plugin_path

guestlist(plugin_class=<class 'coherence.extern.simple_plugin.Plugin'>)[source]

returns a list of all Plugin subclasses

coherence.extern.xdg (module)

xdg_content()[source]