Deli TV Exposed, Part 1 – The Master Pipe

Okay, as promised, here’s a quick run through of how the pipework behind Deli TV – Personally Programmed Social Television Channels on Boxee: Prototype works…

The first part of the pipe is the “input parser”. To make the pipe as simple as possible, I wanted users to just be able to enter their delicious username and grab the appropriate Deli TV programming feed from delicious.

Of course, because users are users, as well as them entering their delicious user name, I had to defend against them pasting in the URL to their delcious account, or the RSS feed URI for the Delicious TV programming feed they wanted to use.

So what the input stage does is try to identify a user’s delicious username whatever they shove into the pipe’s input text box and generate the the URI to the delicious feed from that. As an undocumented feature, I decided to allow users to specify a feed pulled from users’ tag or tag combination pages. If no tag is input (e.g. if I just enter my delicious username (psychemedia), the input stage will assume I want to pull the programming feed in from psychemedia/delitv. However, if i specify a tag as well as my username (e.g. psychemedia/boxeetext5), that’s the programming feed the pipe will use.

So that’s the input stage…

The next stage is the clever part… What is does is look at the link from each item in the feed pulled in from delicious, and decide what to do with it. If the link is a link to a Youtube user page, or a Youtube playlist page, we need to rewrite the URI to a Youtube feed URI, and give it the rss:// protocol.

So for example:

  • given a Youtube playlist URI, we identify the playlist ID:
    http://www.youtube.com/view_play_list\?p=([^&]*)
    and generate the Youtube feed URI for that playlist:
    rss://gdata.youtube.com/feeds/base/playlists/$1?alt=rss&v=2
  • given a Youtube user URI, we identify the username:
    http://www.youtube.com/user/(.*)
    and generate the Youtube feed URI for that user’s recent uploads:
    rss://gdata.youtube.com/feeds/base/users/$1/uploads?alt=rss&v=2&orderby=published

These rewrites are handled by a Regular Expression block.

Delicious TV pipework 2

If the link is a link to another delicious feed, or to a BBC programmes page (such as a genre listing), the delicious feed details, or the iPlayer programmes page details are passed to another pipe, identified to Boxee as an rss:// feed.

These subpipes create valid Boxee feeds from iPlayer programme page URIs, or from other delicious pages. I’ll describe how these subpipes work in a couple of follow-on posts.

The final part of the pipe is a filter. It checks the links in the output feed that will be passed to Boxee to make sure that they can play in the Boxee environment.

At the moment, this is limited to rss:// identified feeds, Youtube programme pages, individual iPlayer programme pages and mp3 files.

As and when I get the chance, I’ll experiment with filters for other video websites. In this ‘release’, I wanted to try to limit what the pipe would pass through so that it stood a good chance of working. If I don’t get round to extending the filters fast enough for you, please feel free to clone the pipe and extend it to your heart’s desire. For example, you might want to extend it to let through content from ITV, Channel 4 or Channel 5 pages in the UK. (I’d appreciate it if you’d let me know about any changes you make to your version of the pipe that make it more useful and/or usable, though:-)

Next up, in a day or two, I’ll post an explanation of how the subpipes work…

PS if you have referred to this hack as “Delicious TV” anywhere, please change it to Deli TV. Why? So My Boxee “Delicious TV” Gets a Trademark Infringement Warning.

PS See also the UK HEI Boxe Channel for details about how that pipe works…