coherence.backends.youtube_storage (module)

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

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

logCategory = 'internetVideoProxy'
requestFinished(result)[source]

self.connection is set in utils.ReverseProxyResource.render

render(request)[source]

Render a request by forwarding it to the proxied server.

followRedirects(request)[source]
proxyURL(request)[source]
getMimetype()[source]
renderFile(request, filepath)[source]
renderBufferFile(request, filepath, buffer_size)[source]
downloadFinished(result)[source]
gotDownloadError(error, request)[source]
downloadFile(request, filepath, callback, *args)[source]
checkCacheSize()[source]
class YoutubeVideoItem(external_id, title, url, mimetype, entry, store)[source]

Bases: coherence.backend.BackendItem

get_item()[source]

Called by the CDS and the MediaServer web.

Returns

  • an UPnP ContentDirectoryServer DIDLLite object

  • or a Deferred

get_path()[source]

Called by the MediaServer web.

Returns

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

get_id()[source]
class YouTubeStore(server, **kwargs)[source]

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)[source]
appendVideoEntry(entry, parent)[source]
upnp_init()[source]

This method gets called after the device is fired, here all initializations of service related state variables should happen, as the services aren’t available before that point.

retrieveFeedItems(parent=None, feed_uri='')[source]
retrievePlaylistFeedItems(parent, playlist_id)[source]
retrieveSubscriptionFeedItems(parent, uri)[source]
retrievePlaylistFeeds(parent)[source]
retrieveSubscriptionFeeds(parent)[source]