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.

BackendItem

The base class for all MediaServer backend items.

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

Container

The base class for all containers. Inherits from BackendItem and it will contain our backend items.

LazyContainer

Inherits from Container and extends his capabilities.

AbstractBackendStore

Inherits from BackendStore and extends his capabilities.

class Backend(server, **kwargs)[source]

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

The base class for all backends.

if there are any UPnP service actions, that can’t be handled by the service classes itself, or need some special adjustments for the backend, they need to be defined here.

Like maybe upnp_Browse for the CDS Browse action.

    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

The init method for a backend, should probably most of the time be overwritten when the init is done, send a signal to its device.

The device will then setup and announce itself, after that it calls the backends upnp_init method.

implements = []
logCategory = 'backend'
__init__(server, **kwargs)[source]

The init method for a backend, should probably most of the time be overwritten when the init is done, send a signal to its device.

The device will then setup and announce itself, after that it calls the backends upnp_init method.

server = None

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. After that’s done, tell Coherence about it

init_completed(*args, **kwargs)[source]

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.

init_failed(*args, **kwargs)[source]

Inform Coherence that this backend has failed.

New in version 0.9.0.

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.

class BackendStore(server, *args, **kwargs)[source]

Bases: coherence.backend.Backend

the base class for all MediaServer backend stores

the init method for a MediaServer backend, should probably most of the time be overwritten when the init is done, send a signal to its device

the device will then setup and announce itself, after that it calls the backends upnp_init method

logCategory = 'backend_store'
__init__(server, *args, **kwargs)[source]

the init method for a MediaServer backend, should probably most of the time be overwritten when the init is done, send a signal to its device

the device will then setup and announce itself, after that it calls the backends upnp_init method

update_id = None

do whatever is necessary with the stuff we can extract from the config dict

release()[source]

if anything needs to be cleaned up upon shutdown of this backend, this is the place for it

_get_all_items(id)[source]

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)[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
class BackendItem(*args, **kwargs)[source]

Bases: coherence.log.LogAble

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 here

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(uri,protocolInfo)

self.item.res = [] res = DIDLLite.Resource(url, ‘http-get::%s:’ % mimetype)

url : the urlbase of our backend + ‘/’ + our id

res.size = size self.item.res.append(res)

logCategory = 'backend_item'
__init__(*args, **kwargs)[source]

most of the time we collect the necessary data for an UPnP ContentDirectoryService Container or Object and instantiate it here

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(uri,protocolInfo)

self.item.res = [] res = DIDLLite.Resource(url, ‘http-get::%s:’ % mimetype)

url : the urlbase of our backend + ‘/’ + our id

res.size = size self.item.res.append(res)

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

called by the MediaServer web should return

  • the filepath where to find the media file that this item does refer to
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 BackendRssMixin[source]

Bases: object

update_data(rss_url, container=None)[source]

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

parse_data(xml_data, container)[source]

extract media info and create BackendItems

queue_update(error_or_failure, rss_url, container)[source]
class Container(parent, title)[source]

Bases: coherence.backend.BackendItem

register_child(child, external_id=None)[source]
add_child(child, external_id=None, update=True)[source]
remove_child(child, external_id=None, update=True)[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_path()[source]

called by the MediaServer web should return

  • the filepath where to find the media file that this item does refer to
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]
get_update_id()[source]
class LazyContainer(parent, title, external_id=None, refresh=0, childrenRetriever=None, **kwargs)[source]

Bases: coherence.backend.Container

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

class AbstractBackendStore(server, **kwargs)[source]

Bases: coherence.backend.BackendStore

len()[source]
set_root_item(item)[source]
get_root_id()[source]
get_root_item()[source]
append_item(item, storage_id=None)[source]
remove_item(item)[source]
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
getnextID()[source]

coherence.base (module)

Base

The core of the project. Hols the class Coherence intended to be used to manage all the resources of the project. Also cointains 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)[source]

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

addSlash = True
logCategory = 'coherence'
getChild(name, request)[source]

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

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

Bases: coherence.log.LogAble

logCategory = 'webserver'
_endpoint_listen(coherence, port)[source]
class WebServerUi(port, coherence, unittests=False)[source]

Bases: coherence.base.WebServer

logCategory = 'webserverui'
_endpoint_listen(coherence, port)[source]
_ws_endpoint_listen(coherence)[source]
class Plugins(ids=('coherence.plugins.backend.media_server', 'coherence.plugins.backend.media_renderer', 'coherence.plugins.backend.binary_light', 'coherence.plugins.backend.dimmable_light'))[source]

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)[source]
set(key, value)[source]
keys()[source]
_collect_from_module()[source]
_Plugins__initialized = False
_Plugins__instance = None
class Coherence(config=None)[source]

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 devices, children, _callbacks, active_backends and

    all service variables to use EventDispatcher’s properties

logCategory = 'coherence'
devices
children
_callbacks
active_backends
ctrl
dbus
json
msearch
ssdp_server
transcoder_manager
web_server
web_server_port = None

initializes logsystem a COHEN_DEBUG environment variable overwrites all level settings here

clear()[source]

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

setup_part2()[source]
add_plugin(plugin, **kwargs)[source]
remove_plugin(plugin)[source]

Removes a backend from Coherence

@:param plugin: is the object return by add_plugin or an UUID string

static writeable_config()[source]

do we have a new-style config file

store_plugin_config(uuid, items)[source]

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

receiver(signal, *args, **kwargs)[source]
shutdown(force=False)[source]
check_devices()[source]

iterate over devices and their embedded ones and renew subscriptions

subscribe(name, callback)[source]
unsubscribe(name, callback)[source]
callback(name, *args)[source]
get_device_by_host(host)[source]
get_device_with_usn(usn)[source]
get_device_with_id(device_id)[source]
get_devices()[source]
get_local_devices()[source]
get_nonlocal_devices()[source]
create_device(device_type, infos)[source]
add_device(device, *args)[source]
remove_device(device_type, infos)[source]
_Coherence__cls = None
_Coherence__incarnations = 0
_Coherence__initialized = False
_Coherence__instance = None
add_web_resource(name, sub)[source]
remove_web_resource(name)[source]
static check_louie(receiver, signal, method='connect')[source]

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

New in version 0.9.0.

connect(receiver, signal=None, sender=None, weak=True)[source]

Wrapper method around the deprecated method louie.connect.

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

Wrapper method around the deprecated method louie.disconnect

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 bridge DBus with Coherence.

un_namespace(text)[source]
class DBusCDSService(service, dbus_device, bus)[source]

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

Changed in version 0.9.0: Migrated from extern.louie to EventDispatcher

logCategory = 'dbus'
NOT_FOR_THE_TUBES = True
shutdown()[source]
_release_thyself(suicide_mode=True)[source]
variable_changed(variable)[source]
get_id()[source]
get_scpd_xml()[source]
StateVariableChanged(*args, **keywords)
getAvailableActions()[source]
subscribeStateVariables()[source]
GetSearchCapabilites(dbus_async_cb, dbus_async_err_cb)[source]
GetSortCapabilities(dbus_async_cb, dbus_async_err_cb)[source]
GetSortExtensionCapabilities(dbus_async_cb, dbus_async_err_cb)[source]
GetFeatureList(dbus_async_cb, dbus_async_err_cb)[source]
GetSystemUpdateID(dbus_async_cb, dbus_async_err_cb)[source]
Browse(ObjectID, BrowseFlag, Filter, StartingIndex, RequestedCount, SortCriteria, dbus_async_cb, dbus_async_err_cb)[source]
Search(ContainerID, SearchCriteria, Filter, StartingIndex, RequestedCount, SortCriteria, dbus_async_cb, dbus_async_err_cb)[source]
CreateObject(ContainerID, Elements, dbus_async_cb, dbus_async_err_cb)[source]
DestroyObject(ObjectID, dbus_async_cb, dbus_async_err_cb)[source]
UpdateObject(ObjectID, CurrentTagValue, NewTagValue, dbus_async_cb, dbus_async_err_cb)[source]
MoveObject(ObjectID, NewParentID, dbus_async_cb, dbus_async_err_cb)[source]
ImportResource(SourceURI, DestinationURI, dbus_async_cb, dbus_async_err_cb)[source]
ExportResource(SourceURI, DestinationURI, dbus_async_cb, dbus_async_err_cb)[source]
DeleteResource(ResourceURI, dbus_async_cb, dbus_async_err_cb)[source]
StopTransferResource(TransferID, dbus_async_cb, dbus_async_err_cb)[source]
GetTransferProgress(TransferID, dbus_async_cb, dbus_async_err_cb)[source]
CreateReference(ContainerID, ObjectID, dbus_async_cb, dbus_async_err_cb)[source]
callAction(name, arguments)[source]
_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)[source]

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

Changed in version 0.9.0: Migrated from extern.louie to EventDispatcher

logCategory = 'dbus'
SUPPORTS_MULTIPLE_CONNECTIONS = True
shutdown()[source]
_release_thyself(suicide_mode=True)[source]
_get_service_methods()[source]

Returns a list of method descriptors for this object

variable_changed(variable)[source]
StateVariableChanged(*args, **keywords)
get_scpd_xml()[source]
get_available_actions()[source]
get_id()[source]
action(name, arguments, dbus_async_cb, dbus_async_err_cb)[source]
call_action(name, arguments, dbus_async_cb, dbus_async_err_cb, sender=None, connection=None)[source]
destroy_object(arguments, dbus_async_cb, dbus_async_err_cb)[source]
subscribe()[source]
_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)[source]

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

logCategory = 'dbus'
SUPPORTS_MULTIPLE_CONNECTIONS = True
shutdown()[source]
_release_thyself(suicide_mode=True)[source]
path()[source]
get_info()[source]
get_markup_name()[source]
get_friendly_name()[source]
get_friendly_device_type()[source]
get_device_type_version()[source]
get_id()[source]
get_device_type()[source]
get_usn()[source]
get_device_icons()[source]
_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)[source]

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

Changed in version 0.9.0: Migrated from extern.louie to EventDispatcher

logCategory = 'dbus'
SUPPORTS_MULTIPLE_CONNECTIONS = True
shutdown()[source]
pin(key, value)[source]
get_pin(key)[source]
unpin(key)[source]
create_oob(file)[source]
remove_client(usn, client)[source]
remove(udn)[source]
version()[source]
hostname()[source]
get_devices()[source]
get_devices_async(for_mirabeau, dbus_async_cb, dbus_async_err_cb)[source]
get_device_with_id(id)[source]
add_plugin(backend, arguments)[source]
remove_plugin(uuid)[source]
call_plugin(uuid, method, arguments)[source]
create_object(device_id, container_id, arguments, dbus_async_cb, dbus_async_err_cb)[source]
import_resource(device_id, source_uri, destination_uri, dbus_async_cb, dbus_async_err_cb)[source]
put_resource(destination_uri, filepath, dbus_async_cb, dbus_async_err_cb)[source]
_device_detected(device)[source]
_device_removed(usn='')[source]
cp_ms_detected(client, udn='')[source]
cp_mr_detected(client, udn='')[source]
cp_ms_removed(udn)[source]
cp_mr_removed(udn)[source]
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()[source]
_get_devices_of_type(typ)[source]
getDMRList()[source]
DMS_added(*args, **keywords)
DMS_removed(*args, **keywords)
DMR_added(*args, **keywords)
DMR_removed(*args, **keywords)

coherence.dispatcher (module)

class Receiver(signal, callback, args, kwargs)[source]

Bases: object

exception UnknownSignal[source]

Bases: Exception

class Dispatcher[source]

Bases: object

connect(signal, callback, *args, **kw)[source]
disconnect(receiver)[source]
emit(signal, *args, **kwargs)[source]
deferred_emit(signal, *args, **kwargs)[source]
save_emit(signal, *args, **kwargs)[source]
_merge_results_and_receivers(result, receivers)[source]
_get_receivers(signal)[source]
class SignalingProperty(signal, var_name=None, default=None)[source]

Bases: object

Does emit self.signal when the value has changed but only if HAS changed (means old_value != new_value).

class ChangedSignalingProperty(signal, var_name=None, default=None)[source]

Bases: coherence.dispatcher.SignalingProperty

Does send the signal with two values when changed:
  1. the new value
  2. the value it has been before
class CustomSignalingProperty(signal, fget, fset, fdel=None, doc=None)[source]

Bases: object

Signal changes to this property. allows to specify fget and fset as the build in property-decorator.

fdel is there for API compability only. As there is no good way to signal a deletion it is not implemented at all.

__init__(signal, fget, fset, fdel=None, doc=None)[source]

fdel is there for API compability only. As there is no good way to signal a deletion it is not implemented at all.

coherence.json_service (module)

class JsonInterface(controlpoint)[source]

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

logCategory = 'json'
render_GET(request)[source]
render_POST(request)[source]
getChildWithDefault(path, request)[source]

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)[source]
list_devices(request)[source]
call_action(action, request)[source]

coherence.log (module)

get_main_log_level()[source]
formatter_message(message, use_color=True)[source]
class ColoredFormatter(msg, use_color=True)[source]

Bases: logging.Formatter

format(record)[source]

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

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

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

class LogAble[source]

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.

@cvar logCategory: Implementors can provide a category to log their
messages under.
logCategory = 'default'
_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)[source]
warning(message, *args, **kwargs)[source]
info(message, *args, **kwargs)[source]
critical(message, *args, **kwargs)[source]
debug(message, *args, **kwargs)[source]
error(message, *args, **kwargs)[source]
exception(message, *args, **kwargs)[source]
fatal(message, *args, **kwargs)
warn(message, *args, **kwargs)
msg(message, *args, **kwargs)
get_logger(log_category)[source]
init(logfilename=None, loglevel=30)[source]

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

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

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

logCategory = 'faker_datasink'
_sinkpadtemplate = <Gst.PadTemplate object at 0x7f3c87d39948 (GstPadTemplate at 0x55f1895249b0)>
_srcpadtemplate = <Gst.PadTemplate object at 0x7f3c87d39990 (GstPadTemplate at 0x55f189524a40)>
get_fake_header()[source]
chainfunc(pad, buffer)[source]
class DataSink(destination=None, request=None)[source]

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

logCategory = 'transcoder_datasink'
_sinkpadtemplate = <Gst.PadTemplate object at 0x7f3c87d39a68 (GstPadTemplate at 0x55f189524ad0)>
chainfunc(pad, inst, buffer)[source]
eventfunc(pad, inst, event)[source]
class GStreamerPipeline(pipeline, content_type)[source]

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

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

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

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)[source]
on_message(bus, message)[source]
cleanup()[source]
class BaseTranscoder(uri, destination=None, content_type=None)[source]

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

logCategory = 'transcoder'
addSlash = True
getChild(name, request)[source]

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

Default handling of HEAD method.

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

requestFinished(result)[source]
on_message(bus, message)[source]
cleanup()[source]
start(request=None)[source]

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

class PCMTranscoder(uri, destination=None, content_type=None)[source]

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

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

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

class WAVTranscoder(uri, destination=None, content_type=None)[source]

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

contentType = 'audio/x-wav'
name = 'wav'
start(request=None)[source]

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

class MP3Transcoder(uri, destination=None, content_type=None)[source]

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

contentType = 'audio/mpeg'
name = 'mp3'
start(request=None)[source]

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

class MP4Transcoder(uri, destination=None, content_type=None)[source]

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

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

class MP2TSTranscoder(uri, destination=None, content_type=None)[source]

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

contentType = 'video/mpeg'
name = 'mpegts'
start(request=None)[source]

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

class ThumbTranscoder(uri, destination=None, content_type=None)[source]

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

should create a valid thumbnail according to the DLNA spec neither width nor height must exceed 160px

contentType = 'image/jpeg'
name = 'thumb'
start(request=None)[source]

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

class GStreamerTranscoder(uri, destination=None, content_type=None)[source]

Bases: coherence.transcoder.BaseTranscoder

a generic Transcode based on GStreamer

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

same for the attribute contentType

pipeline_description = None
start(request=None)[source]

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

class ExternalProcessProtocol(caller)[source]

Bases: twisted.internet.protocol.ProcessProtocol

connectionMade()[source]

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

Some data was received from stdout.

errReceived(data)[source]

Some data was received from stderr.

inConnectionLost()[source]

This will be called when stdin is closed.

outConnectionLost()[source]

This will be called when stdout is closed.

errConnectionLost()[source]

This will be called when stderr is closed.

processEnded(status_object)[source]

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

Bases: object

logCategory = 'externalprocess'
write_data(data)[source]
resumeProducing()[source]
pauseProducing()[source]
stopProducing()[source]
class ExternalProcessPipeline(uri)[source]

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

logCategory = 'externalprocess'
addSlash = False
pipeline_description = None
contentType = None
getChildWithDefault(path, request)[source]

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

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)[source]
class TranscoderManager(coherence=None)[source]

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

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

initializes the class

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

coherence.tube_service (module)

TUBE service classes

class MirabeauProxy[source]

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

logCategory = 'mirabeau'
getChildWithDefault(path, request)[source]

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

Bases: coherence.upnp.core.soap_service.UPnPPublisher

logCategory = 'mirabeau'
get_action_results(result, action, instance)[source]

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 result dict
soap__generic(*args, **kwargs)[source]

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

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

logCategory = 'mirabeau'
init_var_and_actions()[source]

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

Bases: coherence.log.LogAble

logCategory = 'dbus'
register()[source]