Home



Email

Last Update: 01/21/2011


Blog

 
MythTV

This is my page dedicated to all thing related to MythTV. I'll try to post any patches or updates here that I have created that might be useful to others. Everything I post here is free to use as you like (licensed under the GPL). If you make any improvements or have any suggestions, please drop me a line and met me know. You can use the contact information on the sidebar.


My MythTV Story

I first installed MythTV back in the Summer of 2005. It's hard to believe it was that long ago when I took the plunge. I actually played around with the idea of building a media PC for over a year before I finally broke down and did it. I tried a bunch of other different media PC front-ends (Windows Media Center, SnapStream Beyond TV, SageTV, GB-PVR, and probably a few others). I never tried Freevo, because I tried MythTV first and fell in love. Luckily, at the time I had already been using Linux for about 5 years, so it wasn't too difficult to get things working. For those that are curious, here are the specs for the system I built. A few pictures of the installation process are available.

  • Abit NV8 nForce4 motherboard
  • AMD Sempron 64 3000+ (Palermo)
  • Antec Overture Piano Black ATX Desktop case (380W power supply)
  • Sapphire 588L Radeon X600 Pro 128MB PCIe video card
  • Hauppauge WinTV-PVR 150MCE
  • 1GB RAM (2x512MB Kingston ValueRam)
  • Maxtor DiamondMax 10 200GB SATA 7200 RPM hard drive
  • Toshiba DVD-R/RW/DL optical drive
  • Logitech diNovo Edge keyboard (purchased in 2009)

I've been toying around recently about upgrading the box a little bit (mainly going to a dual- or quad-core processor to keep simultaneous heavy task loads from affecting each other). For the most part, the computer works very well. Video playback works without skipping and you can easily record something and watch something else at the same time without causing problems. As you can tell by the card, I don't record HD content (I don't yet have an HDTV and implementing HD content on an HTPC is just so poorly supported that it would be very difficult anyway).


Patches and Programs

Below you will find some of the patches I've made to MythTV to add some things suited to my taste.

MythTV and MAME

This is the same script available on my blog, so I'll just copy and paste the info here.

If you are like me and run MythTV along with some emulators (in this case MAME), you'll notice that by default, the database will import the ROMs using the filename as the name that is shown in the menu. This can be a little annoying, since MAME games are only 8 characters long. In order to easily get around this, I wrote a script that will actually pull out the game information from the XML file generated by MAME and update the database accordingly. In addition to the game name, it will also attempt to extract the year, genre, and version which it was added.

The script has comments in the first section that explains the usage. You may need to change a few lines here and there to match your configuration, but it should be pretty self explanatory. However, you are required to have the Config::Tiny, DBI, and XML::Parser perl libraries installed. I won't go into detail on how to do that unless someone really needs it (Google is your friend).

Download the MAME Description import script

MythVodka

NOTE: MythVodka is no longer updated, so it will not work with current versions of MythTV. There is also built-in support now for Hulu (although I've had trouble getting it to cleanly work), so MythVodka is mostly obsolete.

I first found this wonderful plugin around mid-February 2009... right after the Hulu integration was broken. At the same time I learned how it simply took the programs used by other programs, like XBMC, and packaged them into a nice little plugin. I waited a few weeks and eventually people figured out how to get the Hulu integration working again. I installed the plugin and tried it out. I was finally able to watch Hulu programs on my Media PC without needing to tab over to a browser and fumble around with the mouse and keyboard!.

The plugin worked, but I didn't really like the way some of the things worked in it, so I decided to make some tweaks of my own. I only use the plugin for Hulu, so this is what they focus on. They are found below.

gethulu.pl - 1.0.2

At first I was just making little tweaks to the gethulu.pl script, but eventually I just rewrote the whole thing because it was a little sloppy. Here is a list of the changes I made.

  • Added support for command line options. Run with --help to see descriptions of them all
  • Added ability to skip Hulu Movies or Hulu TV programs
  • By default, the script now prints to stdout. You can print to a file using the -o option
  • Added caching of stream info. Since the information about an individual stream (movie, TV episode, etc) rarely changes, it doesn't need to be downloaded everytime. This makes the XML generation process go from around one hour to around five minutes (after the files are initially cached)!
  • Redid the retrieval of the TV episodes. The retrieval method used by the previous version was prone to error and sometimes grabbed completely incorrect streams. The scraper now looks for the VideoSlider object and uses that to determine which streams are available
  • Added ability to retrieve additional streams (clips, webisodes, etc) for each feeds using the --additional command line
  • Parses the individual stream data using the JSON module instead of regular expressions. The simple regular expressions that were being used were prone to error. Since the stream info returned was actually in JSON format, it just makes more sense to parse it as such.
  • Encode everything as UTF-8. Hopefully this will avoid problems with weird characters being put in the stream info in the database.
  • The original script stripped out any & characters (I assume to make it less likely to generate an invalid XML file). However, this led to some names being funky, so I removed that code.
  • I altered the text format for some of the XML notes to my liking. I also added some new nodes to the XML output:

    AirDate - The original air date
    RunningTime - The length of the stream (in seconds)
    Type - The type of stream (full movie, full episode, clip, excerpt, etc)

  • Other little tweaks here any there, but I don't think any of them were major.

This script requires the following Perl modules. For reference, I've listed the Debian Lenny package that installs the module:

  • Encode - perl-modules
  • HTML::Entities - libhtml-parser-perl
  • JSON - libjson-perl
  • LWP::Simple - libwww-perl
  • XML::DOM - libxml-dom-perl

Download my gethulu.pl script

Version History:

1.0.2
- Hulu updated the CSS class name used to find the movies and episodes (again)
- Try to avoid bombing out when encountering JSON parsing problems
1.0.1
- Hulu updated the CSS class name used to find the movies and episodes
1.0.0
- Initial release

External Data Update for MythVodka

One thing I still don't quite understand is why MythVodka tries to actually parse the data from the XML file and put it in the database on demand. The first time you start the plugin, if the data has not been updated today, it will run the code to do so. This type of task is so much better suited to be run as a cron job after the XML creation, so I extracted the concept from the MythVodka source code and created a stand-alone Perl script to do it. This allows you to start up MythVodka for the first time each day with minimal delay. I also needed to fix a few bugs in the way the data was parsed and cached.

Here is a list of the changes I made.

  • Cache the images with a different naming scheme, because the default way of naming the files causes name collisions.
  • Added ability to exclude undesired feeds by name

This script requires the following Perl modules. For reference, I've listed the Debian Lenny package that installs the module:

  • Date::Format - libtimedate-perl
  • DBI - libdbi-perl
  • Encode - perl-modules
  • HTML::Entities - libhtml-parser-perl
  • LWP::Simple - libwww-perl
  • XML::Parser - libxml-parser-perl

Download coming soon! I still need to clean up the script a bit.