HTPC For The Rest Of Us

Bec and I have an old, beer-stained laptop that we use as our media player.  It's a tank and the power button is broken, which can make things a bit tricky.  But all in all, it works.

I also have an ATI Remote Wonder that we use with mplayer.  So the only thing left is some sort of navigable menu system so I don't have to get off my lazy ass to pick a new show each time.

We used to use Geexbox, which is a great little home theatre PC (HTPC) setup.  But Geexbox is a standalone system that boots off a CD into its own minimal flavour of Linux.  Problem is that this tank of a laptop doesn't have built-in wireless, and the USB wifi adapter we're using requires a windows driver (via ndiswrapper) to work properly, and Geexbox doesn't have this, to the best of my knowledge.

So I installed Arch on the machine, got everything working, and started looking at other HTPC software.  I tried Freevo and Elisa.  They needed more setup and configuration than the plug-and-play Geexbox I was used to.  I also tried a few smaller pieces of software that did the bare essential - just show a directory of files and let the user select one to watch.  They all kinda worked, but not really.  I think they were proof-of-concepts that never really got finished.

After the 19th segfault of one, I decided to write my own little guy.  Hadn't used python in awhile, so it would be good for me.

So here it is, 188 lines with comments.  It does only the basic file navigation stuff, using either the keyboard or an LIRC-compatible remote control.  Once a file is selected, everything else is handled by mplayer.

If you want to use a remote, then you'll have to setup your LIRC configuration file to map your remote buttons to the correct functions in the HTPC menu.  Here's an excerpt from my ~/.lircrc file:

begin
  button = UP
  prog = pyhtpc
  config = UP
  repeat = 5
end
begin
  button = DOWN
  prog = pyhtpc
  config = DOWN
  repeat = 5
end
begin
  button = LEFT
  prog = pyhtpc
  config = BACK
end
begin
  button = RIGHT
  prog = pyhtpc
  config = SELECT
end
begin
  button = OK
  prog = pyhtpc
  config = SELECT
end
begin
  button = POWER
  prog = pyhtpc
  config = QUIT
end

There will be bugs.  If you find some, please fix them so I can take credit.

2 Responses

  1. James Rayner Says:
    October 28, 2008 at 5:28 am -0700

    Very cool.

    I was going to setup my box as a kinda arcade/music/media box after exams and this will make an awesome foundation. I'll probably add mpd support for music, but apart from that I'll keep it pretty simple.
  2. Brian Mikkelsen Says:
    October 29, 2008 at 1:30 pm -0700

    Cool, just what i've been looking for. to mold into my own preferences without looking through several thousands lines of code.

    heres a small bugfix that you can take credit for:
    I have a lot of files with quotation marks in them, this makes it look nicer:
    escape_chars = [' ', '&', '(', ')','\'']





Add Your Comment