coherence.backends.ampache_storage (module) — Cohen3 0.8.0 documentation

# coherence.backends.ampache_storage (module)

`sha256`(s)

`md5`(s)

class `ProxySong`(uri)

  Bases: `coherence.upnp.core.utils.ReverseProxyResource`

class `Container`(id, parent_id, name, store=None, children_callback=None, container_class=<class 'coherence.upnp.core.DIDLLite.Container'>, play_container=False)

  Bases: `coherence.backend.BackendItem`

  `logCategory` = 'ampache_store'
  `get_path` = None
  `add_child`(child)
  `get_children`(start=0, end=0)

    Called by the CDS and the MediaServer web.

    Parameters: | start (int) – the start. end (int) – the end.
    Returns: | a list of its childs, from start to end. or a Deferred

  `get_child_count`()

    Called by the CDS.

    Returns: | the number of its childs - len(childs) or a Deferred

  `get_item`()

    Called by the CDS and the MediaServer web.

    Returns: | an UPnP ContentDirectoryServer DIDLLite object or a Deferred

  `get_name`()

    Called by the MediaServer web.

    Returns: | the name of the item, it is always expected to be in unicode.

  `get_id`()

class `Playlist`(store, element)

  Bases: `coherence.backend.BackendItem`

  `logCategory` = 'ampache_store'
  `get_path` = None
  `get_children`(start=0, end=0)

    Called by the CDS and the MediaServer web.

    Parameters: | start (int) – the start. end (int) – the end.
    Returns: | a list of its childs, from start to end. or a Deferred

  `get_child_count`()

    Called by the CDS.

    Returns: | the number of its childs - len(childs) or a Deferred

  `get_item`(parent_id=104)

    Called by the CDS and the MediaServer web.

    Returns: | an UPnP ContentDirectoryServer DIDLLite object or a Deferred

  `get_id`()
  `get_name`()

    Called by the MediaServer web.

    Returns: | the name of the item, it is always expected to be in unicode.

  `get_cover`()

    Called by the MediaServer web.

    Returns: | the filepath where to find the album art file

    Note

    only needed when we have created for that item an albumArtURI property that does point back to us.

class `Album`(store, element)

  Bases: `coherence.backend.BackendItem`

  `logCategory` = 'ampache_store'
  `get_path` = None
  `get_children`(start=0, end=0)

    Called by the CDS and the MediaServer web.

    Parameters: | start (int) – the start. end (int) – the end.
    Returns: | a list of its childs, from start to end. or a Deferred

  `get_child_count`()

    Called by the CDS.

    Returns: | the number of its childs - len(childs) or a Deferred

  `get_item`(parent_id=103)

    Called by the CDS and the MediaServer web.

    Returns: | an UPnP ContentDirectoryServer DIDLLite object or a Deferred

  `get_id`()
  `get_name`()

    Called by the MediaServer web.

    Returns: | the name of the item, it is always expected to be in unicode.

  `get_cover`()

    Called by the MediaServer web.

    Returns: | the filepath where to find the album art file

    Note

    only needed when we have created for that item an albumArtURI property that does point back to us.

class `Artist`(store, element)

  Bases: `coherence.backend.BackendItem`

  `logCategory` = 'ampache_store'
  `get_path` = None
  `get_children`(start=0, end=0)

    Called by the CDS and the MediaServer web.

    Parameters: | start (int) – the start. end (int) – the end.
    Returns: | a list of its childs, from start to end. or a Deferred

  `get_child_count`()

    Called by the CDS.

    Returns: | the number of its childs - len(childs) or a Deferred

  `get_item`(parent_id=102)

    Called by the CDS and the MediaServer web.

    Returns: | an UPnP ContentDirectoryServer DIDLLite object or a Deferred

  `get_id`()
  `get_name`()

    Called by the MediaServer web.

    Returns: | the name of the item, it is always expected to be in unicode.

class `Genre`(store, element)

  Bases: `coherence.backend.BackendItem`

  `logCategory` = 'ampache_store'
  `get_path` = None
  `get_children`(start=0, end=0)

    Called by the CDS and the MediaServer web.

    Parameters: | start (int) – the start. end (int) – the end.
    Returns: | a list of its childs, from start to end. or a Deferred

  `get_child_count`()

    Called by the CDS.

    Returns: | the number of its childs - len(childs) or a Deferred

  `get_item`(parent_id=105)

    Called by the CDS and the MediaServer web.

    Returns: | an UPnP ContentDirectoryServer DIDLLite object or a Deferred

  `get_id`()
  `get_name`()

    Called by the MediaServer web.

    Returns: | the name of the item, it is always expected to be in unicode.

class `Tag`(store, element)

  Bases: `coherence.backend.BackendItem`

  `logCategory` = 'ampache_store'
  `get_path` = None
  `get_children`(start=0, end=0)

    Called by the CDS and the MediaServer web.

    Parameters: | start (int) – the start. end (int) – the end.
    Returns: | a list of its childs, from start to end. or a Deferred

  `get_child_count`()

    Called by the CDS.

    Returns: | the number of its childs - len(childs) or a Deferred

  `get_item`(parent_id=106)

    Called by the CDS and the MediaServer web.

    Returns: | an UPnP ContentDirectoryServer DIDLLite object or a Deferred

  `get_id`()
  `get_name`()

    Called by the MediaServer web.

    Returns: | the name of the item, it is always expected to be in unicode.

class `Track`(store, element)

  Bases: `coherence.backend.BackendItem`

  `logCategory` = 'ampache_store'
  `get_children`(start=0, request_count=0)

    Called by the CDS and the MediaServer web.

    Parameters: | start (int) – the start. end (int) – the end.
    Returns: | a list of its childs, from start to end. or a Deferred

  `get_child_count`()

    Called by the CDS.

    Returns: | the number of its childs - len(childs) or a Deferred

  `get_item`(parent_id=None)

    Called by the CDS and the MediaServer web.

    Returns: | an UPnP ContentDirectoryServer DIDLLite object or a Deferred

  `get_id`()
  `get_name`()

    Called by the MediaServer web.

    Returns: | the name of the item, it is always expected to be in unicode.

  `get_url`()
  `get_path`()

    Called by the MediaServer web.

    Returns: | the filepath where to find the media file that this item does refer to.

class `Video`(store, element)

  Bases: `coherence.backend.BackendItem`

  `logCategory` = 'ampache_store'
  `get_children`(start=0, request_count=0)

    Called by the CDS and the MediaServer web.

    Parameters: | start (int) – the start. end (int) – the end.
    Returns: | a list of its childs, from start to end. or a Deferred

  `get_child_count`()

    Called by the CDS.

    Returns: | the number of its childs - len(childs) or a Deferred

  `get_item`(parent_id=200)

    Called by the CDS and the MediaServer web.

    Returns: | an UPnP ContentDirectoryServer DIDLLite object or a Deferred

  `get_id`()
  `get_name`()

    Called by the MediaServer web.

    Returns: | the name of the item, it is always expected to be in unicode.

  `get_url`()
  `get_path`()

    Called by the MediaServer web.

    Returns: | the filepath where to find the media file that this item does refer to.

class `AmpacheStore`(server, **kwargs)

  Bases: `coherence.backend.BackendStore`

  This is a backend to the Ampache Media DB

  Changed in version 0.9.0: Migrated from louie/dispatcher to EventDispatcher

  `implements` = ['MediaServer']
  `logCategory` = 'ampache_store'
  `get_by_id`(id)

    Parameters: | id (object) – is the id property of our DIDLLite item
    Returns: | None when no matching item for that id is found, a BackendItem, or a Deferred

    Called by the CDS or the MediaServer web.

    Note

    if this MediaServer implements containers that can share their content, like ‘all tracks’, ‘album’ and ‘album_of_artist’ (they all have the same track item as content), then the id may be passed by the CDS like this:

    > ‘id@container’ or ‘id@container@container@container…’

    therefore a

        if isinstance(id, basestring):
            id = id.split('@',1)
            id = id[0]

    may be appropriate as the first thing to do when entering this method.

  `got_auth_response`(response, renegotiate=False)
  `got_auth_error`(e, renegotiate=False)
  `get_token`(renegotiate=False)

    Ask Ampache for the authorization token

  `got_error`(e)
  `got_response`(response, query_item, request)
  `ampache_query`(item, start=0, request_count=0, filter=None)
  `ampache_query_songs`(start=0, request_count=0)
  `ampache_query_albums`(start=0, request_count=0)
  `ampache_query_artists`(start=0, request_count=0)
  `ampache_query_playlists`(start=0, request_count=0)
  `ampache_query_genres`(start=0, request_count=0)
  `ampache_query_tags`(start=0, request_count=0)
  `ampache_query_videos`(start=0, request_count=0)
  `upnp_init`()

    This method gets called after the device is fired, here all initializations of service related state variables should happen, as the services aren’t available before that point.

  `upnp_XBrowse`(*args, **kwargs)