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

# coherence.backends.youtube_storage (module)

class `TestVideoProxy`(uri, id, proxy_mode, cache_directory, cache_maxsize=100000000, buffer_size=2000000, fct=None, **kwargs)

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

  `logCategory` = 'internetVideoProxy'
  `requestFinished`(result)

    self.connection is set in utils.ReverseProxyResource.render

  `render`(request)

    Render a request by forwarding it to the proxied server.

  `followRedirects`(request)
  `proxyURL`(request)
  `getMimetype`()
  `renderFile`(request, filepath)
  `renderBufferFile`(request, filepath, buffer_size)
  `downloadFinished`(result)
  `gotDownloadError`(error, request)
  `downloadFile`(request, filepath, callback, *args)
  `checkCacheSize`()

class `YoutubeVideoItem`(external_id, title, url, mimetype, entry, store)

  Bases: `coherence.backend.BackendItem`

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

  `get_id`()

class `YouTubeStore`(server, **kwargs)

  Bases: `coherence.backend.AbstractBackendStore`

  `logCategory` = 'youtube_store'
  `implements` = ['MediaServer']
  `description` = ('Youtube', 'connects to the YouTube service and exposes the standard feeds (public) and the uploads/favorites/playlists/subscriptions of a given user.', 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': 'refresh', 'text': 'Refresh period', 'type': 'string'}, {'option': 'login', 'text': 'User ID:', 'type': 'string', 'group': 'User Account'}, {'option': 'password', 'text': 'Password:', 'type': 'string', 'group': 'User Account'}, {'option': 'location', 'text': 'Locale:', 'type': 'string'}, {'option': 'quality', 'text': 'Video quality:', 'type': 'string', 'default': 'sd', 'enum': ('sd', 'hd')}, {'option': 'standard_feeds', 'text': 'Include standard feeds:', 'type': 'bool', 'default': True}, {'option': 'proxy_mode', 'text': 'Proxy mode:', 'type': 'string', 'enum': ('redirect', 'proxy', 'cache', 'buffered')}, {'option': 'buffer_size', 'text': 'Buffering size:', 'type': 'int'}, {'option': 'cache_directory', 'text': 'Cache directory:', 'type': 'dir', 'group': 'Cache'}, {'option': 'cache_maxsize', 'text': 'Cache max size:', 'type': 'int', 'group': 'Cache'}]
  `appendFeed`(name, feed_uri, parent)
  `appendVideoEntry`(entry, parent)
  `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.

  `retrieveFeedItems`(parent=None, feed_uri='')
  `retrievePlaylistFeedItems`(parent, playlist_id)
  `retrieveSubscriptionFeedItems`(parent, uri)
  `retrievePlaylistFeeds`(parent)
  `retrieveSubscriptionFeeds`(parent)