Linux DevCenter    
 Published on Linux DevCenter (http://www.linuxdevcenter.com/)
 See this if you're having trouble printing code examples


Clever Tricks with MythTV

by John Littler
12/29/2004

MythTV is one open source answer to TiVo. Its creator started the project because he thought that the TiVo was cheap enough, but having to sign up for subscriptions was a pain. MythTV allows you to record and play TV and skip ads; and with plugins, retrieve TV schedules, play DVDs, emulate a Nintendo, check weather forecasts, play Linux Games, read RSS feeds, play music, and more.

Beware that some stations are actively working to defeat ad skipping, so it doesn't always work.

Putting It Together

While this series of thoughts is not about setting up MythTV, it's probably not a bad idea to mention some of the easier ways of putting it all together. The easiest way if you're starting from scratch is to use the Knoppmyth ISO, a 500MB bootable CD file that will set you up and get you ready (well, almost ready) to go. Note this is not a run-from-the-CD thing--it installs a special truncated Linux that has all of the necessary MythTV commands. If you want to add to the basic lot of apps, of course you can. Another easy way, with Gentoo, is to emerge mythtv. Debian and Red Hat have their own ways. Despite some people saying it's a piece of cake, many people find the SuSE installation to be hard work. There isn't even a MythTV package on the CD/DVD, which is a bit strange for a distro that used to be known for having practically everything on it.

Equipment

Software

Related Reading

Linux Unwired
By Roger Weeks, Edd Dumbill, Brian Jepson

Once You're Going (The Fun Part)

One nice by-product of complexity and open source is that we can dream up and implement all sorts of additions or different types of use. Here's a sampling.

Web Browser -> Wireless Keyboard -> Wiki, Etc.

The scenario here is that you have the serious computers elsewhere in the house, but occasionally you might want to pop onto the Web for something. Maybe there's a house wiki and you want to check it, add to it, or whatever. Maybe you just thought of something to add to the grocery list. Maybe you've just watched a movie with friends and you want to find a local restaurant.

Using the wireless keyboard we thought was a good idea to set up the learning remote, we can input data easily enough. The Myth box is on the network, so maybe we run an Xsession somewhere else, or maybe Firefox on the Myth box through MythGame. Despite its name, you can use it to start other apps, not just games.

Podcasting

Copyright questions aside, there are several reasons you might want to do this. Let's say you're keeping clips of the best moments of your dog's life that you recorded for posterity, or maybe you have a webcam that takes ten-second clips every five minutes. Perhaps you have a little program to do with your web site. Whatever it might be, you can store the videos under MythVideo.

Program Metadata -> RSS or Atom Feed of Recorded Shows

Using program metadata, it's easy to script an RSS or Atom feed of all of the recorded shows and clips on the Myth box. With reference to podcasting, you could also script any necessary format changes.

With the Myth box connected to the Internet, you can check things while you're at the office or away somewhere. This could be more interesting in connection with the next idea.

Program Advice and Notification

You can set up MythTV to record time slots on a given channel once or regularly, but in order to do so, you need to know what you want to see. If you're not an avid TV watcher, reading through the schedules is liable to make your eyes glaze over in pretty quick order.

How about parsing the schedules with a script looking for certain keywords? Even better, what if there were web sites that covered your geographic area in some critical detail? You could then fetch the files with wget or curl and scan them for keywords, as well. You could run this as a cron job however frequently you find appropriate, scripting it so that the Myth box would email you on significant occasions.

After you have the keywords somewhere close to right, add to this by dipping into the MySQL back end and inserting the record information automatically. This could be especially useful if you're away a lot. You can check the RSS feed to see what your Myth box has been up to.

Alternately, getting slightly carried away, how about training a neural net by giving it information on what you really watched? Let it loose on the listings and the record information back end.

Auto-Trailers

Once you've put everything together, you might want a way of remotely scanning what you've recorded to see what the heck it's about. Grab a couple of random sections at the start, salt them away, and give them the podcasting treatment. Adding a delete button somewhere around there would also be handy.

mythtvosd

The contrib directory contains a tool called mythtvosd. This makes it easy to display any sort of message on the screen while MythTV runs. You could use it for notification of new email or to drive everyone watching crazy by scrolling new RSS feed stories across the screen.

MySQL Reports

By using different queries, you can order up reports any aspect of the MythTV back end. Maybe the available information is too basic for your needs and you'd like more on certain aspects. Suppose I'm absolutely nuts about a certain TV program named Stir Track, and I like it so much that I subscribe to one of those services that provides an ASCII summary for every episode of what every character says and does. I could use a variety of ways to set up extra fields to contain that information. Then I could search for which episodes contained, say, Captain Creak, exploding Christmas puddings, and Kora.

Digital pattern-searching (meaning, searching the TV program data itself) would be nice, but unless your Myth box is a supercomputer, the results won't be very timely. Still, that's something interesting to play with in the future.

Note: This article came about through discussions with chromatic, my editor at O'Reilly. He came up with the keyboard and wiki item, as well as the RSS feeds.

Thanks to IBM for the use of a ThinkCentre.

John Littler is chief gopher for Mstation.org.


Return to the Linux DevCenter.

Copyright © 2009 O'Reilly Media, Inc.