coherence.backends.ampache_storage (module)

sha256(s)[source]
md5(s)[source]
class ProxySong(uri)[source]

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)[source]

Bases: coherence.backend.BackendItem

logCategory = 'ampache_store'
get_path = None
add_child(child)[source]
get_children(start=0, end=0)[source]

called by the CDS and the MediaServer web should return

  • a list of its childs[start:end]
  • or a Deferred

if end == 0, the request is for all childs after start - childs[start:]

get_child_count()[source]

called by the CDS should return

  • the number of its childs - len(childs)
  • or a Deferred
get_item()[source]

called by the CDS and the MediaServer web should return

  • an UPnP ContentDirectoryServer DIDLLite object
  • or a Deferred
get_name()[source]

called by the MediaServer web should return

  • the name of the item, it is always expected to be in unicode
get_id()[source]
class Playlist(store, element)[source]

Bases: coherence.backend.BackendItem

logCategory = 'ampache_store'
get_path = None
get_children(start=0, end=0)[source]

called by the CDS and the MediaServer web should return

  • a list of its childs[start:end]
  • or a Deferred

if end == 0, the request is for all childs after start - childs[start:]

get_child_count()[source]

called by the CDS should return

  • the number of its childs - len(childs)
  • or a Deferred
get_item(parent_id=104)[source]

called by the CDS and the MediaServer web should return

  • an UPnP ContentDirectoryServer DIDLLite object
  • or a Deferred
get_id()[source]
get_name()[source]

called by the MediaServer web should return

  • the name of the item, it is always expected to be in unicode
get_cover()[source]

called by the MediaServer web should return

  • the filepath where to find the album art file

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

class Album(store, element)[source]

Bases: coherence.backend.BackendItem

logCategory = 'ampache_store'
get_path = None
get_children(start=0, end=0)[source]

called by the CDS and the MediaServer web should return

  • a list of its childs[start:end]
  • or a Deferred

if end == 0, the request is for all childs after start - childs[start:]

get_child_count()[source]

called by the CDS should return

  • the number of its childs - len(childs)
  • or a Deferred
get_item(parent_id=103)[source]

called by the CDS and the MediaServer web should return

  • an UPnP ContentDirectoryServer DIDLLite object
  • or a Deferred
get_id()[source]
get_name()[source]

called by the MediaServer web should return

  • the name of the item, it is always expected to be in unicode
get_cover()[source]

called by the MediaServer web should return

  • the filepath where to find the album art file

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

class Artist(store, element)[source]

Bases: coherence.backend.BackendItem

logCategory = 'ampache_store'
get_path = None
get_children(start=0, end=0)[source]

called by the CDS and the MediaServer web should return

  • a list of its childs[start:end]
  • or a Deferred

if end == 0, the request is for all childs after start - childs[start:]

get_child_count()[source]

called by the CDS should return

  • the number of its childs - len(childs)
  • or a Deferred
get_item(parent_id=102)[source]

called by the CDS and the MediaServer web should return

  • an UPnP ContentDirectoryServer DIDLLite object
  • or a Deferred
get_id()[source]
get_name()[source]

called by the MediaServer web should return

  • the name of the item, it is always expected to be in unicode
class Genre(store, element)[source]

Bases: coherence.backend.BackendItem

logCategory = 'ampache_store'
get_path = None
get_children(start=0, end=0)[source]

called by the CDS and the MediaServer web should return

  • a list of its childs[start:end]
  • or a Deferred

if end == 0, the request is for all childs after start - childs[start:]

get_child_count()[source]

called by the CDS should return

  • the number of its childs - len(childs)
  • or a Deferred
get_item(parent_id=105)[source]

called by the CDS and the MediaServer web should return

  • an UPnP ContentDirectoryServer DIDLLite object
  • or a Deferred
get_id()[source]
get_name()[source]

called by the MediaServer web should return

  • the name of the item, it is always expected to be in unicode
class Tag(store, element)[source]

Bases: coherence.backend.BackendItem

logCategory = 'ampache_store'
get_path = None
get_children(start=0, end=0)[source]

called by the CDS and the MediaServer web should return

  • a list of its childs[start:end]
  • or a Deferred

if end == 0, the request is for all childs after start - childs[start:]

get_child_count()[source]

called by the CDS should return

  • the number of its childs - len(childs)
  • or a Deferred
get_item(parent_id=106)[source]

called by the CDS and the MediaServer web should return

  • an UPnP ContentDirectoryServer DIDLLite object
  • or a Deferred
get_id()[source]
get_name()[source]

called by the MediaServer web should return

  • the name of the item, it is always expected to be in unicode
class Track(store, element)[source]

Bases: coherence.backend.BackendItem

logCategory = 'ampache_store'
get_children(start=0, request_count=0)[source]

called by the CDS and the MediaServer web should return

  • a list of its childs[start:end]
  • or a Deferred

if end == 0, the request is for all childs after start - childs[start:]

get_child_count()[source]

called by the CDS should return

  • the number of its childs - len(childs)
  • or a Deferred
get_item(parent_id=None)[source]

called by the CDS and the MediaServer web should return

  • an UPnP ContentDirectoryServer DIDLLite object
  • or a Deferred
get_id()[source]
get_name()[source]

called by the MediaServer web should return

  • the name of the item, it is always expected to be in unicode
get_url()[source]
get_path()[source]

called by the MediaServer web should return

  • the filepath where to find the media file that this item does refer to
class Video(store, element)[source]

Bases: coherence.backend.BackendItem

logCategory = 'ampache_store'
get_children(start=0, request_count=0)[source]

called by the CDS and the MediaServer web should return

  • a list of its childs[start:end]
  • or a Deferred

if end == 0, the request is for all childs after start - childs[start:]

get_child_count()[source]

called by the CDS should return

  • the number of its childs - len(childs)
  • or a Deferred
get_item(parent_id=200)[source]

called by the CDS and the MediaServer web should return

  • an UPnP ContentDirectoryServer DIDLLite object
  • or a Deferred
get_id()[source]
get_name()[source]

called by the MediaServer web should return

  • the name of the item, it is always expected to be in unicode
get_url()[source]
get_path()[source]

called by the MediaServer web should return

  • the filepath where to find the media file that this item does refer to
class AmpacheStore(server, **kwargs)[source]

Bases: coherence.backend.BackendStore

this is a backend to the Ampache Media DB

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

called by the CDS or the MediaServer web

id is the id property of our DIDLLite item

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

should return

  • None when no matching item for that id is found,
  • a BackendItem,
  • or a Deferred
got_auth_response(response, renegotiate=False)[source]
got_auth_error(e, renegotiate=False)[source]
get_token(renegotiate=False)[source]

ask Ampache for the authorization token

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

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)[source]