Tivo: January 2005 Archives

This is probably the first of several posts that will deal with this topic.

The new Tivo system software upgrade brings many interesting features to Tivo, the most well-known of which is TivoToGo, which lets you copy the video files to your PC.

However, the software upgrade also includes a web server. This means you can interact with your Tivo via any web browser on any PC. I won't discuss all the ramifications of this right now, but one notable one is that Tivo can now produce your "Now Playing" list (a list of everything on your Tivo) as either an HTML or XML file.

The XML file is particularly exciting, because XML is very, very easy to parse nowadays. People have already parsed this XML into RSS, and I expect to be doing the same over the next couple of days.

To access your Tivo's Now Playing list as an XML file, use this URL:
https://192.168.1.103/TiVoConnect?Command=QueryContainer&Container=%2FNowPlaying
Just change the IP to the address of your Tivo, then login using the username tivo and your Media Access Key as your password.

Some of the scripts other people have released to parse this file are quite elaborate (and cool), but I wanted to demonstrate how easy it is to parse the Now Playing list into a simple HTML stream that could be easily included on any website. This took me about 10 mins to write, and it isn't very elegant.

Here you go:

<?php
function converttivodate($format, $input){
        //borrowed from A. Cassidy Napoli's Tivo_XML script
        return date($format, hexdec($input));}

$file = "nowplaying.xml";
$sxe = simplexml_load_file($file);
foreach($sxe->Item as $item) {
        $details = $item->Details;
        echo "$details->Title: $details->EpisodeTitle<br/> 
	$details->Description (" .
	converttivodate('n/d/y G:i',$details->CaptureDate) . 
	", $details->SourceStation, $details->SourceChannel)</p>\n"; } 
?>

That's about 6 lines of PHP, and it's easy to see the same (or even more) could probably be accomplished in about 2 lines. (See the update below.)

Just use include() or the Curl extensions to include the file on your site, and you're all set. This code snippet requires PHP5's SimpleXML support.

It produces something like this:

Law & Order: Merger
A scandal involving two wealthy families threatens McCoy and Carmichael's chances of a conviction in the murder of a drug-addicted girl of 15. (1/26/05 15:59, TNT, 3-0)

Seinfeld: The Doorman
A doorman (Larry Miller) tries to cause trouble for Jerry; Kramer develops a male undergarment. (1/26/05 15:29, TBS, 22-0)

Malcolm in the Middle: Reese's Apartment
Francis is determined to show his parents why they should not have kicked Reese out; Malcolm helps a football player writer a college essay. (1/26/05 14:59, WWOR, 9-0)

Here's a demo:

Update (1/27/05): Well, if you're willing to sacrifice readability in the code, you can implement the above with just 2 lines of PHP. I just took out the extra function call and variable assignments from the code above, and wound up with two lines.

About this Archive

This page is a archive of entries in the Tivo category from January 2005.

Find recent content on the main index or look in the archives to find all content.

Tivo: January 2005: Monthly Archives

Powered by Movable Type 4.0