ONLamp.com    
 Published on ONLamp.com (http://www.onlamp.com/)
 See this if you're having trouble printing code examples


O'Reilly Book Excerpts: TiVo Hacks

Hacking TiVo, Part 2

Related Reading

TiVo Hacks
100 Industrial-Strength Tips & Tools
By Raffi Krikorian

by Raffi Krikorian

Editor's note: In the previous hack we published from TiVo Hacks, we showed you how to use the TiVo Control Station to populate your TV screen with the latest weather forecasts, sports scores, stock quotes, and more, without ever leaving your couch. (Handy if your couch resides in a house near the Outer Banks of North Carolina, where Hurricane Isabel is making landfall as I type this!) This week we bring you two more TiVo hacks. They may not save your bacon, but if you're on the road and forgot to schedule recordings of your favorite programs, our first hack shows you how to use TiVoWeb to remotely program your TiVo. And if you're running out of hard disk space for downloaded videos, our second hack shows you how to play downloaded video streams right from your TiVo over your home network. Break out the popcorn!

Hack #66: Scheduling a Recording with TiVoWeb

Remotely scheduling a recording is just a few web pages away, thanks to the wonders of the TiVoWeb web interface.

Scheduling a recording with TiVoWeb is rather like doing so through TiVo's television interface. From the main TiVoWeb page or toolbar at the top of each page, click Search. You'll be presented with a page reminiscent of TiVo's Search by Title screen, as shown in Figure 5-10.

Figure 5-10. The TiVoWeb search interface

Because TiVoWeb has its fingers into the same hooks as the TiVo's WishLists, its search functionality is far more flexible than its TiVo counterpart. You can search not only by Title, but also by Keyword, Title Keyword, Actor, and by Director by simply changing the "Search By" field. You can further filter results by category (Movies, Educational, Western, etc.) and subcategory (under News and Business, for instance, you can select International, Magazine, Weather, etc.).

When you click the Search button, TiVo will chug on for a bit, finally returning anything it found matching your search criteria. Figure 5-11 shows some of the results of a search for the Title Keyword of "phoenix" when run on my TiVo.

Figure 5-11. TiVoWeb search results

Select the program you're interested in from the list by clicking on its name-in my case, Knight Rider. As shown in Figure 5-12, you'll be presented with a list of all episodes already recorded on your TiVo, along with upcoming episodes.

Figure 5-12. Recorded and upcoming episodes

Select the episode that you are interested in. You will be whisked away to the detailed information page for the episode and provided the option to Record or Get Season Pass (see Figure 5-13).

Figure 5-13. Recording a particular episode

Unlike the Home Media Option [Hack #64], the TiVoWeb is running right on your TiVo box itself. TiVoWeb will notice a conflict right away and tell you about it-no waiting for emails to find out if the scheduling happened or not. Talk about instant gratification. Set your Recording Options (see Figure 5-14), and click the Conflicts link to ask the TiVo to check whether it can actually record the show.

Figure 5-14. Setting Recording Options

If you get to the magical No Conflicts screen, hit Record and you should be set. If you simply do not believe it, grab your TiVo remote, navigate to the To Do List (Pick Programs to RecordTo Do List) on your television or on your computer [Hack #67], and you should see whatever you asked to record on the list.

Hack #84: Streaming Video Directly from TiVo

Why download massive videos and take up local hard drive space when you can stream them right from your TiVo over your home network?

Playing downloaded streams from your TiVo is just one way to use Wingert's TiVo MPlayer [Hack #83]. The whole reason he extended the original MPlayer was to enable you to stream videos right from your TiVo to your PC.

You'll need a program called vserver to pull off this hack. Download http://prdownloads.sourceforge.net/tivo-mplayer/vserver-1.2.tar.gz?download and unpack the archive. Inside, you'll find a whole slew of files. Look for a binary called vserver-ppc-s1-exec. Move and rename the file to /var/hack/bin/vserver on your TiVo. Start it up:

bash-2.02# ./vserver
waiting for connections on port 8074

Launch MPlayer as in the previous hack, only this time passing it the URL tivo://tivo_ip_address/list, replacing tivo_ip_address with the IP address of your TiVo [Hack #51]. That magical tivo URL handler up front (the tivo:// bit) makes sure that MPlayer talks to the vserver on the right port with the right protocol. The list bit, as you might imagine, requests a list of available programming. Here, I'm asking my TiVo (at IP address 192.168.0.3) for its Now Showing list:

C:\Program Files\mplayer> mplayer -quiet -cache 8192[RETURN]
tivo://192.168.0.3/1662160
Playing tivo://tivo/list
Listing streams in /Recording/NowShowingByTitle
[1662160][3][24][Day 2: 7:00 - 8:00AM]
[1651148][3][24][Day 2: 6:00 - 7:00AM]
[1636997][3][24][Day 2: 5:00 - 6:00AM] 
[1623225][3][24][Day 2: 4:00 - 5:00AM]
[1220239][13][9/11][(null)]
[1670974][2][ABC World News Tonig][(null)]
[700897][4][The Armenians: A Sto][(null)] 
[1684169][2][Coming Attractions][(null)]
[1651146][5][Dawson's Creek][All Good Things ... Must Come to an End]
...

Those numbers in the first column are the filesystem IDs (FSIDs) for the recorded streams, TiVo's way of indexing recorded videos. They're also used by vserver to select a show to stream:

C:\Program Files\mplayer> mplayer  tivo://192.168.0.3/1662160

And up comes the final episode of 24. To stop playback and quit MPlayer, press Control-C on the command line. mplayer is unfortunately quite computationally intensive, so the other flags on the command line are about lessing the load on your PC. -quiet supresses mplayer's output on the command line, giving your PC more computational cycles for the video. The -cache line asks your PC to cache 8 MB of video data at all times while it is playing to protect your PC against the unpredictability of networks

With vserver running, you also can extract ty streams directly from TiVo using mplayer [Hack #85]. On the command line, invoke mplayer, specifying an output file and the FSID of the stream you want to extract:

$ mplayer -dumpfile out.ty -dumpstream tivo://192.168.0.3/1692481

When you're done, don't forget to also kill the vserver process on your TiVo with a Control-C.


Return to ONLamp.com.

Copyright © 2009 O'Reilly Media, Inc.