Rough Draft

Mac OS X support has not been completely worked out. If you are a Python programer on a Mac we would appreciate your help in solving a subroutine problem.

Requirements

  • Python, Ver 2.5 or higher - http://www.python.org/download/
    • It appears Ver 2.4 on a Mac does not handle subprocess correctly
    • 2.5.1 is installed by default on leopard 10.5)
  • FFmpeg - Recent Version
    • A precompiled compatible version is available - http://homepage.mac.com/bedelman/ffmpeg_Mac_8222.zip
    • If you are unable to get pyTivo to work properly with the ffmpeg version from above, please look at the Mac OS X installation procedure for additional options.

The ffmpeg version from above also needs lame, the above link did not work for me. I further compiled my own version of ffmpeg and it was a breeze with macports. Macports can be found in http://www.macports.org/. Install the macports package using the available dmg installer. You will also need XCode Tools installed. Version 2.4.0 installed with OS 10.4 will not compile ffmpeg properly. Download Xcode 2.5 or 3.0 from http://developer.apple.com/tools/xcode.

Leopard 10.5 includes XCode 3.0, which compiles the files with no problem. If you use the default install options, they should work fine, though macports recommends that you install X11, you do not actually need it to compile ffmpeg.

Further invoke Terminal(Found in /Applications/Utilities). In the unix prompt issue the following commands, I have given brief explanations in the command line. Please note, Macports may prompt you to install further dependencies in addition to the steps outlined below to get things started for it, please follow the output given. When you issue the sudo command, you will be prompted for a password, please enter the Administrator password of your Mac.

Make sure that your path includes the XCode tools.

bash$ sudo port selfupdate ## This updates the port to the latest version

bash$ sudo port install lame ## This command installs the latest version of lame.

bash$ sudo port install ffmpeg +lame +libogg +vorbis +theora +faac +faad +xvid +x264 +a52 +dts ## This is a slightly lengthy install, as it installs many other dependencies.

You should now have a functional copy of ffmpeg installed in /opt/local/bin directory.

Next, download and extract pyTivo from http://armooo.net/~armooo/pyTivo/downloads/. I placed this in the ~/ but it can be pretty much anywhere, like /Applications/

Edit the pyTivo.conf.dist file within the extracted folder to point to the ffmpeg which you installed in /usr/local/bin (downloaded) or /opt/local/bin (compiled). Be sure to setup the other options for your folders. See http://pytivo.armooo.net/wiki/ConfigurepyTivo for details.

Make sure that you copy or rename the pyTivo.conf.dist to pyTivo.conf when you have finished setting up your options. pyTivo looks for the .conf file without the .dist extension.

cd to the pyTivo directory.

Run in terminal using:

bash$ python pyTivo.py

Launch on Startup

To setup pyTivo to launch on startup, you can use launchd to launch the pyTivo file (on 10.4 or 10.5).

First, you must make the pyTivo.py file executable with the following command

bash$ chmod 777 pyTivo.py

More detailed instructions about creating launchd.plist files are available at http://developer.apple.com/macosx/launchd.html and http://www.macgeekery.com/tips/all_about_launchd_items_and_how_to_make_one_yourself

But the quick version is to

  • make a text file named "com.pyTivo.plist" (any text editor will do, like TextEdit? or SubEthaEdit?, vi or emacs)
  • Place the in the ~/Library/LaunchAgents folder and
  • Include the following code in the file (The code below assumes that pyTivo.py lives in /Applications/pyTivo. If you have installed it somewhere else, be sure to modify the path in the file below.)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>com.pyTivo</string>
	<key>Program</key>
	<string>/Applications/pyTivo/pyTivo.py</string>
	<key>ProgramArguments</key>
	<array>
		<string>/Applications/pyTivo/pyTivo.py</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
	<key>ServiceDescription</key>
	<string>Script to launch pyTivo server</string>
	<key>StandardErrorPath</key>
	<string>/Applications/pyTivo/AppError.log</string>
	<key>StandardOutPath</key>
	<string>/Applications/pyTivo/AppOut.log</string>
</dict>
</plist>

This should cause pyTivo to use launchd to launch automatically when you log into your account.

YMMV...