This backend is part of the official distribution packages since 0.6.2. However, it shall still be considered as experimental. You may check svn for the latest version

YouTube MediaServer

YouTube is a video sharing website where users can upload, view and share video clips.

Additional dependencies

The backend uses an included, twistified version of youtube-dl to extract the links to the video clips.

Furthermore it uses the Google Data APIs Python Client Library to retrieve the general feed data and personal videos and favorites lists from YouTube.
A current version is needed - 1.2.4 works fine. The 1.0.9 you get with the Ubuntu hardy package does not.
So at the moment a download and a python ./setup.py install of the module is necessary.

UPnP ContentDirectory structure

The returned media data from YouTube is represented in this structure:

  • Most Viewed
  • Top Rated
  • Recently Featured
  • Watch On Mobile
  • Most Discussed
  • Top Favorites
  • Most Linked
  • Most Responded
  • Most Recent
  • My Uploads
  • My Favorites
  • My Playlists
  • My Subscriptions

'My Uploads/Favorites/Playlists/Subscriptions' are only available when there is a valid userid and password provided.

The standards feeds (Most ..., Top ...) can be hidden thanks to option standard_feeds.

Totem accessing YouTube via Coherence:

http://coherence.beebits.net/download/totem-youtube-1.png

Configuration

The YouTube backend accepts these options:

name:
the name this backend should show up on your UPnP clients, defaults to YouTube
userid
your login @ YouTube to retrieve your personal videos and favorites
password
your password @ YouTube
version
instruct this backend to act as a UPnP A/V version 1 or version 2 MediaServer
locale
the locale for the standards feeds (list of values available at http://code.google.com/intl/de/apis/youtube/1.0/reference.html#Region_specific_feeds). If not provided, no locale is applied to the feeds.
quality
hd or sd (default). 'hd' if you want HD content when available (When not available, the backend will switch back to SD).
standard_feeds
Yes (default) or No. Set to No if you want to hide the standard feeds.
proxy_mode
  • "redirect" - if you want the MediaRenderer to directly connect to the Youtube server (default)
  • "proxy" - if you want the request routed through the backend
  • "cache" - if you want the stream to be downloaded and then served to the MediaRenderer
  • "buffered"- if you want the stream to be downloaded and served in parallel to the MediaRenderer (after a given amount of data has been retrieved).

In both "cache" and "buffered" mode, the downloaded stream will stay on the server for future access.

cache_directory
the cache directory where the stream will be downloaded in cache and buffer mode. (compulsory in cache and buffer mode)
cache_maxsize
max size for the cache directory (in bytes). If bigger, some cached streams will be deleted (default to 100000000=100MB)
buffer_size
in buffer mode, minimal amount of downloaded data before serving it to the mediarenderer (in bytes) (default to 2000000=2MB)

Examples

New config file:

<plugin active="yes">
  <backend>YouTubeStore</backend>
  <name>YouTube</name>
</plugin>

Python code:

coherence.add_plugin('YouTubeStore',
                     name='YouTube')

DBus:

coherence_service = dbus.SessionBus().get_object('org.Coherence','/org/Coherence')
coherence_service.add_plugin('YouTubeStore',
                             {'name':'YouTube'},
                             dbus_interface='org.Coherence',
                             reply_handler=add_plugin_callback,
                             error_handler=error_callback)

Commandline:

coherence --plugin=backend:YouTube

Open Tickets for this backend (new...)

#209
Add Search functionnality to Youtube backend...
#312
when trying to browse feeds in youtube listings contents is empty in all categories and I see this error