MythTV: Transcode to XviD and Add to Library

Before starting with MythTV, I already had a library of several TV series that I've been serving to an Xbox running XBMC over Samba, so I wanted the ability to configure certain shows to automatically be transcoded to XviD and moved into my library directory structure (below) and named with season number, episode number, and episode name. MythTV doesn't get the season and episode number from TV listings (at least not through Schedules Direct), so I found a Perl module to query The TVDB and cache results for me. I have some ideas on ways to improve it, but for now it works well enough.