[vox-tech] [fwd] Re: TiVo Home Media Option

Bill Kendrick vox-tech@lists.lugod.org
Tue, 29 Jul 2003 01:04:53 -0700


Some neat details on the TiVo Home Media Option.

I shall file it away for when/if I decide to actually spend the $$$ on
an ethernet adapter, and the service.  (Which is free-trial, right now,
so I AM kinda tempted!)

-bill!


----- Forwarded message from Rick Moen <rick@linuxmafia.com> -----

Date: Tue, 29 Jul 2003 00:07:45 -0700
From: Rick Moen <rick@linuxmafia.com>
Subject: (forw) [conspire] Re: TiVo Home Media Option
To: nbs@sonic.net

Enjoy!

----- Forwarded message from Rick Moen <rick@linuxmafia.com> -----

Date: Tue, 29 Jul 2003 00:06:30 -0700
To: conspire@linuxmafia.com
From: Rick Moen <rick@linuxmafia.com>
Subject: [conspire] Re: TiVo Home Media Option

[Bill posted this to LUGOD's vox-tech mailing list.  I'll be sending him
a copy of this post.  Some readers may not be aware that a TiVo PVR is,
under the hood, a very nicely hackable Linux computer.]


Quoting Bill Kendrick (nbs@sonic.net):

> TiVo's advertising this new "Home Media Option," which, with the
> adition of a broadband adapter (ethernet or 802.11b), allows one's TiVo
> to play MP3 music and display digital photos which get grabbed off of another
> PC on your LAN.
> 
> Unfortunately, it looks like the software you use to make the files available
> is only available for Windows and Macintosh.
> 
> I e-mailed TiVo tech support and got what seemed to be a robotic answer
> saying that there's no Linux version available, and there is currently no
> plans.
> 
> They didn't answer the second part of my question, so I asked it again
> (and got a "Sorry, I don't know the answer to that" response)...
> is the TiVo using any _known_ protocols to get these files?  (SMB, NFS?)

Why yes, it is.  It's XML-wrapped regular files sent over plain ol'
HTTP.  Resource discovery can be performed using zeroconf
("Rendezvous"), but I suppose it needn't be if you don't want to.

There's even an Apache plug-in to automate the stuff:
http://www.tivo.com/developer/i/TiVoPM_032003.tar.gz 
Neat!



http://www.kahunaburger.com/blog/archives/000052.html   clarifies:

Oh, this is pretty funny. Just a few days ago when the home media option
from TiVo (http://www.tivo.com/) came out, of course I had to be among
the first ones to install it. Now we have the TiVo unit in the living
room connected to the home network (using a wireless USB network
adapter) and I can share pictures/music from my desktop system with the
TiVo unit allowing me to do slideshows on the TV-set and stream radio
stations over to the living room.

This is really pretty cool.

So, besides sharing images/mp3s - what else can you do? Well, I went
over to http://www.tivo.com/developer/ and downloaded the protocol
specifications for the Home Media Option. It shows how TiVo's beacon
works (how different units find each other and find out what services
they have to offer) and how the http-based Media Server Protocol works.

I went ahead and modified the existing example of a Media Server to
serve previews of my email through the TiVo. This worked nice, however
did not coexist with the TiVo Media Server, because I did not find a way
how I could convince the TiVoBeacon service on my system to advertise my
custom service besides the TiVoServer services. So, I scratched that
idea for the moment and went a different route.

Using perl (from http://www.activestate.com/Products/ActivePerl/) and
some addon modules (GD, Mail::Internet, Mail::POP3Client, File::Path,
File::Spec) which were easily installed via the Perl Package Manager
(ppm) I created a script which would "render" email messages into PNG
files. I shared a new folder (D:\DigitalPhotos\Tivo\EMail in this case)
through the TiVo Desktop Server and used the script below (which is
invoked on a regular basis through "Scheduled Tasks") to get my email
from a number of POP3 servers and create a PNG file for each message.

This allows me to preview messages on my TV when I'm not at my computer.
This does not mean that I'm soo addicted to email that I have to watch
it on the TV screen and it does also not mean that I'm really that often
in front of the tube (fact is, that we spend less time in front of the
TV since we got the TiVo unit).

The output looks something like this:


[image of an e-mail, snipped.]

And here is the script that fetches and renders email messages. It's a
non-desctructive fetch, which means that messages stay on the server.

#!c:\perl\bin\perl.exe
use strict;
use File::Path;
use File::Spec;
use GD;
use Mail::POP3Client;
use Mail::Internet;
use constant DESTINATION   => q{d:\DigitalPhotos\Tivo\EMail};
use constant PREVIEW_LINES => 100;
use constant WIDTH         => 640;
use constant HEIGHT        => 480;
use constant HEADER_FONT   => gdMediumBoldFont;
use constant BODY_FONT     => gdLargeFont;
my @accounts = (
 {
 DESC      => q{thoellri@foobar.com},
 USER      => "thoellri",
 AUTH_MODE => "PASS",
 PASSWORD  => "password",
 HOST      => "pop3.foobar.com"
 },
 {
 DESC      => q{tobias@somewhere.com},
 USER      => "tobias",
 AUTH_MODE => "PASS",
 PASSWORD  => "password",
 HOST      => "mail.somewhere.com"
 },
);
for my $account (@accounts) {
 # erase existing messages
 rmtree([ File::Spec->catfile(DESTINATION, $account->{DESC}) ], 0, 0);
 my $pop = new Mail::POP3Client (%$account);
 unless ($pop) { warn "Couldn't connect\n"; next; }
 my $count = $pop->Count;
 if ($count <0) { warn "Authorization failed"; next; }
 next if($count == 0); # no new messages
 # create new directory for messages
 mkpath([ File::Spec->catfile(DESTINATION, $account->{DESC}) ], 0, 0711);
 for my $num (1..$count) {
 my @preview=$pop->HeadAndBody($num,100);
 my $mail=Mail::Internet->new(\@preview);
 my $header=$mail->head;
 my $image=render($mail);
 my $out=File::Spec->catfile(DESTINATION, $account->{DESC},qq{message-}.
 sprintf("%02d",$num).qq{.png});
 open(OUT, qq{>$out});
 binmode OUT;
 print OUT $image->png;
 close(OUT);
 }
 $pop->Close;
}
sub render {
 my($m)=@_;
 my $header=$m->head();
 my $im = new GD::Image(WIDTH, HEIGHT);
 # allocate some colors
 my $white = $im->colorAllocate(255,255,255);
 my $black = $im->colorAllocate(0,0,0);
 my $gray = $im->colorAllocate(20,20,20);
 my $red = $im->colorAllocate(255,0,0);
 my $blue = $im->colorAllocate(0,0,255);
 my $y=2;
 $im->string(HEADER_FONT, 5,$y, "Date:    ".$header->get('Date'), $black);$y+=10;
 $im->string(HEADER_FONT, 5,$y, "From:    ".$header->get('From'), $black);$y+=10;
 $im->string(HEADER_FONT, 5,$y, "To:      ".$header->get('To'), $black);$y+=10;
 $im->string(HEADER_FONT, 5,$y, "Subject: ".$header->get('Subject'), $blue);$y+=10;
 $im->string(HEADER_FONT, 5,$y, "-" x 80, $black);$y+=8;
 foreach my $line (@{$m->body()}) {
 chomp($line);
 $im->string(BODY_FONT, 5, $y, $line, $gray);
 $y+=13; last if($y>=HEIGHT);
 }
 return $im;
}



Of course those usernames/hostnames/passwords are just samples and need
to be customized for your environment. And depending on the size of your
TV-set you may have to tweak those values for HEADER_FONT and BODY_FONT.

Let me know, if it works for you as well ....

_______________________________________________
conspire mailing list
conspire@linuxmafia.com
http://linuxmafia.com/cgi-bin/mailman/listinfo/conspire

----- End forwarded message -----

----- End forwarded message -----

-- 
bill@newbreedsoftware.com                           Got kids?  Get Tux Paint! 
http://newbreedsoftware.com/bill/       http://newbreedsoftware.com/tuxpaint/