Installing pyTivo on Linkstation Live

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search

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 ( Once your box is open follow the steps in this article: 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: You will also need the add-on files to be installed as well:

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 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


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: [1]. 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: [2]. 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: [3].

The configurations for pyTivo are beyond the scope of this Wiki. Please refer to [4] 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: [5]. 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:

# chkconfig: 2345 99 05
# description: pyTivo server

# Provides: pytivo
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-description: pyTivo server
# Description: Start and stop the pyTivo server.
# Startup Script for use on Linkstation based NAS products
# By Jon Ogden, NA9D
# Based on the script posted by armoo at
# Requires enhanced PS command for the Linkstation.  See instructions at:


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

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

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

# See how we were called.
case "$1" in
sleep 1
echo "Usage: $0 {start|stop|restart}"
exit 1
exit $RETVAL

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 (the .sh is not necessary, FYI). So in your Telnet session enter the following commands:

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

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

./ 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.

./ start

You should get the notification that pyTivo is already running.

Finally, let's try stopping pyTivo:

./ 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 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 for some initial help and inspiration. Thanks to CuriousMark for helping with this Wiki entry. Thanks to the pyTivo developers for all their work.