Previous section   Next section

Hack 82 Pulling Video from Your TiVo via Web Interface

figs/moderate.giffigs/hack82.gif

Clean and simple downloading of recorded shows through your web browser is just a TiVoWeb module away.

If you're rather attached to your browser�as I am�and would prefer a nice web interface for downloading recorded TV shows, John Sproull's MfsStream module (http://www.dealdatabase.com/forum/attachment.php?s=&postid=77818) for TiVoWeb [Hack #65] is for you.

If you are passing TiVoWeb through an Apache proxy (see [Hack #80]), the MfsStream module won't work for you right out of the box. I'll show you why at the end of this hack.

Grab the mfsstreamweb98b.zip archive from the previously mentioned URL and expand it on your PC. The archive contains plenty of files, only a few of which we'll be needing. FTP [Hack #55] the mfs_stream file to your TiVo's /var/hack/tivoweb-tcl directory; this is the program that talks to TiVo's Media Filesystem (MFS), where recorded programming is actually kept.

MfsStream was originally written to send video directly to the command line for capturing in a regular file. What's needed is some way to proxy it, rerouting it to the network. The tyhttpd program included in the MfsStream archive does just that. Copy it to TiVoWeb's /var/hack/tivoweb-tcl directory. Lastly, transfer the contents of the modules directory (extracted from the archive) to /var/hack/tivoweb-tcl/modules. These scripts add a new MfsStream menu item to TiVoWeb.

Let's give it a whirl, shall we? From the command line, launch tyhttpd:

bash-2.02# /var/hack/tivoweb-tcl/tyhttpd 2000 1 >> /dev/null &

This command will run the ty file server in the background on port 2000. The 1 specifies the number of streams you can concurrently download off your TiVo. Chances are that you'll never really need any more than the one stream, given the size of the files and how quickly downloading more than one will exhaust available bandwidth.

Restart TiVoWeb from its menu and take a gander at the updated home page. As shown in Figure 6-1, you should find a new MfsStream menu, listed both on the main list of menus and in the menu bar.

Figure 6-1. The TiVoWeb home page with the new MfsStream module installed
figs/tivo_0601.gif

Click the MfsStream menu item, and you'll come to a screen that looks a lot like the Now Showing list (see Figure 6-2). The difference is your ability to download the show (as ty file) simply by clicking on its now-hyperlinked title.

Figure 6-2. Hyperlinked titles for downloading recorded shows at the click of a mouse
figs/tivo_0602.gif

Now that we're done testing and all seems to be working as expected, have tyhttpd run automatically at TiVo startup by appending Section 3.11 the appropriate invocation to /etc/rc.sysinit. I'm being a little lazy and using the echo command to append the line to rc.sysinit without using a text editor:

bash-2.02# mount -o remount,rw /
bash-2.02# echo '/var/hack/tivoweb-tcl/tyhttpd 2000 1 >> /dev/null [RETURN]
&' >> /etc/rc.d/rc.sysinit
bash-2.02# mount -o remount,ro /

MfsStream and Proxying TiVoWeb Through Apache

The heart of the reason why you can't use MfsStream when proxying TiVoWeb through Apache is because tyhttpd opens its own port instead of using the port that we are already proxying. Assuming your TiVoWeb is running through Apache at http://tivo.apache.your.domain.com:8080/tivoweb, when you click on a program name in the MfsStream module, your TiVo starts downloading from something that starts with http://tivo.apache.your.domain.com:2000/. Note that 2000; that's the port that we have set up tyhttpd to be running on. But also note that your Apache installation is not proxying that port out. Your web browser is stuck, attempting to make a connection to a port that is refusing connections.

This problem is actually quite easy to fix by asking Apache to forward tyhttpd's port too. Just place the following lines in your Apache server's httpd.conf file:

NameVirtualHost *
Listen 2000
<VirtualHost *:2000>
ProxyPass / http://tivo:2000/
ProxyPassReverse / http://tivo:2000/
</VirtualHost>

This asks your Apache installation to open and listen on port 2000, but then to forward all requests to your TiVo's port 2000, exactly where tyhttpd is running.

For more on the Apache Web server, you might want to consult Apache: The Definitive Guide (http://www.oreilly.com/catalog/apache3/).

Go To

Those extracted ty files aren't going to do you much good without a media player [Hack #83] to read them or some way to convert them [Hack #86].


  Previous section   Next section
Top