Why is this interesting? Because, to the extent possible, I'm doing all this using only free, open-source software. My story begins with a secondhand PC, and a fresh installation of Ubuntu 9.04, a free Linux distribution.
The best-known Linux DVR software is MythTV, and I could have started with Mythbuntu. But the instant I saw MySQL was MythTV's first prerequisite, I knew this wasn't the approach I wanted to take. There's nothing wrong with an appliance if it does what you want; my fear was that I'd run into some complication that would end up frustrating me, and it seemed more productive to start with something lightweight.
My first challenge was to get the USB Tuner Stick to work at all. Since the one I have is XC3028-based, the driver's already included with Ubuntu, but I had to follow the procedure documented on www.linuxtv.org to obtain its firmware, which needed to be added to /lib/firmware/.
Like a digital television receiver or converter box, a PC tuner isn't useful until you've scanned local stations. The scan utility is part of the dvb-apps package. Now things start to get confusing. First of all, dvb-apps contains two scanning applications, scan and dvbscan. Even though the documentation would seem to suggest using the latter, you actually want the former. Second, scan requires an initial tuning data file, and the samples provided in /usr/share/dvb/atsc/ are suboptimal. I suggest making a copy of us-ATSC-center-frequencies-8VSB and paring it down. TV channels 2-6 are rarely used in the U.S. for digital television, so you should be able to delete everything below 177 MHz. Subsequent to the national DTV transition, channels 52-69 are gone, so you can definitely get rid of anything above 695 MHz. Channel 37 is reserved for radio astronomy use, so you might as well remove 611 MHz right now as well.
Scanning unused channels is a waste of time, so you can trim the list further. Sites like www.rabbitears.info list the stations actually operating in various markets. Locate the digital (or transmitter) channels (not the display or virtual channels), and look up the frequency in a table such as this one on the FCC's web site. For example, TV channel 44 ranges from 650-656 MHz. This is centered on 653 MHz, so your initial tuning data file would contain a corresponding line like this:
A 653028615 8VSB
Do this for each channel. Once you have a list of likely candidates, you're ready to scan.
scan -5 -t 1 initial-tuning-data-file >channels.conf 2>channels.errs
The scan may take several minutes to complete. If you leave off the -5 it will go faster, but you might miss some of the weaker signals.
When it finishes, you'll have a channels.conf, but it will probably need some hand-tweaking.
I like to reorder things by virtual channel, which you can list with:
fgrep running channels.errs|sort -t: -k2n -k3n
Then, make sure there aren't any "gremlins" in the file:
cat -v channels.conf|diff -n - channels.conf|fgrep :
Any lines that show up will need to be edited to remove the offending character(s).
channels.conf consists of lines that look like:
There are six fields separated by colons. The first is the channel name. You'll recognize the second as the center frequency. Don't worry about the others right now. Go ahead and rename things to your liking; the scan (unfortunately) prefers "extended" names which aren't always reasonable or unique.
When you have something you're happy with, move it to its permanent home:
mv channels.conf ~/.azap
(You can delete the channels.errs file)
One of the easiest ways to watch live TV is to use the me-tv application. The version released with Ubuntu 9.04 isn't the latest, but installing that ensures all its dependencies are satisfied. Then go to its home page to find the latest version. You should be able to upgrade using a command like:
sudo gdebi me-tv_1.0.0-0ubuntu1~jaunty1_i386.deb
Me TV appears on the Applications menu under the Sound & Video category. The first time you run it, it will bring up a Scan Wizard. You'll want to choose Import a channels.conf, select .azap/channels.conf, click Next, click Add, then click OK. Select a channel, and you should see video within a few seconds. Pless the V key (or right-click on the video) to cycle through the various displays. F toggles full-screen mode. Ctrl-Q exits.