Installing pyTivo on Linkstation Live

What is pyTivo and why put it on a Linkstation Live or Pro
pyTivo is a server package running under Python to serve multi-media content to Tivo DVRs. It imitates another networked Tivo on your network and allows you to serve video, photos or music to your Tivo. pyTivo will run on any platform that has Python installed. The purpose of this article is to outline the steps needed to install pyTivo on your Linkstation.

Opening The Linksation
The first step is to open up the Linkstation with third party firmware or ACP Commander (http://downloads.nas-central.org/TOOLS/ALL_LS_KB_ARM9/ACP_COMMANDER/acp_commander.jar). Once your box is open follow the steps in this article: http://buffalo.nas-central.org/index.php/Open_Stock_Firmware to secure your access to the telnet capabilities after startup. It is not entirely necessary to do all the steps on that page (ie: you may not need or want to enable SSH) but for purposes discussed later, you will need to install the enhanced version of the "ps" command described in the article here: http://buffalo.nas-central.org/index.php/Open_Stock_Firmware#Full_version_of_ps. You will also need the add-on files to be installed as well: http://buffalo.nas-central.org/index.php/Open_Stock_Firmware#Addon_Files.

Additionally, with the stock firmware only root has permissions for /dev/null. We need to open that up. Enter chmod 0666 /dev/null

Install Itsy Package Management System
There is a Python interpreter for the ARM9 processor available at http://downloads.buffalo.nas-central.org/Uploads/OldUploads/armstation/ and that could probably be used but there's a somewhat easier way to install Python and some other packages needed for pyTivo to run properly. The way I did this was by using ipkg. To get ipkg follow these steps:

From your telnet session on the box enter the following commands: mkdir /mnt/disk1/tmp

cd /mnt/disk1/tmp

wget http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/stable/lspro-bootstrap_1.2-5_arm.xsh

sh lspro-bootstrap_1.2-5_arm.xsh

Use ipkg to install a python interpreter
Now, to install python enter: ipkg install python Python 2.5 is the default version. You can get a full listing of packages by entering ipkg list

If you get an error, you may need to update ipkg first. Enter:

ipkg update

Installing Python will take several minutes. The box may not appear to be doing anything but just let it run.

Install ffmpeg
Once, Python is installed, you will need to install ffmpeg. This is also available via ipkg: ipkg install ffmpeg FFMPEG is used to transcode files to the MPEG-2 format the Tivo can use

As of time of publication, the author has been unsuccessful in using FFMPEG to transcode formats outside of MPEG-2 on the Linkstation with pyTivo. From other reports from users, attempts to transcode video on a Linkstation Live or Pro is Not recommended, the processor is not up to the task. However, ffmpeg is still used by pyTivo for various utility functions and is needed even to serve MPEG-2 video.

Install pyTivo
The first thing you'll need to do for installing pyTivo is to create a directory on the Linkstation where you want pyTivo to be stored. For example, say you have a share called "Media" and you want pyTivo to be stored in that share. You would then create a directory in /mnt/disk1/Media/pyTivo. Note, that you can install pyTivo on any path you want - not just what is specified here. You may wish to create this directory by accessing the shared partition from your desktop computer. It will be necessary to work from the desktop when installing pyTivo.

Next, you will need to install the pyTivo files. pyTivo can be found at:. Note that there are several different "forks" or variations on pyTivo. They are all just about the same. For our purposes, let's choose wmcbrine's fork:. Choose the most recent snapshot and download it to your desktop. The downloaded file will be a gzip'd tarball. You will need to unpack it on your desktop. For some reason, the tar command on the Linkstation does not like the way these files are packed. So to save yourself some grief, do everything in this step on your desktop.

Once you have the pyTivo files extracted, it will likely be in a folder called "wgw." Copy the contents of this folder into the pyTivo directory that you created a few moments ago.

In order to start pyTivo, you will first need to rename the pyTivo.conf.dist file to pyTiv.conf. It is not necessary to do further editing of the config file now. If you are an experience pyTivo user and don't mind editing the file by hand, then open it in your favorite text editor (this can be done either on the desktop or in vi on the Linkstation via Telnet).

Now you'll want to verify that pyTivo is working. Via Telnet, navigate to the Enter the following command:

python pyTivo

You should see the console output from pyTivo displayed on your screen and if all is working well, you should not see any errors.

Now, back on your desktop go to pyTivo's internal web page and edit your configuration. The web page is at port 9032 of your Linkstation's IP address. For example:.

The configurations for pyTivo are beyond the scope of this Wiki. Please refer to for further instructions and information on pyTivo configuration.

Once you have configured pyTivo, verify that it is showing up on your Tivo's Now Playing list. You should see the shared locations you set up in your Now Playing list.

The next step will be to configure pyTivo to run as a daemon in the background as otherwise, you'd need to stay logged in via telnet in order for it to run.

Setting up pyTivo to run as a daemon
The script below has been adapted from armoo's posted script at:. This script could not be used as is, because the pgrep and pkill  commands do not exist in the command set on the Linkstation. This script will require the enhanced ps command to be installed that is noted above.

The easiest way to edit the script below is to copy and paste it into a text editor on your desktop. Then save the file to your Linkstation. Then back no the Linkstation, navigate to the init.d directory and copy the file there.

Here is the script:


 * 1) chkconfig: 2345 99 05
 * 2) description: pyTivo server


 * 1) INIT INFO
 * 2) Provides: pytivo
 * 3) Required-Start: $network
 * 4) Required-Stop: $network
 * 5) Default-Start: 2 3 4 5
 * 6) Default-Stop: 0 1 6
 * 7) Short-description: pyTivo server
 * 8) Description: Start and stop the pyTivo server.
 * 9) Startup Script for use on Linkstation based NAS products
 * 10) By Jon Ogden, NA9D
 * 11) Based on the script posted by armoo at http://pytivo.armooo.net/wiki/initd
 * 12) Requires enhanced PS command for the Linkstation.  See instructions at:
 * 13) http://buffalo.nas-central.org/index.php/Open_Stock_Firmware#Full_version_of_ps
 * 14) END INIT INFO

RETVAL=0

start { echo -n "Starting pyTivo: " ps ax | grep pyTivo.py | grep -v grep RETVAL=$? [ $RETVAL -eq 0 ] && echo "pyTivo already running: Exiting" && exit 1

python /mnt/disk1/Media/pyTivo/pyTivo.py > /dev/null 2>&1 & RETVAL=$? [ $RETVAL -eq 0 ] && echo -n "done" echo return $RETVAL }
 * 1) this call actually starts pyTivo. - Edit it according to your exact path.

stop { echo -n "Stopping pyTivo: " kill `ps ax | grep pyTivo.py | grep -v grep | awk '{print $1}'` echo [ $RETVAL -eq 0 ] && echo -n "done" echo return $RETVAL }

case "$1" in start) start stop) stop restart|reload) stop sleep 1 start RETVAL=$? echo "Usage: $0 {start|stop|restart}" exit 1 esac exit $RETVAL
 * 1) See how we were called.

On your desktop, edit the script above so that the line under "# this call actually starts pyTivo." points to the location where you installed the pyTivo files. Then save the file to your Linkstation. Let's say you saved this file to the default share on the linkstation and named it pyTivo.sh (the .sh is not necessary, FYI). So in your Telnet session enter the following commands:

cd /etc/init.d cp /mnt/disk1/share/pyTivo.sh

Now test to see if the script is working for you. Enter:

./pyTivo.sh start

You should see the message that it is starting and if successful, you should get back to your prompt. Now go verify that you see your shares on your Tivo.

Now, test to see that you can't start it again.

./pyTivo.sh start

You should get the notification that pyTivo is already running.

Finally, let's try stopping pyTivo:

./pyTivo.sh stop

You should see the message that the stop was successful. Verify that your pyTivo shares have disappeared from your Tivo.

Once you have confirmed that you have the script running properly, it is time to add it to the rcS file. First make a copy of the rcS file. Assuming you are still in the init.d directory enter:

cp rcS rcS.old

This makes a copy of the rcS file in case something goes wrong. Then enter (exactly as typed):

echo "exec_sh pyTivo.sh start" >> /etc/init.d/rcS

This will append the startup command to the rcS file. You can concatenate the rcS file to make sure it's there at the end:

cat rcS

Now, every time you boot your Linkstation pyTivo will start up automatically. Now go ahead and start pyTivo and let it run:

./pyTivo start

Note, that it appears that doing things in the Linkstation web interface can terminate processes. If you do some configuration in the stock interface, you may need to manually restart pyTivo. YMMV.

That's all there is to it. Enjoy!

Note that without a properly functioning FFMPEG, you will only be able to serve native Tivo files and native MPEG-2 files to your Tivo. Other formats such as MPEG-4 or H.264 will not play.

Thanks to the folks at tivocommunity.com for some initial help and inspiration. Thanks to CuriousMark for helping with this Wiki entry. Thanks to the pyTivo developers for all their work.