Wednesday, December 30, 2009

mythtv and mythvideo

A while ago my main hard drive died. Of course I had lots of backups, but nothing that I could boot so I reinstalled the OS. Since I was reinstalling I took the opportunity to install the latest ubuntu Karmic Koala. It all went well and I slowly rebuilt my machine setting things up how I like. First I got mail (postfix) and my own version of Mailman set up. Then it was on to the websites and then I took a break. These last three days I've been battling trying to get all my movies back to a viewable state. I was using XBMC before. I was hampered by some of the magic tricks I had learned in the past to get tv out working on my cheap radeon card. Here's what I learned:

  • you need to dpkg --purge gdm to stop any kind of X starting when the machine boots
  • you no longer need fglrx - don't even think of trying it, it's a red herring
  • you need to add vga=789 to /etc/default/grub:GRUB_CMDLINE_LINUX_DEFAULT to get /dev/fb0
  • you need to usermod -a -G audio $USER and then log out an back in to be able to use the soundcard
  • aplay -l lists all your soundcards
  • lspci and lsusb are really useful too
  • ONLY gnome desktop appears to activate the TV out properly, any other window manager just seems to hang startx
  •  /usr/bin/xrandr --output S-video --set load_detection 1 --size 800x600 is also needed after the X server has started (10 seconds) to make TV out happen
  • xbmc is  slow useless monkey and dead to me
  • mythtv and mythvideo are the new hotness and my new best friend
  • mythtv and mythvideo just work and are awesome
  • you can run mythfrontend over X11 for setting up metadata but not play movies like that
  • when getting metadata hit 'w' to get it
  • if that fails enter some of the title
  • you can easily download coverart from amazon and upload it scp $(\ls -t | head -1)  server:/var/lib/mythtv/coverart/uploaded/
  • I have /Movies be only directories and symlinks to the real data files living on lots of mounted volumes.
  • If you move a symlink around all your metadata is lost. see below
  • I am way too anal about getting all my metadata set up - at least good titles and coverart
  • You can access the database directly and mess around with values
  • backup your database!
  • mysqldump --defaults-file=~/lib/mysql/.my.cnf.mythtv --opt mythconverg  >mtv.$(date +%F).sql
  • I must find all my old mame roms for the myth mame plugin to play things!
  • it works with lirc but you need a ~/.lircrc and then you symlink to that from ~/.mythtv/
  • you can run dvdshrink under wine and it actually works!
So I had most of my metadata set up but my directory structure was very flat. Moving symlinks around would loose my metadata so I wrote a quick program to allow me to move links around and keep the database up to date. Of course this little script may totally bork YOUR setup, so be careful. This is super pre-alpha at this point, I might polish it up later.
Have a look at mythvideomv.py you probably want to click on 'raw file' to get the actual file.

Saturday, December 05, 2009

sftp in a chroot environment

You can ignore all the code below and just go read this page about setting up a chroot sftp server with the standard openssh, it's built right in now and awesome!



I publish to my blog using sftp. Since I use blogger I had to give them a username and password. I wanted to restrict my exposure so I made a little program that would only run the sftp-server and run it in a chrooted environment, I then set this as the shell for the account. I'm not totally sure it's any more secure, but it makes me feel better.

Getting the files I needed to run a program in a chroot environment was harder than expected, ldd didn't give me all the info I needed, but it was a good start.

Check out the source code. with a README file and even an example of what files you'll need. At least in  Ubuntu 9.10.