Monday, August 27, 2007

MythTV Upgraded to R5F1 - now using SchedulesDirect

As I wrote in my last blog post, I've now upgraded my KnoppMyth box to the latest release, R5F1. What a difference five revisions makes! :-P

In the hopes of preserving all the programming that we'd recorded on the prior install, I chose to upgrade, rather than reinstall. That proved to be only partially successful. The raw files still live in /myth/tv, but MythTV no longer knows anything about them. When I have time, I'll try to figure out how to move the videos so that MythVideo will recognize them.

I also took the effort to migrate my listing service from Zap2IT to SchedulesDirect. The project leader for KnoppMyth posted the procedure on the phpBB forum.

Signing up for the service was no problem, and the manual upgrade procedure went fairly straightforward. The only two hiccups I have are with the channels recognized by MythTV for the input source. After doing the upgrade and setting up MythTV to use my SchedulesDirect account, the channel scan failed to eliminate the channels that I don't have. The other problem was that the names for the channels are all listed as "Adding Channel". Both problems are being encountered by others, per the postings to the forum.

If I find any solutions besides just manually correcting, I'll post it.

Saturday, August 25, 2007

Eh, it was time to upgrade MythTV anyway...

Okay, so like I posted last week, I'm interested in figuring out how to export videos from MythTV to my 5G iPod. Also like I last posted, Google lead me there and it wasn't very difficult after all is said and done. The good news is that I was right. Using the following ffmpeg command, I was easily able to take the default format that MythTV records in and export it to a format that my iPod could read.
  ffmpeg -vcodec xvid -b 300 -qmin 3 -qmax 5 \
-bufsize 4096 -g 300 -acodec aac -ab 96
-i /myth/tv/1011_20060820230000.mpg -s 320x240 -aspect 4:3 \

All I had to do was import the resulting file in iTunes & synchronize the device. Works like a champ.

The bad news is that I killed my MythTV install in the process of doing so.

It wasn't the above command that did the damage, it was my attempts to mess with Myth2ipod. I strongly recommend that any Knoppmyth user avoid it at all cost, if their system is newer than March 2006.

It really is my own fault. I should have taken a moment to look and see that the project hadn't been updated since March 2006. By comparison, I (was) running Knoppmyth R5C7, which was released May 2006. The Myth2ipod perl script is harmless enough, but it was the instructions for upgrading ffmpeg that did me in. Here's what the start of that looked like:
root@mythtv:~# apt-get install ffmpeg
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be installed:
libasound2 libasound2-dev libavcodec0d libavformat0d libc6 libc6-dev
libdc1394-13 libdirectfb-0.9-25 libgsm1 libogg-dev libogg0 libraw1394-8
libsdl1.2-dev libsdl1.2debian libsdl1.2debian-alsa libsysfs2 libvorbis-dev
libvorbis0a libvorbisenc2 libvorbisfile3 locales tzdata
Suggested packages:
libasound2-plugins libasound2-doc glibc-doc manpages-dev libraw1394-doc
Recommended packages:
libaa1-dev libdirectfb-dev libcucul-dev
The following packages will be REMOVED:
alsa-headers base-config initrd-tools libsdl1.2debian-oss
The following NEW packages will be installed:
libavcodec0d libavformat0d libdc1394-13 libdirectfb-0.9-25 libgsm1
libraw1394-8 libsdl1.2debian-alsa libsysfs2 tzdata
The following packages will be upgraded:
ffmpeg libasound2 libasound2-dev libc6 libc6-dev libogg-dev libogg0
libsdl1.2-dev libsdl1.2debian libvorbis-dev libvorbis0a libvorbisenc2
libvorbisfile3 locales
14 upgraded, 9 newly installed, 4 to remove and 633 not upgraded.
Need to get 17.3MB of archives.
After unpacking 4898kB disk space will be freed.
Do you want to continue? [Y/n] y

I had a bad feeling about it when I saw so many packages that were being replaced. In the end, when I went to reboot to validate nothing serious was broken, MythTV wouldn't go past the boot splash screen. (I can't even find a way to get the raw output from the boot, the box locks up just after the LILO screen disappears).

All the same, Knoppmyth's latest release is R5F7, published May 2007. So, I'll just rebuild with that (hopefully I can save all the TV shows I've recorded).

After I get MythTV up and running again, I'll hack that myth2ipod script and make it work with the modern version. I'll then post the results, after I get it cleanly done.

Sunday, August 19, 2007


So as I count down to my iPhone1, I try and make do as best I can with my iPod. One thing I have yet to do is figure out how to convert MythTV default format AVI files to the iPod video format I've don't that once before, but I didn't really figure out a quick & easy way to do it repeatably. Thirty minutes experimenting with transcode and a little research on Google and I'll have it.

In the meanwhile, I figured it'd be quick and easy to put some eBooks on the iPod. Sure enough, when I look on my iPod in the "Extras" menu, I see a "Notes" section, with the following text:
To view text files here, enable iPod for disk use, then drag text files to the Notes folder on iPod. See the iPod Features Guide or go to for more information.

Simple enough.

Connecting my iPod to my PC, I activated "Enable disk use" for the device. It then appeared in my explorer as E: drive, with a "Notes" folder under the root. Doing some research, I learned that the iPod will allow up to 1000 files, each with up to 4012 characters. That's a fair bit of text, though I would have expected more, given the disk space on the gadget. But then, I guess Apple is all about multimedia these days (sound and video, not text).

Given that the Gutenberg Project has lots of great books, there's lots of free content to choose from. So, I wrote up a simple Perl script to hack up a large text file into smaller pieces so it could fit into the iPod's inane requirements.

Here's what I came up with.


$filename = $ARGV[0];
open(INFILE, "$filename");
undef $/;
$content = ;
close INFILE;
$ipod_max = 4012;
$ipod_max -= 17; #Title tags
$ipod_max -= 34; #tail link tags
$ipod_max -= length $filename;
$ipod_max -= 7;

print "Slurped ". length($content) . "\n";
$chapter = 'CHAPTER ';
#break it up by chapters
@chapters = split(/$chapter/, $content);
print "Found " . $#chapters . " chapters.\n";

$count = "000";
foreach $chapter (@chapters)
print "Working on chapter $count, ";
my $part = "001";
my $outfile = $filename;
$outfile =~ s/\.txt/$count\.$part/;
open (OUTFILE, ">$outfile");
$content = "CHAPTER ";
@chapter_by_lines = split("\n", $chapter);
$chapter_length = length($chapter);
print "found ". $#chapter_by_lines . " lines ($chapter_length bytes)\n";
foreach $line (@chapter_by_lines)
$len_content = length $content;
$len_line = length $line;
$len_total = $len_content + $len_line;
if ($len_total > $ipod_max)
$outfile =~ s/[0-9]{3}$/$part/;
print OUTFILE $content;
close OUTFILE;
$content = "";
open(OUTFILE, ">$outfile");
if ($line =~ /^$/)
$content .= "<b><p>$line";
} else {
$content .= "$line";
($chapter) = $content =~ /(CHAPTER \S+)/;
print "Writing to $outfile...\n";
print OUTFILE $content;
print "done.\n";
close OUTFILE;
$content = "";

Running the script on Huck Finn from the Gutenberg Project looks like this:
earnoth@twinstar[07:32 PM|508]$ bin/ books/huckfinn.txt 
Slurped 597298
Found 43 chapters.
Working on chapter 000, found 72 lines (1748 bytes)
Writing to books/huckfinn000.001...
Working on chapter 001, found 116 lines (7207 bytes)
Writing to books/huckfinn001.002...
Working on chapter 002, found 234 lines (12337 bytes)
Writing to books/huckfinn002.004...
Working on chapter 043, found 433 lines (22487 bytes)
Writing to books/huckfinn043.006...

The result is 172 text files, all less than 4012 characters long (avg 3400). A nice fit on the iPod.

Monday, August 6, 2007

New Brew - American Cream Ale

Yesterday I brewed a new beer, an EZbrew American Cream Ale. It's a pretty simple brew, using both liquid and solid malt extract, along with some cluster hops. The only interesting part is the lactose that gets added during bottling (making the cream part of the ale).

This morning the fermentation started off strong, bubbling well. This afternoon it's tapered off a bit. I'm concerned the higher temperatures may be impacting it. My pantry seems to run a bit warm in the summer.

I'm writing it up in my Document Trove.

Sunday, August 5, 2007

New Document Trove online

Previously I attempted to set up documentation for my various geek efforts. It was modestly successful for what it was, I received comments from a few people that they found the write ups useful. Unfortunately, MediaWiki proved to be a very high-maintenance and difficult to use wiki solution.

So now that I've finished migrating my website from one hosting company to another (more on that later) I've set about recreating my Document Trove. Unfortunately, the database that I had been running on was corrupted, so I lost the two-dozen articles I'd posted. It's partly my own fault, however, as I hadn't backed up the database in a long time. However, the former hosting provider was no help (again, more on that later).

Fortunately, I was able to salvage a few postings. Thank heavens for Google's cache. ;-)

My new Document Trove is running DokuWiki. I'm very pleased with it. It follows all of the standard Wiki conventions, and doesn't require a database backend. Very slick.