Home‎ > ‎Sergey's Projects‎ > ‎


The Idea

Recently I've decided to build an HTPC/DVR system. Mostly for DVR purposes, like recording animated movies for my kids.
I did some market research here in Israel and the conclusion was that HTPC is an exotic thing here. The price for a mid-level HTPC case was about 500 shekels (about $150), a better (well built, more beautiful) case cost about 1000 ILS without PSU. And most HTPC cases were huge, suitable for full size ATX motherboards, and had a size of an average Midi-ATX box - 18x40x45cm.


So, I've ordered from Amazon/US following stuff (thanks to Yuval for bringing it to Israel):
(all together $132.26)

And I also bought in local stores or found in my junk these parts:
Some techincal aspects of my configuration:
  • Moterboard - Based on new Intel's Atom CPU and 945GC chipset. It's small, cheap, power efficient, and Linux-compatible. The other options were: Various motherboards based on VIA CPUs and chipsets - they are more expensive, slow, but more power efficient; Intel D201GLY2 - has a faster CPU (although it's only clocked at 1.2 GHz, but it's based on Core architecture), uses SiS 662 chipset which is not working nicely with Linux.
  • TV Card - Has a built-in hardware MPEG-2 encoder, which is important because system uses relatively slow CPU. It comes with so called MCE remote and USB infrared reciver. Another option - Hauppauge WinTV-PVR-500, which has two tunners, and thus allows recording of two TV channels simulaneously. But the price is prohibitively high - 900 ILS
  • Case - small, quiet, and (IMHO) nice looking
  • HDD, DVD Writer, Memory - cheap, and just ok for this system.
The picture of more or less assembled system (click here for more photos):


As you may understand from hardware section, the system was build to run Linux OS together with some kind of DVR software.

So I selected following:
  • DVR software: MythTV
  • Linux distribution: Mythbuntu (which is basically Xubuntu + MythTV + some addons for MythTV configuration)
Generally speaking there are some several Linux distributions for HTPC usage (like KnoppMyth, MythDora, GeeXboX) and difference between them is not huge (except GeeXboX, which employs Freevo instead of MythTV). Here you can find a good (albeit a little bit outdated) review of such distributions.
More advanced users can try installing LinuxMCE, which includes MythTV, Asterisk (VoIP phone exchange), and a software for home automation.

Mythbuntu installation procedure is very simple, and differs from Xubuntu installation only by precense of three additonal installer's steps, which allow to configure remote control and TV card. There is also an "Advanced Installation" option, which is required for frontend-only system installation (I'll elaborate on MythTV architecture later on).
Instead of using automatic partitioning, which creates one large root partition and swap, I partitioned disk manually:
  • /dev/sda1 - / - ext3, 6 GB (the entire installation takes less than 2 GB...)
  • /dev/sda2 - /vol0 - jfs, 108 GB - for storing recordings. Some (smart) people claim that ext3 and reiserfs are very slow when deleting large files and pose heavy load on I/O, so they recommend to use JFS or XFS instead.
  • /dev/sda3 - swap - 3 GB - a little bit larger than size of RAM,  in case I'll use Suspend-to-Disk (aka Hibernate)
MythTV Configuration

<to be continued...>

Electronic Program Guide (EPG Configuration

MythTV normally uses XMLTV for obtaining EPG data. Unfortunately XMLTV project no longer provides a working grabber for Israel. So I used a windows program MegaEPG instead. Here are the steps for installation and configuration of MegaEPG:
  1. Install wine package: sudo apt-get install wine 
  2. Download MegaEPG
  3. Install MegaEPG: wine ~/Desktop/megaepg_setup.exe
  4. Configure MegaEPG. The MegaEPG configuration wizard will run after the installation completes. Go thru configuration wizard, select your favorite channels, and configure other options. If needed you may rerun the MegaEPG configuration later, using wine ~/.wine/drive_c/Program\ Files/MegaEPG/epgconfig.exe command.
  5. Fetch EPG data and update MythTV database (this will be automated later, but we'll do it manually now, to ensure that everything is working correctly):
    • wine ~/.wine/drive_c/Program\ Files/MegaEPG/megaepg.exe (this will download EPG data)
    • sudo su - mythtv
    • mythfilldatabase --file 1 /home/<username>/.wine/drive_c/Program\ Files/MegaEPG/xml/epgdata.xml (this will update the MythTV database, change <username> to your user name)
  6. Configure MythTV:
    • Run MythTV backend setup (from Start menu, or using mythtv-setup command)
    • Choose "Input connections" from the main menu
    • Choose your input connection (normally - tuner)
    • Press "Fetch channels from listings source" button. This will create channels in MythTV according to your MegaEPG setup.
    • Exit to the main menu, and go to the "Channel Editior". Configure channels that were added from MegaEPG data. You'll need to configure channel number and, optionally frequency (in case your frequency table is not standard).
    • Exit from MythTV backend setup.
  7. Automate everything.
    • Add the following entry to your crontab:
      • 35 6 * * * wine /home/<username>/.wine/drive_c/Program\ Files/MegaEPG/megaepg.exe >> /tmp/megaepg.log 2>&1
    • You can choose any other time instead of 6:35. Preferably computer should be up at that time, otherwise the new EPG won't be downloaded.
    • Add the following entry to mythtv's crontab (do sudo su - mythtv before calling crontab -e):
      • 5 7 * * * mythfilldatabase --file 1 /home/<username>/.wine/drive_c/Program\ Files/MegaEPG/xml/epgdata.xml >> /tmp/mythfilldatabase.log 2>&1
    • Again, you can change 7:05 to some another time. Keep in mind that this command should be running after the first command finishes. So allow enough time for the first command to download the EPG
    • Note 1: You can edit crontabs using crontab -e command. For some reason (user friendliness?), ubuntu sets nano (a clone of pico) as the default text editor, instead of vi, we all got used to :-). Make sure to disable long line wrapping in nano by pressing Alt-L key combination. Alternatively, you can set EDITOR variable to vi, or any other editor, you like.
    • Note 2: I prefer to save EPG update logs somewhere in /tmp, so I can check them in case something is not working as expected. You may prefer just to discard them. In this case redirect everything to /dev/null.