coherence.backend (module) — Cohen3 0.8.0 documentation

# coherence.backend (module)

## Backend

A set of base classes related with backends.

### `Backend`

The base class for all backends.

### `BackendStore`

The base class for all MediaServer backend stores.

### `AbstractBackendStore`

Inherits from `BackendStore` and extends his capabilities.

### `BackendItem`

The base class for all MediaServer backend items.

### `Container`

The base class for all containers. Actually his base class is the BackendItem with a few modifications which extends his capabilities to store backend items.

### `LazyContainer`

Inherits from `Container` and extends his capabilities.

### `BackendRssMixin`

A base class intended to be implemented into a subclass which creates a deferred chain to retrieve a RDF file, parse it, extract the metadata and reschedule itself.

Note

RDF (Resource Description Framework) is a family of World Wide Web Consortium specifications originally designed as a metadata data model.

See also

RDF extended information at wikipedia: https://en.wikipedia.org/wiki/Resource_Description_Framework

class `Backend`(server, *args, **kwargs)

  Bases: `eventdispatcher.eventdispatcher.EventDispatcher`, `coherence.log.LogAble`, `coherence.extern.simple_plugin.Plugin`

  In the `Backend` class we initialize the very basic stuff needed to create a Backend and registers some basic events needed to be successfully detected by our server.

  The init method for a backend, should probably most of the time be overwritten when the init is done and send a signal to its device. We can send this signal via two methods, depending on the nature of our backend. For instance, if we want that the backend to be notified without fetching any data we could simply set the attribute `init_completed` equal to True at the end of our init method of the backend, but in some cases, we will want to send this signal after some deferred call returns a result…in that case we should process slightly differently, you can see how to do that at the end of the init method of the class `BackendBaseStore`.

  After that, the device will then setup, announce itself and should call to the backend’s method `upnp_init()`.

  Changed in version 0.9.0:

  - Introduced inheritance from EventDispatcher

  - The emitted events changed:

    > - Coherence.UPnP.Backend.init_completed => backend_init_completed

  - Added new event: backend_init_failed

  - Added new method `on_init_failed()`

  - Moved class method init_completed to on_init_completed and added class variable `init_completed`

  Note

  We can also use this init class to do whatever is necessary with the stuff we can extract from the config dict, connect maybe to an external data-source and start up the backend or if there are any UPnP service actions (Like maybe upnp_Browse for the CDS Browse action), that can’t be handled by the service classes itself, or need some special adjustments for the backend, they probably will need to be defined into the method `__init__()`.

  Parameters: | server (object) – This usually should be an instance of our main class `Coherence` (the UPnP device that’s hosting our backend). *args (list) – A list with extra arguments for the backend. This, must be implemented into the subclass (if needed). **kwargs (dict) – An unpacked dictionary with the backend’s configuration.

  `logCategory` = 'backend'
  `implements` = []

    [‘MediaServer’,’MediaRenderer’]

    Type: | A list of the device classe like

  `init_completed`

    To know whenever the backend init has completed. This has to be done in the actual backend, maybe it has to wait for an answer from an external data-source first…so…the backend should set this variable to True, then the method `on_init_completed()` will be automatically triggered dispatching an event announcing that the backend has been initialized.

  `__init__`(server, *args, **kwargs)

    Parameters: | server (object) – This usually should be an instance of our main class `Coherence` (the UPnP device that’s hosting our backend). *args (list) – A list with extra arguments for the backend. This, must be implemented into the subclass (if needed). **kwargs (dict) – An unpacked dictionary with the backend’s configuration.

  `on_init_completed`(*args, **kwargs)

    Inform Coherence that this backend is ready for announcement. This method just accepts any form of arguments as we don’t under which circumstances it is called.

  `on_init_failed`(*args, **kwargs)

    Inform Coherence that this backend has failed.

    New in version 0.9.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.

class `BackendStore`(server, *args, **kwargs)

  Bases: `coherence.backend.Backend`

  The base class for all MediaServer backend stores. Inherits from class `Backend` and extends his capabilities to make easy to create a Backend Store by setting an initial wmc mapping, and defining some attributes and methods needed by a Backend Store.

  Parameters: | server (object) – This usually should be an instance of our main class `Coherence` (the UPnP device that’s hosting our backend). *args (list) – A list with extra arguments for the backend. This, must be implemented into the subclass (if needed). **kwargs (dict) – An unpacked dictionary with the backend’s configuration.

  Note

  In case we want so serve something via the MediaServer web backend, the class `BackendItem` should pass an URI assembled of urlbase + ‘/’ + id to the `Resource`.

  Warning

  Remember to sent the event init_completed via setting to True the attribute `init_completed`. Check the base class `Backend` for instructions about how to do it.

  `logCategory` = 'backend_store'
  `__init__`(server, *args, **kwargs)

    Parameters: | server (object) – This usually should be an instance of our main class `Coherence` (the UPnP device that’s hosting our backend). *args (list) – A list with extra arguments for the backend. This, must be implemented into the subclass (if needed). **kwargs (dict) – An unpacked dictionary with the backend’s configuration.

    Note

    In case we want so serve something via the MediaServer web backend, the class `BackendItem` should pass an URI assembled of urlbase + ‘/’ + id to the `Resource`.

    Warning

    Remember to sent the event init_completed via setting to True the attribute `init_completed`. Check the base class `Backend` for instructions about how to do it.

  `release`()

    If anything needs to be cleaned up upon shutdown of this backend, this is the place for it. Should be overwritten in subclass.

  `_get_all_items`(id)

    A helper method to get all items as a response to some XBox 360 UPnP Search action probably never be used as the backend will overwrite the wmc_mapping with more appropriate methods.

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

class `BackendItem`(*args, **kwargs)

  Bases: `eventdispatcher.eventdispatcher.EventDispatcher`, `coherence.log.LogAble`

  This is the base class for all MediaServer backend items.

  Most of the time we collect the necessary data for an UPnP ContentDirectoryService Container or Object and instantiate it into the `__init__()`

      self.item = DIDLLite.Container(id,parent_id,name,...)

  or

      self.item = DIDLLite.MusicTrack(id,parent_id,name,...)

  To make that a valid UPnP CDS Object it needs one or more DIDLLite. `Resource`

      self.item.res = []
      res = DIDLLite.Resource(url, f'http-get:*:{mimetype}:*')
      res.size = size
      self.item.res.append(res)

  Note

  url should be the urlbase of our backend + ‘/’ + our id.

  Changed in version 0.9.0:

  - Introduced inheritance from EventDispatcher

  - Moved class variable `update_id` to class `Container.update_id`

  - Added class variable `mimetype` to benefit from the EventDispatcher’s properties

  `logCategory` = 'backend_item'
  `name` = 'backend_item_name'

    the basename of a file, the album title, the artists name…is expected to be unicode

  `location` = None

    the filepath of our media file, or alternatively a FilePath or a ReverseProxyResource object

  `cover` = None

    if we have some album art image, let’s put the filepath or link into here

  `store` = None

    The backend store.

  `storage_id` = None

    The id of the backend store.

  `item` = None

    Usually an atomic object from `Item` or derived.

  `mimetype`

    The mimetype variable describes the protocol info for the object.

  `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_path`()

    Called by the MediaServer web.

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

  `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 `BackendRssMixin`

  Bases: `object`

  `update_data`(rss_url, container=None)

    Creates a deferred chain to retrieve the rdf file, parse and extract the metadata and reschedule itself.

  `parse_data`(xml_data, container)

    Extract media info and create BackendItems

  `queue_update`(error_or_failure, rss_url, container)

class `Container`(parent, title)

  Bases: `coherence.backend.BackendItem`

  Represents a backend item which will contains backend items inside.

  Changed in version 0.9.0:

  - Added static class variable `update_id`

  - Changed some variables to benefit from the EventDispatcher’s properties:

    > - `children`
    > - `children_ids`
    > - `children_by_external_id`
    > - `parent`

  `update_id`

    It represents the update id of thhe container. This should be incremented on every modification of the UPnP ContentDirectoryService Container, as we do in methods `add_child()` and `remove_child()`.

  `children`

    A list of the backend items.

  `children_ids`

    A dictionary of the backend items by his id.

  `children_by_external_id`

    A dictionary of the backend items by his external id.

  `parent_id` = -1

    The id of the parent object. This will be automatically set whenever we set the attribute `parent`.

  `mimetype` = 'directory'

    The mimetype variable describes the protocol info for the object. In a `Container` this should be set to value directory or root.

  `parent`

    The parent object for this class.

  `on_parent`(parent)
  `register_child`(child, external_id=None)
  `add_child`(child, external_id=None, update=True)
  `remove_child`(child, external_id=None, update=True)
  `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_path`()

    Called by the MediaServer web.

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

  `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`()
  `get_update_id`()

class `LazyContainer`(parent, title, external_id=None, refresh=0, childrenRetriever=None, **kwargs)

  Bases: `coherence.backend.Container`

  `logCategory` = 'lazyContainer'
  `replace_by`(item)
  `add_child`(child, external_id=None, update=True)
  `update_children`(new_children, old_children)
  `start_children_retrieval_campaign`()
  `end_children_retrieval_campaign`(success=True)
  `retrieve_children`(start=0, page=0)
  `retrieve_all_children`(start=0, request_count=0)
  `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

class `AbstractBackendStore`(server, **kwargs)

  Bases: `coherence.backend.BackendStore`

  `len`()
  `set_root_item`(item)
  `get_root_id`()
  `get_root_item`()
  `append_item`(item, storage_id=None)
  `remove_item`(item)
  `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.

  `getnextID`()

# coherence.base (module)

## Base

The core of the project. Holds the class `Coherence` intended to be used to manage all the resources of the project. Also contains some other classes which are vital to the project.

### `SimpleRoot`

A web resource representing a web site. Used to build the contents browser for our instance of a `WebServer` or `WebServerUi`.

### `WebServer`

A class which takes care of dealing with the web representation of the running `Coherence`’s instance. This is the default webserver used.

### `WebServerUi`

The default web server, `WebServer`, can be replaced by this class which will do the same thing as the default web server, but with a more polished interface.

### `Plugins`

Manage all the available plugins for the Cohen3 project.

### `Coherence`

The Main class of the Cohen3 project. The Coherence class controls all the servers initialization depending on the configuration passed.

class `SimpleRoot`(coherence)

  Bases: `twisted.web.resource.Resource`, `coherence.log.LogAble`

  `addSlash` = True
  `logCategory` = 'coherence'
  `getChild`(name, request)

    Retrieve a ‘child’ resource from me.

    Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

    This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

    For example, the URL /foo/bar/baz will normally be:

        | site.resource.getChild('foo').getChild('bar').getChild('baz').

    However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

    Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

  `listchilds`(uri)
  `render`(request)

    Render a given resource. See L{IResource}’s render method.

    I delegate to methods of self with the form ‘render_METHOD’ where METHOD is the HTTP that was used to make the request. Examples: render_GET, render_HEAD, render_POST, and so on. Generally you should implement those methods instead of overriding this one.

    render_METHOD methods are expected to return a byte string which will be the rendered page, unless the return value is C{server.NOT_DONE_YET}, in which case it is this class’s responsibility to write the results using C{request.write(data)} and then call C{request.finish()}.

    Old code that overrides render() directly is likewise expected to return a byte string or NOT_DONE_YET.

    @see: L{IResource.render}

class `WebServer`(ui, port, coherence)

  Bases: `coherence.log.LogAble`

  `logCategory` = 'webserver'
  `_endpoint_listen`(coherence, port)

class `WebServerUi`(port, coherence, unittests=False)

  Bases: `coherence.base.WebServer`

  `logCategory` = 'webserverui'
  `_endpoint_listen`(coherence, port)
  `_ws_endpoint_listen`(coherence)

class `Plugins`(ids=('coherence.plugins.backend.media_server', 'coherence.plugins.backend.media_renderer', 'coherence.plugins.backend.binary_light', 'coherence.plugins.backend.dimmable_light'))

  Bases: `coherence.log.LogAble`

  `logCategory` = 'plugins'
  `_valids` = ('coherence.plugins.backend.media_server', 'coherence.plugins.backend.media_renderer', 'coherence.plugins.backend.binary_light', 'coherence.plugins.backend.dimmable_light')
  `_plugins` = {}
  `get`(key, default=None)
  `set`(key, value)
  `keys`()
  `_collect_from_module`()
  `_Plugins__initialized` = False
  `_Plugins__instance` = None

class `Coherence`(config=None)

  Bases: `eventdispatcher.eventdispatcher.EventDispatcher`, `coherence.log.LogAble`

  The Main class of the Cohen3 project. The Coherence class controls all the servers initialization depending on the configuration passed. It is also capable of initialize the plugins defined in config variable or by configuration file. It supports the creation of multiple servers at once.

  Example of a simple server via plugin AppleTrailersStore:

      from coherence.base import Coherence
      from coherence.upnp.core.uuid import UUID
      from twisted.internet import reactor
      new_uuid = UUID()

      coherence = Coherence(
          {'logmode': 'info',
           'controlpoint': 'yes',
           'plugin': [{'backend': 'AppleTrailersStore',
                      'name': 'Cohen3 Example FSStore',
                      'uuid': new_uuid,
                      }
                      ]
           }
      )
      reactor.run()

  Changed in version 0.9.0:

  - Introduced inheritance from EventDispatcher

  - The emitted events changed:

    > - Coherence.UPnP.Device.detection_completed => coherence_device_detection_completed
    > - Coherence.UPnP.Device.removed => coherence_device_removed
    > - Coherence.UPnP.RootDevice.removed => coherence_root_device_removed

  - Changed some variables to benefit from the EventDispatcher’s properties:

    > - `devices`
    > - `children`
    > - `_callbacks`
    > - `active_backends`
    > - `ctrl`
    > - `dbus`
    > - `json`
    > - `msearch`
    > - `ssdp_server`
    > - `transcoder_manager`
    > - `web_server`

  `logCategory` = 'coherence'
  `devices`

    A list of the added devices.

  `children`

    A dict containing the web resources.

  `_callbacks`

    A dict containing the callbacks, used by the methods `subscribe()` and `unsubscribe()`.

  `active_backends`

    A dict containing the active backends.

  `ctrl`

    A coherence’s instance of class `ControlPoint`. This will be enabled if we request it by config dict or configuration file via keyword controlpoint = yes.

  `dbus`

    A coherence’s instance of class `DBusPontoon`. This will be enabled if we request it by config dict or configuration file via keyword use_dbus = yes.

  `json`

    A coherence’s instance of class `JsonInterface`. This will be enabled if we request it by config dict or configuration file via keyword json = yes.

  `msearch`

    A coherence’s instance of class `MSearch`. This is automatically enabled when `Coherence` is initialized

  `ssdp_server`

    A coherence’s instance of class `SSDPServer`. This is automatically enabled when `Coherence` is initialized

  `transcoder_manager`

    A coherence’s instance of class `TranscoderManager`. This will be enabled if we request itby config dict or configuration file via keyword transcoding = yes.

  `web_server`

    A coherence’s instance of class `WebServer` or `WebServerUi`. We can request our preference by config dict or configuration file. If we use the keyword web-ui = yes, then the class `WebServerUi` will be used, otherwise, the enabled web server will be of class `WebServer`.

  `clear`()

    We do need this to survive multiple calls to Coherence during trial tests

  `setup_part2`()

    Initializes the basic and optional services/devices and the enabled plugins (backends).

  `add_plugin`(plugin, **kwargs)
  `remove_plugin`(plugin)

    Removes a backend from Coherence

    Parameters: | plugin (object) – is the object return by add_plugin or an UUID string.

  static `writeable_config`()

    Do we have a new-style config file

  `store_plugin_config`(uuid, items)

    Find the backend with uuid and store in its the config the key and value pair(s).

  `receiver`(signal, *args, **kwargs)
  `shutdown`(force=False)
  `check_devices`()

    Iterate over devices and their embedded ones and renew subscriptions.

  `subscribe`(name, callback)
  `unsubscribe`(name, callback)
  `callback`(name, *args)
  `_Coherence__cls` = None
  `_Coherence__incarnations` = 0
  `_Coherence__initialized` = False
  `_Coherence__instance` = None
  `get_device_by_host`(host)
  `get_device_with_usn`(usn)
  `get_device_with_id`(device_id)
  `get_devices`()
  `get_local_devices`()
  `get_nonlocal_devices`()
  `is_device_added`(infos)

    Check if the device exists in our list of created `devices`.

    Parameters: | infos (dict) – Information about the device
    Returns: | True if the device exists in our list of `devices`, otherwise, returns False.

    New in version 0.9.0.

  `create_device`(device_type, infos)
  `add_device`(device, *args)
  `remove_device`(device_type, infos)
  `add_web_resource`(name, sub)
  `remove_web_resource`(name)
  static `check_louie`(receiver, signal, method='connect')

    Check if the connect or disconnect method’s arguments are valid in order to automatically convert to EventDispatcher’s bind The old valid signals are:

    > - Coherence.UPnP.Device.detection_completed
    > - Coherence.UPnP.RootDevice.detection_completed
    > - Coherence.UPnP.Device.removed
    > - Coherence.UPnP.RootDevice.removed

    New in version 0.9.0.

  `connect`(receiver, signal=None, sender=None, weak=True)

    Wrapper method around the deprecated method louie.connect. It will check if the passed signal is supported by executing the method `check_louie()`.

    Warning

    This will probably be removed at some point, if you use the connect method you should migrate to the new event system EventDispatcher.

    Changed in version 0.9.0: Added EventDispatcher’s compatibility for some basic signals

  `disconnect`(receiver, signal=None, sender=None, weak=True)

    Wrapper method around the deprecated method louie.disconnect. It will check if the passed signal is supported by executing the method `check_louie()`.

    Warning

    This will probably be removed at some point, if you use the disconnect method you should migrate to the new event system EventDispatcher.

    Changed in version 0.9.0: Added EventDispatcher’s compatibility for some basic signals

# coherence.dbus_constants (module)

# coherence.dbus_service (module)

## DBUS service class

Module to add dbus compatibility to Cohen3’s project.

### `DBusCDSService`

The DBus service for UPnP’s CDS (Content Directory Service)

### `DBusService`

The generic DBus service for UPnP.

### `DBusDevice`

Class representing a DBus device.

### `DBusPontoon`

Used to initialize DBus from within the class `Coherence`.

`un_namespace`(text)

class `DBusCDSService`(service, dbus_device, bus)

  Bases: `eventdispatcher.eventdispatcher.EventDispatcher`, `dbus.service.Object`, `coherence.log.LogAble`

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

  `logCategory` = 'dbus'
  `NOT_FOR_THE_TUBES` = True
  `shutdown`()
  `_release_thyself`(suicide_mode=True)
  `variable_changed`(variable)
  `get_id`()
  `get_scpd_xml`()
  `StateVariableChanged`(*args, **keywords)
  `getAvailableActions`()
  `subscribeStateVariables`()
  `GetSearchCapabilites`(dbus_async_cb, dbus_async_err_cb)
  `GetSortCapabilities`(dbus_async_cb, dbus_async_err_cb)
  `GetSortExtensionCapabilities`(dbus_async_cb, dbus_async_err_cb)
  `GetFeatureList`(dbus_async_cb, dbus_async_err_cb)
  `GetSystemUpdateID`(dbus_async_cb, dbus_async_err_cb)
  `Browse`(ObjectID, BrowseFlag, Filter, StartingIndex, RequestedCount, SortCriteria, dbus_async_cb, dbus_async_err_cb)
  `Search`(ContainerID, SearchCriteria, Filter, StartingIndex, RequestedCount, SortCriteria, dbus_async_cb, dbus_async_err_cb)
  `CreateObject`(ContainerID, Elements, dbus_async_cb, dbus_async_err_cb)
  `DestroyObject`(ObjectID, dbus_async_cb, dbus_async_err_cb)
  `UpdateObject`(ObjectID, CurrentTagValue, NewTagValue, dbus_async_cb, dbus_async_err_cb)
  `MoveObject`(ObjectID, NewParentID, dbus_async_cb, dbus_async_err_cb)
  `ImportResource`(SourceURI, DestinationURI, dbus_async_cb, dbus_async_err_cb)
  `ExportResource`(SourceURI, DestinationURI, dbus_async_cb, dbus_async_err_cb)
  `DeleteResource`(ResourceURI, dbus_async_cb, dbus_async_err_cb)
  `StopTransferResource`(TransferID, dbus_async_cb, dbus_async_err_cb)
  `GetTransferProgress`(TransferID, dbus_async_cb, dbus_async_err_cb)
  `CreateReference`(ContainerID, ObjectID, dbus_async_cb, dbus_async_err_cb)
  `callAction`(name, arguments)
  `_dbus_class_table` = {'coherence.dbus_service.DBusCDSService': {'org.DLNA.DMS.CDS': {'Browse': <function DBusCDSService.Browse>, 'CreateObject': <function DBusCDSService.CreateObject>, 'CreateReference': <function DBusCDSService.CreateReference>, 'DeleteResource': <function DBusCDSService.DeleteResource>, 'DestroyObject': <function DBusCDSService.DestroyObject>, 'ExportResource': <function DBusCDSService.ExportResource>, 'GetFeatureList': <function DBusCDSService.GetFeatureList>, 'GetSearchCapabilites': <function DBusCDSService.GetSearchCapabilites>, 'GetSortCapabilities': <function DBusCDSService.GetSortCapabilities>, 'GetSortExtensionCapabilities': <function DBusCDSService.GetSortExtensionCapabilities>, 'GetSystemUpdateID': <function DBusCDSService.GetSystemUpdateID>, 'GetTransferProgress': <function DBusCDSService.GetTransferProgress>, 'ImportResource': <function DBusCDSService.ImportResource>, 'MoveObject': <function DBusCDSService.MoveObject>, 'Search': <function DBusCDSService.Search>, 'StateVariableChanged': <function signal.<locals>.decorator.<locals>.emit_signal>, 'StopTransferResource': <function DBusCDSService.StopTransferResource>, 'UpdateObject': <function DBusCDSService.UpdateObject>, 'getAvailableActions': <function DBusCDSService.getAvailableActions>, 'get_id': <function DBusCDSService.get_id>, 'get_scpd_xml': <function DBusCDSService.get_scpd_xml>, 'subscribeStateVariables': <function DBusCDSService.subscribeStateVariables>}, 'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}, 'coherence.dbus_service.DBusDevice': {'org.Coherence.device': {'get_device_icons': <function DBusDevice.get_device_icons>, 'get_device_type': <function DBusDevice.get_device_type>, 'get_device_type_version': <function DBusDevice.get_device_type_version>, 'get_friendly_device_type': <function DBusDevice.get_friendly_device_type>, 'get_friendly_name': <function DBusDevice.get_friendly_name>, 'get_id': <function DBusDevice.get_id>, 'get_info': <function DBusDevice.get_info>, 'get_markup_name': <function DBusDevice.get_markup_name>, 'get_usn': <function DBusDevice.get_usn>}, 'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}, 'coherence.dbus_service.DBusPontoon': {'org.Coherence': {'DMR_added': <function signal.<locals>.decorator.<locals>.emit_signal>, 'DMR_removed': <function signal.<locals>.decorator.<locals>.emit_signal>, 'DMS_added': <function signal.<locals>.decorator.<locals>.emit_signal>, 'DMS_removed': <function signal.<locals>.decorator.<locals>.emit_signal>, 'UPnP_ControlPoint_MediaRenderer_detected': <function signal.<locals>.decorator.<locals>.emit_signal>, 'UPnP_ControlPoint_MediaRenderer_removed': <function signal.<locals>.decorator.<locals>.emit_signal>, 'UPnP_ControlPoint_MediaServer_detected': <function signal.<locals>.decorator.<locals>.emit_signal>, 'UPnP_ControlPoint_MediaServer_removed': <function signal.<locals>.decorator.<locals>.emit_signal>, 'add_plugin': <function DBusPontoon.add_plugin>, 'call_plugin': <function DBusPontoon.call_plugin>, 'create_object': <function DBusPontoon.create_object>, 'create_oob': <function DBusPontoon.create_oob>, 'device_detected': <function signal.<locals>.decorator.<locals>.emit_signal>, 'device_removed': <function signal.<locals>.decorator.<locals>.emit_signal>, 'get_device_with_id': <function DBusPontoon.get_device_with_id>, 'get_devices': <function DBusPontoon.get_devices>, 'get_devices_async': <function DBusPontoon.get_devices_async>, 'get_pin': <function DBusPontoon.get_pin>, 'hostname': <function DBusPontoon.hostname>, 'import_resource': <function DBusPontoon.import_resource>, 'pin': <function DBusPontoon.pin>, 'put_resource': <function DBusPontoon.put_resource>, 'remove_plugin': <function DBusPontoon.remove_plugin>, 'unpin': <function DBusPontoon.unpin>, 'version': <function DBusPontoon.version>}, 'org.DLNA.DMC': {'getDMRList': <function DBusPontoon.getDMRList>, 'getDMSList': <function DBusPontoon.getDMSList>}, 'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}, 'coherence.dbus_service.DBusService': {'org.Coherence.service': {'StateVariableChanged': <function signal.<locals>.decorator.<locals>.emit_signal>, 'action': <function DBusService.action>, 'call_action': <function DBusService.call_action>, 'destroy_object': <function DBusService.destroy_object>, 'get_available_actions': <function DBusService.get_available_actions>, 'get_id': <function DBusService.get_id>, 'get_scpd_xml': <function DBusService.get_scpd_xml>, 'subscribe': <function DBusService.subscribe>}, 'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}, 'dbus.service.FallbackObject': {'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}, 'dbus.service.Interface': {}, 'dbus.service.Object': {'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}}

class `DBusService`(service, dbus_device, bus)

  Bases: `dbus.service.Object`, `coherence.log.LogAble`

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

  `logCategory` = 'dbus'
  `SUPPORTS_MULTIPLE_CONNECTIONS` = True
  `shutdown`()
  `_release_thyself`(suicide_mode=True)
  `_get_service_methods`()

    Returns a list of method descriptors for this object

  `variable_changed`(variable)
  `StateVariableChanged`(*args, **keywords)
  `get_scpd_xml`()
  `get_available_actions`()
  `get_id`()
  `action`(name, arguments, dbus_async_cb, dbus_async_err_cb)
  `call_action`(name, arguments, dbus_async_cb, dbus_async_err_cb, sender=None, connection=None)
  `destroy_object`(arguments, dbus_async_cb, dbus_async_err_cb)
  `subscribe`()
  `_dbus_class_table` = {'coherence.dbus_service.DBusCDSService': {'org.DLNA.DMS.CDS': {'Browse': <function DBusCDSService.Browse>, 'CreateObject': <function DBusCDSService.CreateObject>, 'CreateReference': <function DBusCDSService.CreateReference>, 'DeleteResource': <function DBusCDSService.DeleteResource>, 'DestroyObject': <function DBusCDSService.DestroyObject>, 'ExportResource': <function DBusCDSService.ExportResource>, 'GetFeatureList': <function DBusCDSService.GetFeatureList>, 'GetSearchCapabilites': <function DBusCDSService.GetSearchCapabilites>, 'GetSortCapabilities': <function DBusCDSService.GetSortCapabilities>, 'GetSortExtensionCapabilities': <function DBusCDSService.GetSortExtensionCapabilities>, 'GetSystemUpdateID': <function DBusCDSService.GetSystemUpdateID>, 'GetTransferProgress': <function DBusCDSService.GetTransferProgress>, 'ImportResource': <function DBusCDSService.ImportResource>, 'MoveObject': <function DBusCDSService.MoveObject>, 'Search': <function DBusCDSService.Search>, 'StateVariableChanged': <function signal.<locals>.decorator.<locals>.emit_signal>, 'StopTransferResource': <function DBusCDSService.StopTransferResource>, 'UpdateObject': <function DBusCDSService.UpdateObject>, 'getAvailableActions': <function DBusCDSService.getAvailableActions>, 'get_id': <function DBusCDSService.get_id>, 'get_scpd_xml': <function DBusCDSService.get_scpd_xml>, 'subscribeStateVariables': <function DBusCDSService.subscribeStateVariables>}, 'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}, 'coherence.dbus_service.DBusDevice': {'org.Coherence.device': {'get_device_icons': <function DBusDevice.get_device_icons>, 'get_device_type': <function DBusDevice.get_device_type>, 'get_device_type_version': <function DBusDevice.get_device_type_version>, 'get_friendly_device_type': <function DBusDevice.get_friendly_device_type>, 'get_friendly_name': <function DBusDevice.get_friendly_name>, 'get_id': <function DBusDevice.get_id>, 'get_info': <function DBusDevice.get_info>, 'get_markup_name': <function DBusDevice.get_markup_name>, 'get_usn': <function DBusDevice.get_usn>}, 'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}, 'coherence.dbus_service.DBusPontoon': {'org.Coherence': {'DMR_added': <function signal.<locals>.decorator.<locals>.emit_signal>, 'DMR_removed': <function signal.<locals>.decorator.<locals>.emit_signal>, 'DMS_added': <function signal.<locals>.decorator.<locals>.emit_signal>, 'DMS_removed': <function signal.<locals>.decorator.<locals>.emit_signal>, 'UPnP_ControlPoint_MediaRenderer_detected': <function signal.<locals>.decorator.<locals>.emit_signal>, 'UPnP_ControlPoint_MediaRenderer_removed': <function signal.<locals>.decorator.<locals>.emit_signal>, 'UPnP_ControlPoint_MediaServer_detected': <function signal.<locals>.decorator.<locals>.emit_signal>, 'UPnP_ControlPoint_MediaServer_removed': <function signal.<locals>.decorator.<locals>.emit_signal>, 'add_plugin': <function DBusPontoon.add_plugin>, 'call_plugin': <function DBusPontoon.call_plugin>, 'create_object': <function DBusPontoon.create_object>, 'create_oob': <function DBusPontoon.create_oob>, 'device_detected': <function signal.<locals>.decorator.<locals>.emit_signal>, 'device_removed': <function signal.<locals>.decorator.<locals>.emit_signal>, 'get_device_with_id': <function DBusPontoon.get_device_with_id>, 'get_devices': <function DBusPontoon.get_devices>, 'get_devices_async': <function DBusPontoon.get_devices_async>, 'get_pin': <function DBusPontoon.get_pin>, 'hostname': <function DBusPontoon.hostname>, 'import_resource': <function DBusPontoon.import_resource>, 'pin': <function DBusPontoon.pin>, 'put_resource': <function DBusPontoon.put_resource>, 'remove_plugin': <function DBusPontoon.remove_plugin>, 'unpin': <function DBusPontoon.unpin>, 'version': <function DBusPontoon.version>}, 'org.DLNA.DMC': {'getDMRList': <function DBusPontoon.getDMRList>, 'getDMSList': <function DBusPontoon.getDMSList>}, 'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}, 'coherence.dbus_service.DBusService': {'org.Coherence.service': {'StateVariableChanged': <function signal.<locals>.decorator.<locals>.emit_signal>, 'action': <function DBusService.action>, 'call_action': <function DBusService.call_action>, 'destroy_object': <function DBusService.destroy_object>, 'get_available_actions': <function DBusService.get_available_actions>, 'get_id': <function DBusService.get_id>, 'get_scpd_xml': <function DBusService.get_scpd_xml>, 'subscribe': <function DBusService.subscribe>}, 'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}, 'dbus.service.FallbackObject': {'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}, 'dbus.service.Interface': {}, 'dbus.service.Object': {'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}}

class `DBusDevice`(device, bus)

  Bases: `dbus.service.Object`, `coherence.log.LogAble`

  `logCategory` = 'dbus'
  `SUPPORTS_MULTIPLE_CONNECTIONS` = True
  `shutdown`()
  `_release_thyself`(suicide_mode=True)
  `path`()
  `get_info`()
  `get_markup_name`()
  `get_friendly_name`()
  `get_friendly_device_type`()
  `get_device_type_version`()
  `get_id`()
  `get_device_type`()
  `get_usn`()
  `get_device_icons`()
  `_dbus_class_table` = {'coherence.dbus_service.DBusCDSService': {'org.DLNA.DMS.CDS': {'Browse': <function DBusCDSService.Browse>, 'CreateObject': <function DBusCDSService.CreateObject>, 'CreateReference': <function DBusCDSService.CreateReference>, 'DeleteResource': <function DBusCDSService.DeleteResource>, 'DestroyObject': <function DBusCDSService.DestroyObject>, 'ExportResource': <function DBusCDSService.ExportResource>, 'GetFeatureList': <function DBusCDSService.GetFeatureList>, 'GetSearchCapabilites': <function DBusCDSService.GetSearchCapabilites>, 'GetSortCapabilities': <function DBusCDSService.GetSortCapabilities>, 'GetSortExtensionCapabilities': <function DBusCDSService.GetSortExtensionCapabilities>, 'GetSystemUpdateID': <function DBusCDSService.GetSystemUpdateID>, 'GetTransferProgress': <function DBusCDSService.GetTransferProgress>, 'ImportResource': <function DBusCDSService.ImportResource>, 'MoveObject': <function DBusCDSService.MoveObject>, 'Search': <function DBusCDSService.Search>, 'StateVariableChanged': <function signal.<locals>.decorator.<locals>.emit_signal>, 'StopTransferResource': <function DBusCDSService.StopTransferResource>, 'UpdateObject': <function DBusCDSService.UpdateObject>, 'getAvailableActions': <function DBusCDSService.getAvailableActions>, 'get_id': <function DBusCDSService.get_id>, 'get_scpd_xml': <function DBusCDSService.get_scpd_xml>, 'subscribeStateVariables': <function DBusCDSService.subscribeStateVariables>}, 'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}, 'coherence.dbus_service.DBusDevice': {'org.Coherence.device': {'get_device_icons': <function DBusDevice.get_device_icons>, 'get_device_type': <function DBusDevice.get_device_type>, 'get_device_type_version': <function DBusDevice.get_device_type_version>, 'get_friendly_device_type': <function DBusDevice.get_friendly_device_type>, 'get_friendly_name': <function DBusDevice.get_friendly_name>, 'get_id': <function DBusDevice.get_id>, 'get_info': <function DBusDevice.get_info>, 'get_markup_name': <function DBusDevice.get_markup_name>, 'get_usn': <function DBusDevice.get_usn>}, 'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}, 'coherence.dbus_service.DBusPontoon': {'org.Coherence': {'DMR_added': <function signal.<locals>.decorator.<locals>.emit_signal>, 'DMR_removed': <function signal.<locals>.decorator.<locals>.emit_signal>, 'DMS_added': <function signal.<locals>.decorator.<locals>.emit_signal>, 'DMS_removed': <function signal.<locals>.decorator.<locals>.emit_signal>, 'UPnP_ControlPoint_MediaRenderer_detected': <function signal.<locals>.decorator.<locals>.emit_signal>, 'UPnP_ControlPoint_MediaRenderer_removed': <function signal.<locals>.decorator.<locals>.emit_signal>, 'UPnP_ControlPoint_MediaServer_detected': <function signal.<locals>.decorator.<locals>.emit_signal>, 'UPnP_ControlPoint_MediaServer_removed': <function signal.<locals>.decorator.<locals>.emit_signal>, 'add_plugin': <function DBusPontoon.add_plugin>, 'call_plugin': <function DBusPontoon.call_plugin>, 'create_object': <function DBusPontoon.create_object>, 'create_oob': <function DBusPontoon.create_oob>, 'device_detected': <function signal.<locals>.decorator.<locals>.emit_signal>, 'device_removed': <function signal.<locals>.decorator.<locals>.emit_signal>, 'get_device_with_id': <function DBusPontoon.get_device_with_id>, 'get_devices': <function DBusPontoon.get_devices>, 'get_devices_async': <function DBusPontoon.get_devices_async>, 'get_pin': <function DBusPontoon.get_pin>, 'hostname': <function DBusPontoon.hostname>, 'import_resource': <function DBusPontoon.import_resource>, 'pin': <function DBusPontoon.pin>, 'put_resource': <function DBusPontoon.put_resource>, 'remove_plugin': <function DBusPontoon.remove_plugin>, 'unpin': <function DBusPontoon.unpin>, 'version': <function DBusPontoon.version>}, 'org.DLNA.DMC': {'getDMRList': <function DBusPontoon.getDMRList>, 'getDMSList': <function DBusPontoon.getDMSList>}, 'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}, 'coherence.dbus_service.DBusService': {'org.Coherence.service': {'StateVariableChanged': <function signal.<locals>.decorator.<locals>.emit_signal>, 'action': <function DBusService.action>, 'call_action': <function DBusService.call_action>, 'destroy_object': <function DBusService.destroy_object>, 'get_available_actions': <function DBusService.get_available_actions>, 'get_id': <function DBusService.get_id>, 'get_scpd_xml': <function DBusService.get_scpd_xml>, 'subscribe': <function DBusService.subscribe>}, 'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}, 'dbus.service.FallbackObject': {'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}, 'dbus.service.Interface': {}, 'dbus.service.Object': {'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}}

class `DBusPontoon`(controlpoint, bus=None)

  Bases: `dbus.service.Object`, `coherence.log.LogAble`

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

  `logCategory` = 'dbus'
  `SUPPORTS_MULTIPLE_CONNECTIONS` = True
  `shutdown`()
  `pin`(key, value)
  `get_pin`(key)
  `unpin`(key)
  `create_oob`(file)
  `remove_client`(usn, client)
  `remove`(udn)
  `version`()
  `hostname`()
  `get_devices`()
  `get_devices_async`(for_mirabeau, dbus_async_cb, dbus_async_err_cb)
  `get_device_with_id`(id)
  `add_plugin`(backend, arguments)
  `remove_plugin`(uuid)
  `call_plugin`(uuid, method, arguments)
  `create_object`(device_id, container_id, arguments, dbus_async_cb, dbus_async_err_cb)
  `import_resource`(device_id, source_uri, destination_uri, dbus_async_cb, dbus_async_err_cb)
  `put_resource`(destination_uri, filepath, dbus_async_cb, dbus_async_err_cb)
  `_device_detected`(device)
  `_device_removed`(usn='')
  `cp_ms_detected`(client, udn='')
  `cp_mr_detected`(client, udn='')
  `cp_ms_removed`(udn)
  `cp_mr_removed`(udn)
  `UPnP_ControlPoint_MediaServer_detected`(*args, **keywords)
  `UPnP_ControlPoint_MediaServer_removed`(*args, **keywords)
  `UPnP_ControlPoint_MediaRenderer_detected`(*args, **keywords)
  `UPnP_ControlPoint_MediaRenderer_removed`(*args, **keywords)
  `device_detected`(*args, **keywords)
  `_dbus_class_table` = {'coherence.dbus_service.DBusCDSService': {'org.DLNA.DMS.CDS': {'Browse': <function DBusCDSService.Browse>, 'CreateObject': <function DBusCDSService.CreateObject>, 'CreateReference': <function DBusCDSService.CreateReference>, 'DeleteResource': <function DBusCDSService.DeleteResource>, 'DestroyObject': <function DBusCDSService.DestroyObject>, 'ExportResource': <function DBusCDSService.ExportResource>, 'GetFeatureList': <function DBusCDSService.GetFeatureList>, 'GetSearchCapabilites': <function DBusCDSService.GetSearchCapabilites>, 'GetSortCapabilities': <function DBusCDSService.GetSortCapabilities>, 'GetSortExtensionCapabilities': <function DBusCDSService.GetSortExtensionCapabilities>, 'GetSystemUpdateID': <function DBusCDSService.GetSystemUpdateID>, 'GetTransferProgress': <function DBusCDSService.GetTransferProgress>, 'ImportResource': <function DBusCDSService.ImportResource>, 'MoveObject': <function DBusCDSService.MoveObject>, 'Search': <function DBusCDSService.Search>, 'StateVariableChanged': <function signal.<locals>.decorator.<locals>.emit_signal>, 'StopTransferResource': <function DBusCDSService.StopTransferResource>, 'UpdateObject': <function DBusCDSService.UpdateObject>, 'getAvailableActions': <function DBusCDSService.getAvailableActions>, 'get_id': <function DBusCDSService.get_id>, 'get_scpd_xml': <function DBusCDSService.get_scpd_xml>, 'subscribeStateVariables': <function DBusCDSService.subscribeStateVariables>}, 'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}, 'coherence.dbus_service.DBusDevice': {'org.Coherence.device': {'get_device_icons': <function DBusDevice.get_device_icons>, 'get_device_type': <function DBusDevice.get_device_type>, 'get_device_type_version': <function DBusDevice.get_device_type_version>, 'get_friendly_device_type': <function DBusDevice.get_friendly_device_type>, 'get_friendly_name': <function DBusDevice.get_friendly_name>, 'get_id': <function DBusDevice.get_id>, 'get_info': <function DBusDevice.get_info>, 'get_markup_name': <function DBusDevice.get_markup_name>, 'get_usn': <function DBusDevice.get_usn>}, 'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}, 'coherence.dbus_service.DBusPontoon': {'org.Coherence': {'DMR_added': <function signal.<locals>.decorator.<locals>.emit_signal>, 'DMR_removed': <function signal.<locals>.decorator.<locals>.emit_signal>, 'DMS_added': <function signal.<locals>.decorator.<locals>.emit_signal>, 'DMS_removed': <function signal.<locals>.decorator.<locals>.emit_signal>, 'UPnP_ControlPoint_MediaRenderer_detected': <function signal.<locals>.decorator.<locals>.emit_signal>, 'UPnP_ControlPoint_MediaRenderer_removed': <function signal.<locals>.decorator.<locals>.emit_signal>, 'UPnP_ControlPoint_MediaServer_detected': <function signal.<locals>.decorator.<locals>.emit_signal>, 'UPnP_ControlPoint_MediaServer_removed': <function signal.<locals>.decorator.<locals>.emit_signal>, 'add_plugin': <function DBusPontoon.add_plugin>, 'call_plugin': <function DBusPontoon.call_plugin>, 'create_object': <function DBusPontoon.create_object>, 'create_oob': <function DBusPontoon.create_oob>, 'device_detected': <function signal.<locals>.decorator.<locals>.emit_signal>, 'device_removed': <function signal.<locals>.decorator.<locals>.emit_signal>, 'get_device_with_id': <function DBusPontoon.get_device_with_id>, 'get_devices': <function DBusPontoon.get_devices>, 'get_devices_async': <function DBusPontoon.get_devices_async>, 'get_pin': <function DBusPontoon.get_pin>, 'hostname': <function DBusPontoon.hostname>, 'import_resource': <function DBusPontoon.import_resource>, 'pin': <function DBusPontoon.pin>, 'put_resource': <function DBusPontoon.put_resource>, 'remove_plugin': <function DBusPontoon.remove_plugin>, 'unpin': <function DBusPontoon.unpin>, 'version': <function DBusPontoon.version>}, 'org.DLNA.DMC': {'getDMRList': <function DBusPontoon.getDMRList>, 'getDMSList': <function DBusPontoon.getDMSList>}, 'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}, 'coherence.dbus_service.DBusService': {'org.Coherence.service': {'StateVariableChanged': <function signal.<locals>.decorator.<locals>.emit_signal>, 'action': <function DBusService.action>, 'call_action': <function DBusService.call_action>, 'destroy_object': <function DBusService.destroy_object>, 'get_available_actions': <function DBusService.get_available_actions>, 'get_id': <function DBusService.get_id>, 'get_scpd_xml': <function DBusService.get_scpd_xml>, 'subscribe': <function DBusService.subscribe>}, 'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}, 'dbus.service.FallbackObject': {'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}, 'dbus.service.Interface': {}, 'dbus.service.Object': {'org.freedesktop.DBus.Introspectable': {'Introspect': <function Object.Introspect>}}}
  `device_removed`(*args, **keywords)
  `getDMSList`()
  `_get_devices_of_type`(typ)
  `getDMRList`()
  `DMS_added`(*args, **keywords)
  `DMS_removed`(*args, **keywords)
  `DMR_added`(*args, **keywords)
  `DMR_removed`(*args, **keywords)

# coherence.json_service (module)

class `JsonInterface`(controlpoint)

  Bases: `twisted.web.resource.Resource`, `coherence.log.LogAble`

  `logCategory` = 'json'
  `render_GET`(request)
  `render_POST`(request)
  `getChildWithDefault`(path, request)

    Retrieve a static or dynamically generated child resource from me.

    First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.

    This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.

    @see: L{IResource.getChildWithDefault}

  `do_the_render`(request)
  `list_devices`(request)
  `call_action`(action, request)

# coherence.log (module)

`get_main_log_level`()

`formatter_message`(message, use_color=True)

class `ColoredFormatter`(msg, use_color=True)

  Bases: `logging.Formatter`

  `format`(record)

    Format the specified record as text.

    The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.

class `ColoredLogger`(name)

  Bases: `logging.Logger`

  `FORMAT` = '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'
  `COLOR_FORMAT` = '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'
  `findCaller`(stack_info=False, use_color=True)

    Find the stack frame of the caller so that we can note the source file name, line number and function name.

class `LogAble`

  Bases: `object`

  Base class for objects that want to be able to log messages with different level of severity. The levels are, in order from least to most: log, debug, info, warning, error.

  `logCategory` = 'default'

    Implementors can provide a category to log their messages under.

  `_Loggable__logger` = None
  `FORMAT` = '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'
  `COLOR_FORMAT` = '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'
  `log`(message, *args, **kwargs)
  `warning`(message, *args, **kwargs)
  `info`(message, *args, **kwargs)
  `critical`(message, *args, **kwargs)
  `debug`(message, *args, **kwargs)
  `error`(message, *args, **kwargs)
  `exception`(message, *args, **kwargs)
  `fatal`(message, *args, **kwargs)
  `warn`(message, *args, **kwargs)
  `msg`(message, *args, **kwargs)

`get_logger`(log_category)

`init`(logfilename=None, loglevel=30)

# coherence.transcoder (module)

Transcoder classes to be used in combination with a Coherence MediaServer, using GStreamer pipelines for the actually work and feeding the output into a http response.

`get_transcoder_name`(transcoder)

class `InternalTranscoder`

  Bases: `object`

  Just a class to inherit from and which we can look for upon creating our list of available transcoders.

class `FakeTransformer`(destination=None, request=None)

  Bases: `gi.repository.Gst.Element`, `coherence.log.LogAble`

  `logCategory` = 'faker_datasink'
  `_sinkpadtemplate` = <Gst.PadTemplate object at 0x7f5917933240 (GstPadTemplate at 0x5569ec9c59b0)>
  `_srcpadtemplate` = <Gst.PadTemplate object at 0x7f5917933360 (GstPadTemplate at 0x5569ec9c5a40)>
  `get_fake_header`()
  `chainfunc`(pad, buffer)

class `DataSink`(destination=None, request=None)

  Bases: `gi.repository.Gst.Element`, `coherence.log.LogAble`

  `logCategory` = 'transcoder_datasink'
  `_sinkpadtemplate` = <Gst.PadTemplate object at 0x7f59179335a0 (GstPadTemplate at 0x5569ec9c5ad0)>
  `chainfunc`(pad, inst, buffer)
  `eventfunc`(pad, inst, event)

class `GStreamerPipeline`(pipeline, content_type)

  Bases: `twisted.web.resource.Resource`, `coherence.log.LogAble`

  `logCategory` = 'gstreamer'
  `addSlash` = True
  `parse_pipeline`()
  `start`(request=None)
  `new_preroll`(appsink)
  `new_buffer`(appsink)
  `eos`(appsink)
  `getChild`(name, request)

    Retrieve a ‘child’ resource from me.

    Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

    This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

    For example, the URL /foo/bar/baz will normally be:

        | site.resource.getChild('foo').getChild('bar').getChild('baz').

    However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

    Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

  `render_GET`(request)
  `render_HEAD`(request)

    Default handling of HEAD method.

    I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.

  `requestFinished`(result, request)
  `on_message`(bus, message)
  `cleanup`()

class `BaseTranscoder`(uri, destination=None, content_type=None)

  Bases: `twisted.web.resource.Resource`, `coherence.log.LogAble`

  `logCategory` = 'transcoder'
  `addSlash` = True
  `getChild`(name, request)

    Retrieve a ‘child’ resource from me.

    Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

    This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

    For example, the URL /foo/bar/baz will normally be:

        | site.resource.getChild('foo').getChild('bar').getChild('baz').

    However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

    Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

  `render_GET`(request)
  `render_HEAD`(request)

    Default handling of HEAD method.

    I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.

  `requestFinished`(result)
  `on_message`(bus, message)
  `cleanup`()
  `start`(request=None)

    This method should be sub classed for each class which inherits from BaseTranscoder

class `PCMTranscoder`(uri, destination=None, content_type=None)

  Bases: `coherence.transcoder.BaseTranscoder`, `coherence.transcoder.InternalTranscoder`

  `contentType` = 'audio/L16;rate=44100;channels=2'
  `name` = 'lpcm'
  `start`(request=None)

    This method should be sub classed for each class which inherits from BaseTranscoder

class `WAVTranscoder`(uri, destination=None, content_type=None)

  Bases: `coherence.transcoder.BaseTranscoder`, `coherence.transcoder.InternalTranscoder`

  `contentType` = 'audio/x-wav'
  `name` = 'wav'
  `start`(request=None)

    This method should be sub classed for each class which inherits from BaseTranscoder

class `MP3Transcoder`(uri, destination=None, content_type=None)

  Bases: `coherence.transcoder.BaseTranscoder`, `coherence.transcoder.InternalTranscoder`

  `contentType` = 'audio/mpeg'
  `name` = 'mp3'
  `start`(request=None)

    This method should be sub classed for each class which inherits from BaseTranscoder

class `MP4Transcoder`(uri, destination=None, content_type=None)

  Bases: `coherence.transcoder.BaseTranscoder`, `coherence.transcoder.InternalTranscoder`

  Only works if H264 inside Quicktime/MP4 container is input Source has to be a valid uri

  `contentType` = 'video/mp4'
  `name` = 'mp4'
  `start`(request=None)

    This method should be sub classed for each class which inherits from BaseTranscoder

class `MP2TSTranscoder`(uri, destination=None, content_type=None)

  Bases: `coherence.transcoder.BaseTranscoder`, `coherence.transcoder.InternalTranscoder`

  `contentType` = 'video/mpeg'
  `name` = 'mpegts'
  `start`(request=None)

    This method should be sub classed for each class which inherits from BaseTranscoder

class `ThumbTranscoder`(uri, destination=None, content_type=None)

  Bases: `coherence.transcoder.BaseTranscoder`, `coherence.transcoder.InternalTranscoder`

  Should create a valid thumbnail according to the DLNA spec

  Warning

  Neither width nor height must exceed 160px

  `contentType` = 'image/jpeg'
  `name` = 'thumb'
  `start`(request=None)

    This method should be sub classed for each class which inherits from BaseTranscoder

class `GStreamerTranscoder`(uri, destination=None, content_type=None)

  Bases: `coherence.transcoder.BaseTranscoder`

  A generic Transcoder based on GStreamer.

  `pipeline_description` = None

    The pipeline which will be parsed upon calling the start method, has to be set as the attribute `pipeline_description` to the instantiated class.

  `start`(request=None)

    This method should be sub classed for each class which inherits from BaseTranscoder

class `ExternalProcessProtocol`(caller)

  Bases: `twisted.internet.protocol.ProcessProtocol`

  `connectionMade`()

    Called when a connection is made.

    This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.

  `outReceived`(data)

    Some data was received from stdout.

  `errReceived`(data)

    Some data was received from stderr.

  `inConnectionLost`()

    This will be called when stdin is closed.

  `outConnectionLost`()

    This will be called when stdout is closed.

  `errConnectionLost`()

    This will be called when stderr is closed.

  `processEnded`(status_object)

    Called when the child process exits and all file descriptors associated with it have been closed.

    @type reason: L{twisted.python.failure.Failure}

class `ExternalProcessProducer`(pipeline, request)

  Bases: `object`

  `logCategory` = 'externalprocess'
  `write_data`(data)
  `resumeProducing`()
  `pauseProducing`()
  `stopProducing`()

class `ExternalProcessPipeline`(uri)

  Bases: `twisted.web.resource.Resource`, `coherence.log.LogAble`

  `logCategory` = 'externalprocess'
  `addSlash` = False
  `pipeline_description` = None
  `contentType` = None
  `getChildWithDefault`(path, request)

    Retrieve a static or dynamically generated child resource from me.

    First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.

    This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.

    @see: L{IResource.getChildWithDefault}

  `render`(request)

    Render a given resource. See L{IResource}’s render method.

    I delegate to methods of self with the form ‘render_METHOD’ where METHOD is the HTTP that was used to make the request. Examples: render_GET, render_HEAD, render_POST, and so on. Generally you should implement those methods instead of overriding this one.

    render_METHOD methods are expected to return a byte string which will be the rendered page, unless the return value is C{server.NOT_DONE_YET}, in which case it is this class’s responsibility to write the results using C{request.write(data)} and then call C{request.finish()}.

    Old code that overrides render() directly is likewise expected to return a byte string or NOT_DONE_YET.

    @see: L{IResource.render}

`transcoder_class_wrapper`(klass, content_type, pipeline)

class `TranscoderManager`(coherence=None)

  Bases: `coherence.log.LogAble`

  Singleton class which holds information about all available transcoders. They are put into a transcoders dict with their id as the key.

  We collect all internal transcoders by searching for all subclasses of InternalTranscoder, the class will be the value.

  Transcoders defined in the config are parsed and stored as a dict in the transcoders dict.

  In the config, a transcoder description has to look like this:

  * preliminary, will be extended and might even change without further notice *

      <transcoder>
          <pipeline>%s ...</pipeline> <!-- we need a %s here to insert the
                                          source uri (or can we have all the
                                          times pipelines we can prepend with
                                          a '%s !') and an element named mux
                                          where we can attach our sink -->
          <type>gstreamer</type>      <!-- could be gstreamer or process -->
          <name>mpegts</name>
          <target>video/mpeg</target>
          <fourth_field>              <!-- value for the 4th field of the
                                          protocolInfo phalanx, default is
                                          '*' -->
      </transcoder>

  Initializes the class `TranscoderManager`.

  It should be called at least once with the main `Coherence` class passed as an argument, so we have access to the config.

  `logCategory` = 'transcoder_manager'
  `_instance_` = None
  `__init__`(coherence=None)

    Initializes the class `TranscoderManager`.

    It should be called at least once with the main `Coherence` class passed as an argument, so we have access to the config.

  `select`(name, uri, backend=None)

# coherence.tube_service (module)

## Tube service classes

class `MirabeauProxy`

  Bases: `twisted.web.resource.Resource`, `coherence.log.LogAble`

  `logCategory` = 'mirabeau'
  `getChildWithDefault`(path, request)

    Retrieve a static or dynamically generated child resource from me.

    First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.

    This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.

    @see: L{IResource.getChildWithDefault}

class `TubeServiceControl`(server)

  Bases: `coherence.upnp.core.soap_service.UPnPPublisher`

  `logCategory` = 'mirabeau'
  `get_action_results`(result, action, instance)

    Check for out arguments, if yes:

    > - check if there are related ones to StateVariables with non A_ARG_TYPE_ prefix, if yes:

    >   > - check if there is a call plugin method for this action:

    >   >   > - if yes => update StateVariable values with call result.
    >   >   > - if no => get StateVariable values and add them to the result dict.

  `soap__generic`(*args, **kwargs)

    Generic UPnP service control method, which will be used if no soap_ACTIONNAME method in the server service control class can be found.

class `TubeServiceProxy`(tube_service, device, backend=None)

  Bases: `coherence.upnp.core.service.ServiceServer`, `twisted.web.resource.Resource`

  `logCategory` = 'mirabeau'
  `init_var_and_actions`()

    The method `init_var_and_actions()` does two things:

    > - retrieve all actions and create the Action classes for our (proxy) server.
    > - retrieve all variables and create the StateVariable classes for our (proxy) server.

class `TubeDeviceProxy`(coherence, tube_device, external_address)

  Bases: `coherence.log.LogAble`

  `logCategory` = 'dbus'
  `register`()