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

# coherence.backends.itv_storage (module)

class `ProxyStream`(uri)

  Bases: `coherence.upnp.core.utils.ReverseProxyUriResource`, `coherence.log.LogAble`

  `logCategory` = 'itv'
  `stream_url` = None
  `requestFinished`(result)

    self.connection is set in utils.ReverseProxyResource.render

  `render`(request)

    Render a request by forwarding it to the proxied server.

class `Container`(id, store, parent_id, title)

  Bases: `coherence.backend.BackendItem`

  `add_child`(child)
  `get_children`(start=0, end=0)

    Called by the CDS and the MediaServer web.

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

  `get_child_count`()

    Called by the CDS.

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

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

class `ITVItem`(store, id, obj, parent)

  Bases: `coherence.backend.BackendItem`

  `logCategory` = 'itv'
  `get_item`()

    Called by the CDS and the MediaServer web.

    Returns: | an UPnP ContentDirectoryServer DIDLLite object 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.

class `ITVStore`(server, **kwargs)

  Bases: `coherence.backend.BackendStore`

  `logCategory` = 'itv'
  `implements` = ['MediaServer']
  `description` = ('Shoutcast TV', 'cexposes the list of video streams from Shoutcast TV.', None)
  `options` = [{'option': 'name', 'text': 'Server Name:', 'type': 'string', 'default': 'my media', 'help': 'the name under this MediaServer shall show up with on other UPnP clients'}, {'option': 'version', 'text': 'UPnP Version:', 'type': 'int', 'default': 2, 'enum': (2, 1), 'help': 'the highest UPnP version this MediaServer shall support', 'level': 'advance'}, {'option': 'uuid', 'text': 'UUID Identifier:', 'type': 'string', 'help': 'the unique (UPnP) identifier for this MediaServer, usually automatically set', 'level': 'advance'}, {'option': 'genrelist', 'text': 'Server URL', 'type': 'string', 'default': 'http://www.shoutcast.com/sbin/newtvlister.phtml?service=winamp2&no_compress=1'}]
  `storeItem`(parent, item, id)
  `appendGenre`(genre, parent)
  `appendFeed`(obj, parent)
  `len`()
  `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`()
  `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.

  `retrieveList`(parent)