Freevo

- User Documentation

# MacOSX

### Overview

Since a lot of people have been interested in using the Mac mini and Freevo as an HTPC device, I thought that I would explain the steps I took to get most of the things working. This is still a work in progress for me because I do not have a TV capture card yet, but I have successfully gotten movie watching, music listening, and picture viewing working on Mac OS 10.4.2.

### Installing Dependencies

Unfortunately, Freevo has a lot of dependencies. The good thing, however, is that most of them are available through Darwin Ports. The first thing you need to do is download and install Darwin Ports on your system. It's a simple package installer, so it shouldn't be a problem for most people.

Secondly, open up a terminal window (/Applications/Utilities/Terminal) and install all the dependencies (one at a time). This will take a while! It will download, compile, and install all programs and their own dependencies as well.

    # port install smpeg
    # port install libexif
    # port install libdvdread
    # port install libdvdcss
    # port install py-pyobjc
    # port install py-game
    # port install expat
    # port install py-xml
    # port install py-pil
    # port install py-twistedweb
    # port install py-mx
    # port install xine-lib
    # port install MPlayer +real +quicktime +sdl +freetype +lzo +vorbis +mencoder

When I installed all of those ports, I did not receive any errors. If you do, then you should look at the Darwin Ports page for troubleshooting information.

Another way to fulfill these dependencies is to use Fink. The dependencies can be found, al least, in the unstable distribution (this is what I used, maybe stable will suffice some day). For further info about Fink and unstable packages see this.

    # fink install smpeg
    # fink install libexif
    # fink install libdvdread4
    # fink install pyobjc-py23
    # fink install pygame-py23
    # fink install pyxml-py23
    # fink install pil-py23
    # fink install twisted-py23
    # fink install python-mx-py23
    # fink install libxine
    # fink install mplayer

There are a couple of dependencies that are not available as ports yet (at the time of this writing), so you'll need to install those on your own. The first one is lsdvd which you can download from http://sourceforge.net/project/showfiles.php?group_id=63864&package_id=61147. Once you have that downloaded, you can configure and install it using the following commands:

    # tar -tf lsdvd-0.15.tar
    # cd lsdvd-0.15/
    # env LDFLAGS=-L/opt/local/lib CPPFLAGS=-I/opt/local/include ./configure --prefix=/opt/local
    # make
    # make install

The LDFLAGS and CPPFLAGS tell lsdvd where to find libdvdread and libdvdcss which we installed earlier.

Next you need to install mmpython. You can download it from the freevo website here: http://sourceforge.net/project/showfiles.php?group_id=75590&package_id=76071. As of this writing, the `mmpython-0.4.9/disc/cdrommodule.c` file does not support Mac OS X so you will not be able to compile it. Please download the file with Mac OS X support from here: http://cddb-py.sourceforge.net/CDDB/unix/cdrommodule.c and replace the one in `mmpython-0.4.9/disc/` with the new one. Then do the usual install method:

    # env LDFLAGS=-L/opt/local/lib CFLAGS=-I/opt/local/include /opt/local/bin/python setup.py install

or for Fink you may want to run:

    # sudo /sw/bin/python2.3 setup.py install

That should build and install just fine. And that's it! That's all you need to get freevo working! There are two dependencies that I have not tried installing yet: lirc and aumix. I don't have a remote control yet, so I'm not even going to attempt installing lirc until I do. I'm currently looking for a way to provide audio mixer support to Freevo with the native Mac OS X libraries/commands instead of aumix. For right now, use the volume settings on your Mac keyboard to control that.

### Installing Freevo

Again, this installation of Freevo will not use any of the TV modules because I don't have a capture card and can't test it yet. Believe me, I'm working on it though! Once you've downloaded and unzipped Freevo (I'm using version 1.5.3), you'll need to run the initial configuration and change some settings. First of all, edit the freevo file itself and change the first line from `#!/usr/bin/env python` to `#!/opt/local/bin/python`. This will ensure that you're using the Darwin Ports installation of Python (which has all of the dependencies that we installed).

Make sure you've added `/opt/local/bin` to your path and then and run `./freevo setup`. That will create a new directory in your home directory and put `freevo.conf` and `local_config.py` files for you to edit (if `local_conf.py` is missing, run `cp local_conf.py.example ~/.freevo/local_conf.py` in the freevo source directory). My initial `~/.freevo/freevo.conf` looks like this:

    chanlist = us-cable
    display = x11
    flac = /opt/local/bin/flac
    geometry = 800x600
    jpegtran = /opt/local/bin/jpegtran
    lame = /opt/local/bin/lame
    lsdvd = /opt/local/bin/lsdvd
    mencoder = /opt/local/bin/mencoder
    mplayer = /opt/local/bin/mplayer
    renice = /usr/bin/renice
    tv = ntsc
    version = 2.1

Great! No dependency errors! Now there's one thing we need to change. In order to actually see the display, you want to change the `display` variable from `x11` to `quartz`. My working `~/.freevo/freevo.conf` looks like this:

    chanlist = us-cable
    display = quartz
    flac = /opt/local/bin/flac
    geometry = 800x600
    jpegtran = /opt/local/bin/jpegtran
    lsdvd = /opt/local/bin/lsdvd
    mencoder = /opt/local/bin/mencoder
    mplayer = /opt/local/bin/mplayer
    renice = /usr/bin/renice
    tv = ntsc
    version = 2.1

Next, you need to add a few things in the `~/.freevo/local_conf.py` to make it work. Somewhere around line 613 (in the "MPlayer settings" section) add the following line: `MPLAYER_VERSION = '1.0'`. Right below that, there's a setting called `MPLAYER_AO_DEV`. Add a new line below the one show there and add the following setting: `MPLAYER_AO_DEV = 'macosx'`. Here's a snippet from the MPlayer settings section of my working `~/.freevo/local_conf.py` file:

    # ======================================================================
    # MPlayer settings:
    # ======================================================================

    MPLAYER_VERSION = '1.0'

    # MPLAYER_AO_DEV       = 'oss:/dev/dsp'  # e.g.: oss,sdl,alsa, see mplayer docs
    MPLAYER_AO_DEV       = 'macosx'

    # MPLAYER_VO_DEV_OPTS  = ''              # e.g.: ':some_var=vcal'

Also, to remove all references to the TV portion of Freevo (because I haven't gotten it working yet), you'll need to add the following lines to the `~/.freevo/local_conf.py` file around line 169 in the "Plugins" section:

    plugin.remove('tv')
    plugin.remove('tv.generic_record')
    plugin.remove('tv.manual_record')
    plugin.remove('tv.scheduled_recordings')
    plugin.remove('tv.view_favorites')
    plugin.remove('tv.mplayer')

That's all you need to do for configuration! However, if Darwin Ports installed version 1.7.1 of pygame (which is the current version as of this writing), then you're going to have some issues with Freevo giving an error about "Surfaces must not be locked during blit". After reading this email: http://aspn.activestate.com/ASPN/Mail/Message/pygame-users/2811112, it mentions how to work around this error and that it'll be fixed in the next version. As a work around, you'll need to edit the `freevo-1.5.3/src/skins/main/screen.py` file and make the following change after line 169:

    168:            for x0, y0, x1, y1 in update_area:
    169:                self.s_content.blit(self.s_bg, (x0, y0), (x0, y0, x1-x0, y1-y0))
    170:                self.s_alpha.unlock()  # add this line
    171:                self.s_alpha.unlock()  # add this line
    172:                self.s_content.blit(self.s_alpha, (x0, y0), (x0, y0, x1-x0, y1-y0))

Whew! Now that all of that is done, you can go ahead and start freevo! If freevo fails due to a missing utils module you may need to add `export PYTHONHOME=/sw` to your `~/.bashrc` if you are using Fink.

### Still To Do

- Figure out why the Shutdown command doesn't work without a remote

- Make MPlayer start fullscreen from the beginning so that it doesn't leave a green block in the upper left hand corner

- Update Freevo so that Mac OS X can have full screen mode as well (it's very easy since pygame supports it already)

- Get a TV capture card and work on that

- Get a remote and work on getting LIRC to work

- Figure out an alternative to the aumix application so that volume control works

### Things I'd like to Add

- iPhoto integration

- iTunes integration

- Make slideshows an option on every picture folder (meaning they're dynamically generated, not based on an FXD or SSR file)

last edited 2005-10-12 13:29:33 by MagerValp
current version: http://freevo.sourceforge.net/cgi-bin/doc/MacOSX