<<

Desktop Integrating Web Video

grams and subscriptions. For content de- livered via live broadcast, it is a neces- sity. MythVideo In previous generations of MythTV, all video content that was not recorded from hardware tuners was accessible only through a separate plugin, Myth- Video [2]. MythVideo could play back almost any media type, but the integra- tion it provided with the rest of the sys- tem was poor. It used a separate storage directory and a separate database table, and it was buried in a separate part of the menu structure – as was its comple- ment of settings and preferences. It even used a different interface for navigating between videos, more akin to a simple filesystem browser than MythTV’s user- friendly Recordings screen. If you

©Todd Arena, 123RF.com wanted to associate metadata with your files (i.e., “cover” images, dates, or syn- opses), you had to add that for each in- dividual file. That said, one good thing that Myth- Video brought to the party was support for any and every media type: It didn’t matter where the video came from, how it got to your computer, or whether it Integrate web video with MythTV was from a series, a standalone work, or even something you shot with your phone. MythTV’s Recordings interface is built around items that can be associated DVR meets web with an “air time” and a source channel. As I’ll describe, several of the web video With MythTV and a couple of plugins, you can merge Internet-delivered solutions find ways to cope with that set of constraints, with varying degrees of video right into your DVR . By Nathan Willis success. Besides handling the lack of a “chan- nel” for web video, the list of require- eb-delivered video has come a with your MythTV system. With some ments for web video integration should long way in a few short years plugins and helper applications, you can probably include merging the new con- W– and I don’t mean user-devel- merge Internet-delivered video right into tent into the same media browser as oped, self-published content, either. your playlist, regardless of whether you your television recordings as much as Major television networks now offer a receive it via a BitTorrent, RSS, or Atom possible, so you can sort through all of substantial portion of their programming feed. your video in one place, search it, and online, enough that it can supplement To be fair, I should note that some even delete it when you’re done. Al- the traditional broadcast media (cable, “media center” applications make though the ability to add or subscribe to over-the-air, and satellite). But, although web video a priority, like XBMC and new content from within MythTV would these content sources are effectively . If most of the programming you be nice, it is not absolutely essential. video-on-demand, they typically are not need to watch is available through feeds available in a way that lets you easily in- or websites, you might find it easier to MiroBridge tegrate them into a broadcast-centric install one of these applications and run Next, I’ll look at the most predictable of DVR system, like MythTV [1]. merrily along. For the average user, how- all video sources – those that come As always, though, the open source ever, no other open source media center through a standard RSS or Atom feed. community comes to the rescue. I’ll take application offers MythTV’s robust sup- This list includes video and a look at the different ways you can port for delivering live TV, scheduling re- quite a few Internet-only programs, but seamlessly merge online video sources cordings, and managing recurring pro- not just indie productions or niche top-

72 ISSUE 09 User www.ubuntu-user.com

072-076_webvideo.indd 72 4/26/11 12:11:36 PM Integrating Web Video Desktop

ics. Some popular outlets, like The but you should Onion, make a standard feed-based understand what video source available. These feeds are a they do. To begin, big win for MythTV users because they configure Myth- serve up the same content regardless of TV’s storage di- the application used. The broadcaster rectories for might be targeting iPad owners, but the graphics. In the standardized delivery mechanism makes MythTV front that assumption irrelevant. end, open Utili- Currently, the nicest option for feed ties/​Setup | Setup sources is a plugin named MiroBridge | Media Settings | [3]. MiroBridge uses the cross-platform Video Settings | video client [4] to manage General Settings. feeds and download videos in the back- You can choose ground, but it also implements a “virtual directories for recording device” to MythTV. The core movie posters, functionality comes in a Python script screenshots, ban- Figure 1: ’s MiroBridge setup tool simplifies the named mirobridge.py that quietly runs ners, and fan art. installation and configuration process. the Miro app to check your subscribed Whichever direc- feeds for new content in a background tories you choose, make sure they will By default, MiroBridge assigns the vir- process, downloads any new videos also be accessible to Miro. tual Miro Channel to channel number available, then shuts down Miro and in- Next, you will want a “Miro Channel” 999. If you have a real channel 999 in serts the new videos into MythTV. The icon – Mythbuntu Control Centre installs your lineup, you can change this setting result is that subscribed videos appear in one for you automatically, but you can with the mirobridge.py script. To assign the Watch Recordings list alongside nor- also grab it from the MiroBridge site and Miro to channel 12345, run: mal television recordings, complete with save it somewhere on your MythTV back the appropriate program and episode end. If you use channel icons for your /usr/share//contrib/imports/U names. They are marked as originating other channels, the easiest solution is to mirobridge/mirobridge.py ‑ 9999:12345 on the Miro Channel, which, of course, save the Miro icon in the same directory. does not appear as a live TV source. Then, run the MiroBridge script from a In this example, the 9999: corresponds Many MythTV distributions (including command prompt, passing it the loca- to the internal XML channel ID, which Mythbuntu) now package MiroBridge as tion of the icon with the -C flag. For ex- you probably do not want to mess with, a standard option (Figure 1). Mythbuntu ample: but the ‑c flag requires it. even provides a configuration tool in its Now, you can launch Miro and find Mythbuntu Control Centre, but if you in- /usr/share/mythtv/contrib/imports/U some feeds. You can browse the Miro stalled your own MythTV package or mirobridge/mirobridge.py U project’s Miro Guide directory, which is don’t use Mythbuntu for other reasons, ‑C /home/nate/icons/U filled with popular and recommended don’t worry. Most of the effort involves miro_channel_icon.png sources, and subscribe to those you configuring Miro’s storage and feed pref- want to record regularly (Figure 2). Be erences to be compatible with MythTV’s Because the path to mirobridge.py might sure to remove any unwanted feeds that expectations. vary a bit depending on your distro, run come pre-selected in the app’s Video At the time of writing, the current re- locate mirobridge.py to find yours. Feeds list, though – it can be overkill. lease requires MythTV version 0.22+fixes or later, but you should check the project’s homepage before proceeding. You will need to install Miro itself on your MythTV back end (remem- ber, Miro acts as a recording device, so it must be accessible to the back end). Any recent version should suffice. Also, you will need Python 2.5 or greater, Im- ageMagick, FFmpeg, and the pyparsing Python . All of these components should be available through the . Next, I’ll walk through the setup pro- cess. Mythbuntu Control Centre abbrevi- ates several of the steps into a series of buttons and drop-down selection menus, Figure 2: Subscribing to video feeds in the Miro application.

www.ubuntu-user.com ISSUE 09 73

072-076_webvideo.indd 73 4/26/11 12:11:36 PM Desktop Integrating Web Video

When you’re finished adding and re- The following daily cron slot: MythMediaMonitor to watch a Down- moving subscriptions, right-click on any loads directory and, if your BitTorrent that include non-alphabetic characters or 45 02 * * * /usr/share/mythtv/U client supports moving completed files have a very long feed name; then, choose contrib/imports/mirobridge/U to it, your completed downloads will au- Rename. You want to rename these feeds mirobridge.py U tomatically appear in your MythTV Re- to a shorter title without extra parenthe- ‑V "/tmp/mirobridge.log" 2>&1 cordings list. ses or punctuation marks, because they Also, if you own a movie or a series on can confuse MythTV’s media browser. will run the mirobridge.py script at DVD and want to rip the video into When you are done, quit Miro. 2:45am every day, logging the output to MythTV for easy viewing, you can have You also get to select how MiroBridge /tmp/mirobridge.log. MythMediaMonitor watch that directory treats videos. The default is to keep un- MiroBridge is a bit of a hassle to set as well. Certainly some people will pre- watched videos in the Recordings group up, certainly, but a large part of that fer the separate “archival” features of and move watched videos into Myth- stems from its reliance on an external MythVideo for that sort of long-term Video (hence the need to set MythVideo application (Miro itself). Once Miro- storage, but having the option is nice. storage directories for graphics above). I Bridge is up and running, however, all of Compared with MiroBridge, MythMe- strongly recommend changing this to the your feed-delivered video will be au- diaMonitor setup is a (Figure 4). behavior that treats all Miro videos like tomagically downloaded just like re- No out-of-the-ordinary dependencies are normal Recordings, which expire accord- corded television programs. required – in fact, apart from Im- ing to the normal MythTV rules. ageMagick and the (optional) mkvinfo In Mythbuntu Control Centre, choose MythMediaMonitor and mkvextract tools needed for Ma- Watched Recordings screen only under MiroBridge limitations include the re- troska file support, the only dependen- Behaviour Options and click Apply. For a quirement that Miro also be installed on cies are standard GNU utilities like sed, bit more control, you could also copy the the back-end machine. If your MythTV grep, and sleep. Simply download and mirobridge‑example.conf configuration back end is a headless server that pulls save the script on your MythTV back- file from the MiroBridge installation di- in all sorts of other GUI package require- end box (/usr/local/bin/ is a safe choice) rectory to your own .mythtv folder, re- ments, it can be difficult to configure and open it in a text editor. naming it mirobridge.conf. Here you can Miro. But, the main shortcoming of Mi- In the editor, scroll down to the Op- configure MiroBridge’s behavior for roBridge is that it only handles Miro’s tions section to find a well-commented watched videos. You can make the same feed-delivered videos, not BitTorrent or list of variables that you’ll need to behavior change by moving the line all other manual downloads. To get these change to fit your exact setup – mostly miro channels = from underneath the other forms of video into MythTV, how- common details like your MySQL user- [watch_then_copy] section to underneath ever, you can use MythMediaMonitor. name, database name, and database [watch only]. MythMediaMonitor [5] is a Bash script password. You can also specify separate MiroBridge is intended to run periodi- that, when run periodically, looks for directories for TV episodes and movies, cally as a cron job – daily, hourly, new video content in any directory you and you can also tell MythMediaMonitor weekly; the choice is yours. Here again, specify. When it finds something, the not to add movie content to the Record- Mythbuntu Control Centre gives you a script is smart enough to parse the file ings list. As with MiroBridge, the default selection box with Hourly, Daily, and name, determine the title and program directory choices are the same as those Weekly options. For more control, you number (if there is one), and add the used by MythVideo, but you don’t have can start the crontab editor with crontab new content to MythTV’s Recordings to keep them that way. ‑e and add a cron entry manually. (Figure 3). Thus, in practice, you can set You will need to specify the MythTV recording group to use; the default is De- fault, which is fine for most people. And, you’ll need to specify a Channel ID num- ber. MythMediaMonitor wisely defaults to 2111, so as not to conflict with Miro- Bridge, but you can change it if you ex- perience a problem. MythMediaMonitor can also extract subtitle tracks from Ma- troska videos and convert them to MythTV-compatible SRT format; to do so, you must specify the subtitle lan- guage you are interested in. Finally, if you set DEBUG=true, the script will log events to MythTV’s event database, which can be useful if you need to track down problems. Other than that, just set a MythMedia- Figure 3: MythTV’s Recordings screen, with web video inserted courtesy of MiroBridge. Monitor cron job in crontab for as often

74 ISSUE 09 Ubuntu User www.ubuntu-user.com

072-076_webvideo.indd 74 4/26/11 12:11:37 PM Integrating Web Video Desktop

as you’d like to re-scan your watched di- MediaMonitor is built for videos that you into a core plugin plus a set of site-spe- rectories. As an alternative to the daily find and fetch on a case-by-case basis. cific “grabber” scripts. A well-main- MiroBridge example earlier That use case can’t really be integrated tained set of grabbers ships with the into MythTV itself (unless you count plugin, but users can add their own. 23 * * * * /usr/local/bin/U starting a download from MythBrowser). The MythNetvision plugin is provided mythmediamonitor.sh Interestingly, Miro actually has BitTor- by all major MythTV distributors and rent downloading capabilities built-in, Linux distros, so installing it is a matter will run the script once every hour, at but they are not exploited by the Miro- of selecting the appropriate package the 23-minute mark. Once a video ap- Bridge plugin. So, you could use the two from your package manager. When in- pears in one of the watched directories, together, perhaps approximating a more stalled, however, you will have configu- the script will fetch all of the relevant in- seamless media-fetching experience. ration options that you need to choose formation it can retrieve from the web through your MythTV front end. (currently using IMDb and TVRage.com), MythNetvision The plugin adds two menu items to including titles, episode numbers, syn- RSS feeds and BitTorrent or HTTP down- the Media Library screen: Browse Inter- opses, original air dates, and thumbnail loads are fine and good, but they have net Video and Search Internet Video (Fig- images. Once an item is in the Record- one fatal flaw: Many vendors in the ure 5). In the Browse screen, you can ings group, your MythTV expiration broadcast industry skip them entirely navigate through the supported video rules determine when the video gets de- and instead build their own custom, sites just as you would recordings; in the leted. non-standard, Flash-based and quirk- Search screen, you can perform keyword Of course, like MiroBridge, MythMedi- filled web delivery platforms. Most of searches and browse through the results. aMonitor requires an external applica- these broadcaster-run web video ser- Search comes pre-configured with every tion to find the video you are interested vices function only in the browser, and grabber available as a selection; Browse in: a browser, a BitTorrent client, or a they have little in common around does not. Visit the Browse screen, then disc-ripping utility. But unlike Miro- which to build a consistent interface. press the menu key (keyboard M). The Bridge, there is no “set it and forget it” What’s a MythTV user to do? pop-up menu options are: Update Site analogue to subscribing to a feed. Myth- The answer from the MythTV project Maps, Update RSS, Manage Site Subscrip- is the new plugin tions, and Manage RSS Subscriptions. MythNetvision [6], Your first time through, you must which is poised to choose Manage Site Subscriptions, which bring full integration lists all installed grabbers. Check (or un- of online video into check) them to select the sites you want the MythTV experi- to browse (Figure 6). Then, you can hit ence, including cus- Esc and return to the previous menu. tom broadcaster Choose Update Site Maps and MythNet- sites, RSS and Atom vision scans the sites and assemble the feeds, and browser- content for your browsing pleasure (Fig- only video, with sup- ure 7). This process can take quite a port for searching while, depending on how many “site content online and subscriptions” you select. watching it directly The same process is required to use within MythTV. the plugin’s RSS subscription functional- Not all of the ity, but I don’t bother with RSS in Myth- pieces are in place Netvision because it duplicates the func- yet, but there’s solid tionality of MiroBridge in a less conve- support for a healthy nient way. MythNetvision already segre- set of web video gates its web video browsing from Re- sites, including video cordings; further separating RSS and Site sharing sites like grabbers makes no sense to me. YouTube, , and In daily use, MythNetvision’s support Dailymotion, plus for web video isn’t the full integration I television broadcast- would like, but it is the best option avail- ers like Comedy Cen- able for broadcasters that insist on iso- tral, BBC, PBS, MTV, lating their own content streams. As for and even the multi- the supported grabbers, only about 20 network ser- are currently available, but they are a vice. MythNetvision well-curated collection. The MythTV supports individual team insists on providing grabbers that video sites by sepa- adhere to the sites’ Terms of Service; if Figure 4: Editing the MythMediaMonitor configuration script. rating functionality you want to skirt the TOS, you can find

www.ubuntu-user.com Ubuntu User ISSUE 09 75

072-076_webvideo.indd 75 4/26/11 12:11:37 PM Desktop Integrating Web Video

independently developed grabbers for but be forewarned that some of the new- Moving forward, MythNetvision still other sources, often by searching users’ est grabber code only works with the has a lot of room to grow. For one thing, personal pages on the MythTV wiki. newest MythTV builds. The fun part is I find the terminology in the interface The wiki is also the best place to look that you can study all of the grabbers on- obtuse: “Update Site Maps” sounds like for unstable work-in-progress grabbers, line and maybe even write your own. it has nothing to do with web video at all. More importantly, I am hopeful that, in the future, it will adapt to fit more of MiroBridge’s integrate-feeds-with-record- ings model, which genuinely makes more sense. After all, RSS subscriptions should be just another “recording de- vice,” shouldn’t they? It’s all just video. Closing Credits Full web/​broadcast integration isn’t quite here yet, but it may never arrive: Standards change too fast. For example, I’m not sure whether MythTV develop- ers mean to support Google’s open source WebM codec, which would im- prove quality and reduce bandwidth for Figure 5: The MythNetvision plugin adds two new features to the Media Library. web video. Still, putting together the three pieces I’ve discussed here effectively makes it possible to use MythTV for all of your viewing needs. With MiroBridge, the RSS feed is considerably more reliable, and using it frees up a hardware tuner. On the other hand, it’s impossible to forget that web-delivered video is still a different beast from recordings you grab with a DVR. You’re not in control with web video; the site can be slow to re- spond, use a clunky UI, suffer from buff- ering problems, or only offer a small subset of a particular show’s episodes. Some of that might change with time as broadcasters warm up to the idea that eyes are eyes – regardless of the delivery Figure 6: MythNetvision grabbers implement a simple menu-based browser for video content. medium. n Here you see performances provided by MTV. INFO [1] MythTV: http://www.​­ mythtv.​­ org/​­ [2] MythVideo: http://​­www.​­mythtv.​­org/​ ­wiki/MythVideo​­ [3] Miro Bridge: http://​­www.​­mythtv.​­org/​ ­wiki/MiroBridge​­ [4] Miro: http://www.​­ getmiro.​­ com​­ [5] MythMediaMonitor: http://www.​­ ​ ­nowsci.com/​­ mythmediamonitor/​­ [6] Myth Netvision: http://www.​­ mythtv.​­ ​ ­org/wiki/​­ MythNetvision​­

Nathan Willis is a freelance journalist who writes about Linux and open source. AUTHOR Figure 7: MythNetvision can also send search queries to any (or all) of your subscribed grabbers.

76 ISSUE 09 Ubuntu User www.ubuntu-user.com

072-076_webvideo.indd 76 4/26/11 12:11:38 PM