# Tivo Proxy Server



## Allanon

Hi, I'm writing a simple proxy server for my TiVo that will stream and decode .tivo files directly from the TiVo. This will allow media players like VLC and media servers like TVersity to play and server the files. I am also going to server a RSS feed so media servers can find the Tivo files.

Right now I have a simple prototype that works with VLC:



Code:


import cgi, os, SocketServer, sys, time, subprocess
import urllib2
from SimpleHTTPServer import SimpleHTTPRequestHandler
from StringIO import StringIO

Tivo_MAK = '***********'
Tivo_URL = 'http://192.168.1.106'
Port = 8000


def findPID(exename):
    a = os.popen4('tasklist /FI "IMAGENAME eq '+exename+'"')
    a[0].flush()
    try:
         info=a[1].readlines()[3].split()
    except:
        info=[exename,"NotFound"]
    return info[1]



class DirectoryHandler(SimpleHTTPRequestHandler):
   
    def do_GET(self):
        global Tivo_MAK
        global Tivo_URL
            
        # create TiVo URL
        link = Tivo_URL + self.path
        print link
   
        # Send header
        self.send_response(200)
        self.send_header("Content-Type", "video/mpeg")
        self.end_headers()
         
        # Get and decode the Tivo file     
        decode = subprocess.Popen('curl.exe --digest -k -c cookies.txt -u tivo:{0:s} "{1:s}" | tivodecode -m {0:s} -- -'.format(Tivo_MAK,link),shell=True,bufsize=1000,stdout=subprocess.PIPE)
        processID = findPID('curl.exe')

        # send decoded data to the client
        while True:
            chunk = decode.stdout.read(4096)
            if not chunk:
                break
            try:
                self.wfile.write(chunk)
            except:
                os.popen('TASKKILL /PID '+ processID +' /F')
                time.sleep(1)
                break
        
         
httpd = SocketServer.TCPServer(("", Port), DirectoryHandler)
print "serving at port", Port
httpd.serve_forever()

With this running I can open VLC and pass an URL that looks like this:


Code:


http://192.168.1.100:8000/download/Auction%20Kings.tivo?Container=%2FNowPlaying&id=4707752&Format=video/x-tivo-mpeg

And the server will change the URL to the TiVo URL and run curl and tivodecode then pass the output back to VLC.

This works in VLC, but I can't get any other media player or media server to recognize the output. I think it's because they can't determine the codec to use, they will open and close the link a few times before saying it can't play. My question is what exactly is output from tivodecode and what content-type and header info should I send? I tried "video/mpeg","video/mp4","video/mpgv" but windows media player won't play the output.


----------



## wmcbrine

The output from tivodecode should be an MPEG-2 program stream. I believe "video/mpeg" is the correct MIME type for this. But I don't know what other software besides VLC you've tried, what its capabilities are, or what it expects.


----------



## Allanon

wmcbrine said:


> The output from tivodecode should be an MPEG-2 program stream. I believe "video/mpeg" is the correct MIME type for this. But I don't know what other software besides VLC you've tried, what its capabilities are, or what it expects.


I tried VLC, Windows Media Player and Serviio media server. VLC played the stream no mater what MIME was on the stream. And Serviio Media Server would only play the stream if it was designated as an internet stream and a MIME of "video/mpeg" but if the same exact URL was passed using an RSS feed it would not play. Windows Media Player would not play the stream at all. It starts the stream a few times then says it can't play it.

My goal is to stream videos from my TiVo to my Sony TV which has an UPNP/DLNA client. I would like to feed Serviio media server an RSS feed with proxy links to all the videos on the TiVo. Then I can use the UPNP/DLNA client to select videos and have them streamed using the proxy server. I don't want to store TiVo files on my computer.

*Update:*
I got RSS and video working with the PS3 Media Server. This media server satisfies all my media server needs so I am going to stop trying to get this proxy server working with other players and servers. I will post here the final code to my proxy server when it's complete.


----------



## Allanon

Below is the final code that I'm using for the Tivo Proxy Server. It isn't pretty and doesn't do a lot of error checking but it works for me. You can use this code for whatever you like without restrictions.

To use just run the Tivo Proxy Server.py code then pass a URL that looks like this:


Code:


http://192.168.1.100:10000/rss

This assumes:
Server_URL = 192.168.1.100
Port = 10000

That url will return an RSS FEED to the specified Tivo's now playing list. The .tivo URLs in the RSS feed will point to the proxy server and when a .tivo file is requested the proxy server will download the .tivo file and convert it to an .mpg and stream it to the requesting application.

This has been tested with VLC and PS3 Media Server. I use this proxy server to stream videos from the TiVo to my Sony TV which has a UPNP / DNLA client which connect to the PS3 Media Server.


----------



## ejonesss

after i set up the server i get invalid syntax at print link

i guess print is not a valid command


----------



## vanclute

I just stumbled across this thread and am very intrigued to try this. I hope I'm doing something wrong because it doesn't seem to function at all for me.

I run the .py file in Terminal after editing it to include my MAK, Tivo IP, and server IP (my Mac media server which is running the .py script).

This is what I get:



> users-Mac:~ user$ /Users/user/Desktop/Tivo\ Proxy\ Server.py ; exit;
> /Users/user/Desktop/Tivo Proxy Server.py: line 1: import: command not found
> from: can't read /var/mail/SimpleHTTPServer
> from: can't read /var/mail/StringIO
> : command not found/Tivo Proxy Server.py: line 4:
> /Users/user/Desktop/Tivo Proxy Server.py: line 7: Tivo_MAK: command not found
> /Users/user/Desktop/Tivo Proxy Server.py: line 8: Server_URL: command not found
> /Users/user/Desktop/Tivo Proxy Server.py: line 9: Tivo_URL: command not found
> /Users/user/Desktop/Tivo Proxy Server.py: line 10: Port: command not found
> : command not found/Tivo Proxy Server.py: line 11:
> : command not found/Tivo Proxy Server.py: line 12:
> /Users/user/Desktop/Tivo Proxy Server.py: line 14: syntax error near unexpected token `('
> 'Users/user/Desktop/Tivo Proxy Server.py: line 14: `def findPID(exename):
> logout


Any idea where I've gone wrong?


----------



## Allanon

vanclute said:


> Any idea where I've gone wrong?


Only thing I can think of is to make sure you have all the modules installed. I'm not really a Python expert and I don't have a Mac. I taught myself how to program Python so there can be numerous things wrong with the code. It works on my Windows XP computer but I have no knowledge of how to get it working on other operating systems.

Also checkout this thread where I explain some of the problems other operating systems might have:
http://www.tivocommunity.com/tivo-vb/showthread.php?t=496286


----------



## wmcbrine

vanclute said:


> Any idea where I've gone wrong?


It's treating it as a shell script rather than as Python. You can either launch it as "python scriptname", or add this as the first line:



Code:


#!/usr/bin/env python


----------



## vanclute

Aha good point. OK I added the line, but now I get this:



Code:


users-Mac:~ user$ /Users/user/Desktop/Tivo\ Proxy\ Server.py ; exit;
Traceback (most recent call last):
  File "/Users/user/Desktop/Tivo Proxy Server.py", line 121, in <module>
    httpd = SocketServer.TCPServer(("", Port), Handler)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 408, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 419, in server_bind
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 224, in meth
socket.error: [Errno 48] Address already in use
logout

[Process completed]

I quit PyTivoX in case that was conflicting but that didn't help.


----------



## Allanon

Since there seemed to be some interest in this program I went ahead and made the code less OS dependent. I removed all Windows specific code such as the process ID check function and the need for curl.exe. I tested the program using Python 2.7. You will still need to place tivodecode in the same path as the program. You can get a tivodecode binary file from kmttg's Helper Tools. Also you will still need to replace the IP, port and MAK parameters located near the top of the code to reflect your computer and Tivo network settings.


----------



## vanclute

Allanon said:


> You will still need to place tivodecode in the same path as the program.


Aha! I missed this requirement and had not done so at all. Hopefully that, combined with your new OS-independence changes, will yield better results for me at last. I shall report back ASAP!


----------



## vanclute

Well rats... no joy.  Here is the result:



Code:


users-Mac:~ user$ /Applications/kmttg_v0p8u/tivodecode/Tivo\ Proxy\ Server\ 2.py ; exit;
Traceback (most recent call last):
  File "/Applications/kmttg_v0p8u/tivodecode/Tivo Proxy Server 2.py", line 148, in <module>
    httpd = SocketServer.TCPServer(("", Port), Handler)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 408, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 419, in server_bind
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 224, in meth
socket.error: [Errno 48] Address already in use
logout

[Process completed]

Any suggestions on where to go from here?


----------



## Allanon

vanclute said:


> Any suggestions on where to go from here?


Did you try changing the port number?

Edit:

I also went online to see if I can find a solution and you might try using this line of code:

Replace:


Code:


# Start Proxy Server
httpd = SocketServer.TCPServer(("", Port), Handler)

With:


Code:


# Start Proxy Server
SocketServer.TCPServer.allow_reuse_address = True
httpd = SocketServer.TCPServer(("", Port), Handler)


----------



## wmcbrine

Yes, change the port number. (Don't do the reuse mod.)


----------



## bradleys

I have the script running and I can see the rss feed. When I try to play the video in VLN I get nothing.

Looks properly formated...

"http://192.168.1.6:10000/download/Fringe.tivo?Container=%2FNowPlaying&id=2337518&Format=video/x-tivo-mpeg"










Is it possible we could have a DNLA server built into PyTiVo?


----------



## vanclute

ok, progress! The server is now serving on port 10001 and I can see a list of programs on the tivo! Playing one however, still fails thusly:



Code:


Video URL:  [url]http://192.168.2.10/download/The%20Owl%20and%20the%20Pussycat.TiVo?Container=%2FNowPlaying&id=1337050[/url]

192.168.2.16 - - [12/Jan/2013 17:50:29] "GET /download/The%20Owl%20and%20the%20Pussycat.TiVo?Container=%2FNowPlaying&id=1337050 HTTP/1.1" 200 -

Decoding video

----------------------------------------
Exception happened during processing of request from ('192.168.2.16', 53674)
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 310, in process_request
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 323, in finish_request
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 639, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 337, in handle
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 325, in handle_one_request
  File "/Applications/kmttg_v0p8u/tivodecode/Tivo Proxy Server 2.py", line 127, in do_GET
    decode = subprocess.Popen('tivodecode -m {0:s} -- -'.format(Tivo_MAK),shell=False,bufsize=0,stdin=subprocess.PIPE,stdout=subprocess.PIPE)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
OSError: [Errno 2] No such file or directory
----------------------------------------

So it's missing something... can you tell what?

So close!

Also I notice it's showing only a handful of programs, certainly nowhere near everything that's on the Tivo.


----------



## bradleys

vanclute said:


> ok, progress! The server is now serving on port 10001 and I can see a list of programs on the tivo! Playing one however, still fails thusly:
> 
> So it's missing something... can you tell what?
> 
> So close!
> 
> Also I notice it's showing only a handful of programs, certainly nowhere near everything that's on the Tivo.


Looks like you and I are seeing something very similar....

I am also only seeing a subset of the actual content on my TiVo in the RSS feed.



Code:


Video URL:  http://192.168.1.7/download/Fringe.tivo?Container=%2FNowPlaying&id=2337518&Format=video/x-tivo-mpeg

HOME_OFFICE.home - - [12/Jan/2013 19:33:48] "GET /download/Fringe.tivo?Container=%2FNowPlaying&id=2337518&Format=video/x-tivo-mpeg HTTP/1.1" 200 -

Decoding video

----------------------------------------
Exception happened during processing of request from ('192.168.1.6', 57892)
Traceback (most recent call last):
  File "C:\Python27\lib\SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Python27\lib\SocketServer.py", line 638, in __init__
    self.handle()
  File "C:\Python27\lib\BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "C:\Python27\lib\BaseHTTPServer.py", line 328, in handle_one_request
    method()
  File "C:\Program Files (x86)\TivoProxy\Tivo Proxy Server.py", line 125, in do_GET
    decode = subprocess.Popen('tivodecode -m {0:s} -- -'.format(Tivo_MAK),shell=False,bufsize=0,stdin=subprocess.PIPE,stdout=subprocess.PIPE)
  File "C:\Python27\lib\subprocess.py", line 679, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 896, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
----------------------------------------
/

Definately looks like some file is not being found...


----------



## vanclute

My first thought was that it's not finding something it needs from tivodecode, but I would have expected the error message to be a bit more specific if that were the case. I don't have any other theory at this moment. =(


----------



## bradleys

That was my thought as well... So I tried placing the TiVodecode files in the root directory (C:\Program Files (x86)\TivoProxy) to see if that would help. It didn't.

I am sure we are doing something simple wrong.


----------



## Allanon

The URL posted in the image looks different than the ones I'm getting. My URLs are formatted like this:


Code:


http://192.168.1.114:10000/download/NFL%20Football.TiVo?Container=%2FNowPlaying&id=5377217

Try removing the "&Format=video/x-tivo-mpeg" in your URL and see if it plays.

What type of Tivo do you guys have? I have a Tivo HD and I did a hack to convert the XML file from the Tivo to an RSS feed. If you guys have a Premiere then maybe the XML file is different and the hack is messing up. I will fix the code to use XMLLib and read the XML file properly.

Can someone post the XML Now Playing List from their Premiere so I can do a comparison?

Also, in VLC you can add the RSS feed as a podcast and have the Tivo Now Playing List show up in the VLC playlist. This will prevent you from having to enter the URLs manually.


----------



## bradleys

I have an HD machine as well. And temper this with the knowlege that I am half a bottle down on a fantastic Cab tonight, but I am still not getting a result from the VLN player using:



Code:


http://192.168.1.114:10000/download/Grimm.TiVo?Container=%2FNowPlaying&id=2979432

let me see what I get from the console.....



Code:


serving at port 10000
/download/Gold%20Rush.TiVo?Container=%2FNowPlaying&id=1972195

Video URL:  http://192.168.1.4/download/Gold%20Rush.TiVo?Container=%2FNowPlaying&id=1972195

HOME_OFFICE.home - - [12/Jan/2013 23:50:04] "GET /download/Gold%20Rush.TiVo?Container=%2FNowPlaying&id=1972195 HTTP/1.1" 200 -

Decoding video

----------------------------------------
Exception happened during processing of request from ('192.168.1.6', 50601)
Traceback (most recent call last):
  File "C:\Python27\lib\SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Python27\lib\SocketServer.py", line 638, in __init__
    self.handle()
  File "C:\Python27\lib\BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "C:\Python27\lib\BaseHTTPServer.py", line 328, in handle_one_request
    method()
  File "C:\Program Files (x86)\TivoProxy\Tivo Proxy Server.py", line 125, in do_GET
    decode = subprocess.Popen('tivodecode -m {0:s} -- -'.format(Tivo_MAK),shell=False,bufsize=0,stdin=subprocess.PIPE,stdout=subprocess.PIPE)
  File "C:\Python27\lib\subprocess.py", line 679, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 896, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
----------------------------------------

Same result from my HD, definately something I am doing wrong.


----------



## Allanon

In this line of code:


Code:


decode = subprocess.Popen('tivodecode -m {0:s} -- -'.format(Tivo_MAK),shell=False,bufsize=0,stdin=subprocess.PIPE,stdout=subprocess.PIPE)

Try putting in the path to tivodecode, for example if tivodecode is in c:\tivodecode then make the code look like this:


Code:


decode = subprocess.Popen('c:\\tivodecode\\tivodecode -m {0:s} -- -'.format(Tivo_MAK),shell=False,bufsize=0,stdin=subprocess.PIPE,stdout=subprocess.PIPE)

Also make sure you are running as administrator, maybe it's an authorization problem. I'm using Windows XP and run as administrator. I tried running without tivodecode and got a different error than the one you posted so I'm not sure what is causing that error.


----------



## vanclute

I've got a Premiere as well (actually two, but I wasn't going to broach the question of running two servers until I had at least one working!)



> Try removing the "&Format=video/x-tivo-mpeg" in your URL and see if it plays.


I'm not sure what you meant there, as I don't have that in my URLs....?

I would gladly post the XML Now Playing list but I have no idea how to get it. If you can clue me in, I'll contribute what I can.

As for RSS feeds in VLC, I suspect that might be a Windows-only feature, I don't see anything relating to RSS feeds at all in VLC for Mac.

I'll try the absolute path to tivodecode, I considered that but wasn't sure of the syntax. Will give it a shot and report back!


----------



## vanclute

No change by adding the absolute path to Tivodecode. I think that part is at least working, it looks like maybe something about my python build is the problem. Apple includes python on the OS but maybe I need to try downloading a binary or something. I'm going to investigate that.


----------



## Allanon

vanclute said:


> I've got a Premiere as well (actually two, but I wasn't going to broach the question of running two servers until I had at least one working!)


You can probably run 2 or more servers at a time just use different port numbers. But your computer is probably not fast enough to decode 2 HD videos at the same time. Mine has trouble just decoding one HD video.



> I'm not sure what you meant there, as I don't have that in my URLs....?


The URL Bradleys posted had that at the end.



> I would gladly post the XML Now Playing list but I have no idea how to get it. If you can clue me in, I'll contribute what I can.


To get the XML file just enter the following in to your internet browser. I used the Tivo URL from your error message but if that is not correct then change the URL to what it should be:


Code:


https://192.168.2.16/TiVoConnect?Command=QueryContainer&Container=%2FNowPlaying&Recurse=Yes&AnchorOffset=0

Then it should ask for a username and password, use the word *tivo* as the username and your Tivo MAK number as the password. Your browser should then display the Tivo XML file. Just save it to a file and post it here or send it as a private message.



> As for RSS feeds in VLC, I suspect that might be a Windows-only feature, I don't see anything relating to RSS feeds at all in VLC for Mac.


Go to your playlist and on the left side it should have a menu item that says internet. Click that and you should see a podcast option. Just add the RSS Feed URL as a new podcast. If you don't see that then maybe it is only Windows.


----------



## wmcbrine

vanclute said:


> No change by adding the absolute path to Tivodecode. I think that part is at least working, it looks like maybe something about my python build is the problem. Apple includes python on the OS but maybe I need to try downloading a binary or something. I'm going to investigate that.


No, that part is NOT working. And there is nothing wrong with your Python.

subprocess.Popen() expects a list, with the command and parameters separate, not a simple string:

['tivodecode', '-m', TiVo_MAK, '--', '-']

not

'tivodecode -m etc.'

It only works as a string in Windows, due to a quirk in how Popen is implemented there.

http://docs.python.org/2/library/subprocess.html#popen-constructor


----------



## Allanon

Thanks wmcbrine for pointing that out, I would have never found that.

Alright, here is an updated version. This version includes the modification wmcbrine posted and the program now uses XMLLib to parse the XML file which might work better if the Tivo HD and Premiere XML files are different. I also added more context headers, this seems to have made the video play on more devices such as within the Chrome browser and in the Serviio Media Server.


----------



## bradleys

Running the RSS in Chrome I now get the error:

*This page contains the following errors:

error on line 31 at column 49: xmlParseEntityRef: no name
Below is a rendering of the page up to the first error.
*









Trying to run in VLN and I get:



Code:


serving at port 10000
/download/Gold%20Rush.TiVo?Container=%2FNowPlaying&id=1972195&Format=video/x-tivo-mpeg

Video URL:  http://192.168.1.7/download/Gold%20Rush.TiVo?Container=%2FNowPlaying&id=1972195&Format=video/x-tivo-mpeg

HOME_OFFICE.home - - [13/Jan/2013 09:27:58] "GET /download/Gold%20Rush.TiVo?Container=%2FNowPlaying&id=1972195&Format=video/x-tivo-mpeg HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('192.168.1.6', 53074)
Traceback (most recent call last):
  File "C:\Python27\lib\SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Python27\lib\SocketServer.py", line 638, in __init__
    self.handle()
  File "C:\Python27\lib\BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "C:\Python27\lib\BaseHTTPServer.py", line 328, in handle_one_request
    method()
  File "C:\Program Files (x86)\TivoProxy\Tivo Proxy Server.py", line 155, in do_GET
    videoFile =  openUrl(link, 'tivo', Tivo_MAK)
  File "C:\Program Files (x86)\TivoProxy\Tivo Proxy Server.py", line 25, in openUrl
    return urllib2.urlopen(url)
  File "C:\Python27\lib\urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\Python27\lib\urllib2.py", line 406, in open
    response = meth(req, response)
  File "C:\Python27\lib\urllib2.py", line 519, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python27\lib\urllib2.py", line 444, in error
    return self._call_chain(*args)
  File "C:\Python27\lib\urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 527, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 404: Not Found
----------------------------------------


----------



## Allanon

Bradleys, what type of Tivo are you using to test this program? Also, can you send me the XML file from your Tivo so I can write code that reads it?

Your Tivo video URL is different than the one from my Tivo HD. Plus the RSS Feed error doesn't happen on my Tivo. There is something different about your XML file. Do you live in the United States? Maybe non US boxes have different XML Files. I can't help until I see what your XML file looks like.


----------



## bradleys

Allanon said:


> Bradleys, what type of Tivo are you using to test this program? Also, can you send me the XML file from your Tivo so I can write code that reads it?
> 
> Your Tivo video URL is different than the one from my Tivo HD. Plus the RSS Feed error doesn't happen on my Tivo. There is something different about your XML file. Do you live in the United States? Maybe non US boxes have different XML Files. I can't help until I see what your XML file looks like.


I have a Premier, an HD and an S3, I am testing against the Premier. Let me give it a try against the HD. I am in Dallas.

The new file does not work against any of my TiVo's. Attached is the XML from my Premier box


----------



## vanclute

Allanon said:


> To get the XML file just enter the following in to your internet browser. I used the Tivo URL from your error message but if that is not correct then change the URL to what it should be:
> 
> 
> Code:
> 
> 
> https://192.168.2.16/TiVoConnect?Command=QueryContainer&Container=%2FNowPlaying&Recurse=Yes&AnchorOffset=0
> 
> Then it should ask for a username and password, use the word *tivo* as the username and your Tivo MAK number as the password. Your browser should then display the Tivo XML file. Just save it to a file and post it here or send it as a private message.


wow... my server REALLY did not like that. I added the port number to the URL and then got this:



Code:


192.168.2.16 - - [13/Jan/2013 12:42:33] code 400, message Bad request syntax ('\x16\x03\x01\x00\x8f\x01\x00\x00\x8b\x03\x01P\xf3\x1c9)\xa9\x84&\x86\x86\xd3\xb5\xd3\x13fn9s\xbcR\xbc\x05\xb3|\x12\x17\xd8\xdd\xbc\xaf\xe6\x02\x00\x00H\x00\xff\xc0')
192.168.2.16 - - [13/Jan/2013 12:42:33] "??P?9)??&??&#1269;?fn9s?R??|?&#1916;??H??" 400 -
192.168.2.16 - - [13/Jan/2013 12:42:33] code 400, message Bad request syntax ('\x16\x03\x01\x00\x8f\x01\x00\x00\x8b\x03\x01P\xf3\x1c9\xe5\x83t-\x7f\x1e"\xe9\x9dI\xf9;\xb2)\x8cwts(\x13#\xf0P\xb7\x83"6Y\x00\x00H\x00\xff\xc0')
192.168.2.16 - - [13/Jan/2013 12:42:33] "??P?9?t-"?I?;?)?wts(#?P??"6YH??" 400 -

The exact URL I used was:



Code:


https://192.168.2.16:10001/TiVoConnect?Command=QueryContainer&Container=%2FNowPlaying&Recurse=Yes&AnchorOffset=0

suggestions?


----------



## Allanon

vanclute said:


> wow... my server REALLY did not like that.


That URL has nothing to do with my program. It just retrieves the XML Now Playing List from your Tivo. Don't add a port number and use your Tivo URL not your computer's URL.


----------



## Allanon

bradleys said:


> I have a Premier, an HD and an S3, I am testing against the Premier. Let me give it a try against the HD. I am in Dallas.
> 
> The new file does not work against any of my TiVo's. Attached is the XML from my Premier box


Thanks for the file, it looks almost identical to the Tivo HD XML. Not sure why it's not working. I'm going to try the code on Linux to see if I get different results. Will report back later tonight.

BTW, what OS are you running?


----------



## bradleys

Allanon said:


> Thanks for the file, it looks almost identical to the Tivo HD XML. Not sure why it's not working. I'm going to try the code on Linux to see if I get different results. Will report back later tonight.
> 
> BTW, what OS are you running?


Windows 7. As I said, the ealier file you created generates a readable RSS feed, but fails on the transcode. The last file you created fails on the RSS feed for me.

I have both TiVo decode and your file extracted to the same directory. I have Python 2.7.3 installed.


----------



## Allanon

Here is an updated version that should fix the RSS Feed. There was an & in the episode title and apparently browsers don't like the & character so it has to be replaced with &amp;. I was doing that for the URL but not for any of the other data so an error was produced. This is now fixed.

I also noticed that the program wasn't putting the port number in the Video URL so I placed port 80 in the URL. Maybe Windows 7 needs the port number.


----------



## bradleys

Allanon said:


> Here is an updated version that should fix the RSS Feed. There was an & in the episode title and apparently browsers don't like the & character so it has to be replaced with &. I was doing that for the URL but not for any of the other data so an error was produced. This is now fixed.
> 
> I also noticed that the program wasn't putting the port number in the Video URL so I placed port 80 in the URL. Maybe Windows 7 needs the port number.


Yes, those special characters! - I struggled with those when I developed my poster art lookup logic. The RSS is working but still failing with the '&' in Angels & Demons. If I delete that movie, it works fine.

Unfortunately, it is still not working. I am sure you are getting a little tired of trouble shooting this. If you are still interested, I am attaching my code - this is the same output if I run it via firefox or input the url into VLN.



Code:


Video URL:  http://192.168.1.7:80/download/MuscleCar.TiVo?Container=%2FNowPlaying&id=4404019200&Format=video/x-tivo-mpeg

HOME_OFFICE.home - - [14/Jan/2013 17:36:07] "GET /download/MuscleCar.TiVo?Container=%2FNowPlaying&id=4404019200&Format=video/x-tivo-mpeg HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('192.168.1.6', 58127)
Traceback (most recent call last):
  File "C:\Python27\lib\SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Python27\lib\SocketServer.py", line 638, in __init__
    self.handle()
  File "C:\Python27\lib\BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "C:\Python27\lib\BaseHTTPServer.py", line 328, in handle_one_request
    method()
  File "C:\Program Files (x86)\TivoProxy\Tivo Proxy Server.py", line 154, in do_GET
    videoFile =  openUrl(link, 'tivo', Tivo_MAK)
  File "C:\Program Files (x86)\TivoProxy\Tivo Proxy Server.py", line 25, in openUrl
    return urllib2.urlopen(url)
  File "C:\Python27\lib\urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\Python27\lib\urllib2.py", line 406, in open
    response = meth(req, response)
  File "C:\Python27\lib\urllib2.py", line 519, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python27\lib\urllib2.py", line 444, in error
    return self._call_chain(*args)
  File "C:\Python27\lib\urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 527, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 404: Not Found
----------------------------------------

If I get this working the next step is to try to feed this to my Plex Media Server using the feed me plugin. With that you can stream to Roku boxes, xbox... Heck, any number of devices.


----------



## vanclute

Allanon said:


> That URL has nothing to do with my program. It just retrieves the XML Now Playing List from your Tivo. Don't add a port number and use your Tivo URL not your computer's URL.


Ahh I see, my mistake. Here is the output:



Code:


<TiVoContainer><Details><ContentType>x-tivo-container/tivo-videos</ContentType><SourceFormat>x-tivo-container/tivo-dvr</SourceFormat><Title>Now Playing</Title><LastChangeDate>0x50F4F768</LastChangeDate><TotalItems>430</TotalItems><UniqueId>/NowPlaying</UniqueId></Details><SortOrder>Type,CaptureDate</SortOrder><GlobalSort>Yes</GlobalSort><ItemStart>0</ItemStart><ItemCount>16</ItemCount><Item><Details><ContentType>video/x-tivo-raw-tts</ContentType><SourceFormat>video/x-tivo-raw-tts</SourceFormat><Title>The Owl and the Pussycat</Title><SourceSize>4404019200</SourceSize><Duration>7198000</Duration><CaptureDate>0x50F1C0BE</CaptureDate><ShowingDuration>7200000</ShowingDuration><ShowingStartTime>0x50F1C0C0</ShowingStartTime><Description>An uptight would-be writer shares a New York apartment with a part-time prostitute. Copyright Tribune Media Services, Inc.</Description><SourceChannel>186</SourceChannel><SourceStation>KNTVDT2</SourceStation><HighDefinition>No</HighDefinition><ProgramId>MV000077810000</ProgramId><SeriesId>MV007781</SeriesId><StreamingPermission>Yes</StreamingPermission><TvRating>3</TvRating><MpaaRating>2</MpaaRating><ShowingBits>1</ShowingBits><SourceType>2</SourceType><IdGuideSource>36151</IdGuideSource></Details><Links><Content><Url>http://192.168.2.10:80/download/The%20Owl%20and%20the%20Pussycat.TiVo?Container=%2FNowPlaying&id=1337050</Url><ContentType>video/x-tivo-raw-tts</ContentType></Content><CustomIcon><Url>urn:tivo:image:expired-recording</Url><ContentType>image/*</ContentType><AcceptsParams>No</AcceptsParams></CustomIcon><TiVoVideoDetails><Url>https://192.168.2.10:443/TiVoVideoDetails?id=1337050</Url><ContentType>text/xml</ContentType><AcceptsParams>No</AcceptsParams></TiVoVideoDetails></Links></Item><Item><Details><ContentType>video/x-tivo-raw-tts</ContentType><SourceFormat>video/x-tivo-raw-tts</SourceFormat><Title>Pop Up Video</Title><SourceSize>2202009600</SourceSize><Duration>1799000</Duration><CaptureDate>0x50F14936</CaptureDate><ShowingDuration>1800000</ShowingDuration><ShowingStartTime>0x50F14938</ShowingStartTime><EpisodeTitle>Celeb Cameos</EpisodeTitle><SourceChannel>44</SourceChannel><SourceStation>VH1P</SourceStation><HighDefinition>No</HighDefinition><ProgramId>EP014764110078</ProgramId><SeriesId>SH01476411</SeriesId><EpisodeNumber>206</EpisodeNumber><StreamingPermission>Yes</StreamingPermission><TvRating>4</TvRating><ShowingBits>786946</ShowingBits><SourceType>2</SourceType><IdGuideSource>16376</IdGuideSource></Details><Links><Content><Url>http://192.168.2.10:80/download/Pop%20Up%20Video.TiVo?Container=%2FNowPlaying&id=1337184</Url><ContentType>video/x-tivo-raw-tts</ContentType></Content><CustomIcon><Url>urn:tivo:image:save-until-i-delete-recording</Url><ContentType>image/*</ContentType><AcceptsParams>No</AcceptsParams></CustomIcon><TiVoVideoDetails><Url>https://192.168.2.10:443/TiVoVideoDetails?id=1337184</Url><ContentType>text/xml</ContentType><AcceptsParams>No</AcceptsParams></TiVoVideoDetails></Links></Item><Item><Details><ContentType>video/x-tivo-raw-tts</ContentType><SourceFormat>video/x-tivo-raw-tts</SourceFormat><Title>Little Miss Marker</Title><SourceSize>2202009600</SourceSize><Duration>5400000</Duration><CaptureDate>0x50F0996E</CaptureDate><ShowingDuration>5400000</ShowingDuration><ShowingStartTime>0x50F09970</ShowingStartTime><Description>Bookie Sorrowful Jones receives a little girl as an IOU in the Damon Runyon tale. Copyright Tribune Media Services, Inc.</Description><SourceChannel>186</SourceChannel><SourceStation>KNTVDT2</SourceStation><HighDefinition>No</HighDefinition><ProgramId>MV000031060000</ProgramId><SeriesId>MV003106</SeriesId><StreamingPermission>Yes</StreamingPermission><TvRating>4</TvRating><MpaaRating>8</MpaaRating><ShowingBits>0</ShowingBits><SourceType>2</SourceType><IdGuideSource>36151</IdGuideSource></Details><Links><Content><Url>http://192.168.2.10:80/download/Little%20Miss%20Marker.TiVo?Container=%2FNowPlaying&id=1337049</Url><ContentType>video/x-tivo-raw-tts</ContentType></Content><CustomIcon><Url>urn:tivo:image:expired-recording</Url><ContentType>image/*</ContentType><AcceptsParams>No</AcceptsParams></CustomIcon><TiVoVideoDetails><Url>https://192.168.2.10:443/TiVoVideoDetails?id=1337049</Url><ContentType>text/xml</ContentType><AcceptsParams>No</AcceptsParams></TiVoVideoDetails></Links></Item><Item><Details><ContentType>video/x-tivo-raw-tts</ContentType><SourceFormat>video/x-tivo-raw-tts</SourceFormat><Title>The Millionaire Matchmaker</Title><SourceSize>2202009600</SourceSize><Duration>3599000</Duration><CaptureDate>0x50EF9C4E</CaptureDate><ShowingDuration>3600000</ShowingDuration><ShowingStartTime>0x50EF9C50</ShowingStartTime><EpisodeTitle>Wounded Wally and the Mama's Boy</EpisodeTitle><Description>Daniel Negreanu is a 37-year-old professional poker player; Brian Holloway II is a divorced heir to his family's fortune. Copyright Tribune Media Services, Inc.</Description><SourceChannel>48</SourceChannel><SourceStation>BRAVOP</SourceStation><HighDefinition>No</HighDefinition><ProgramId>EP010175710066</ProgramId><SeriesId>SH01017571</SeriesId><EpisodeNumber>601</EpisodeNumber><StreamingPermission>Yes</StreamingPermission><TvRating>5</TvRating><ShowingBits>2</ShowingBits><SourceType>2</SourceType><IdGuideSource>31555</IdGuideSource></Details><Links><Content><Url>http://192.168.2.10:80/download/The%20Millionaire%20Matchmaker.TiVo?Container=%2FNowPlaying&id=1336029</Url><ContentType>video/x-tivo-raw-tts</ContentType></Content><CustomIcon><Url>urn:tivo:image:expired-recording</Url><ContentType>image/*</ContentType><AcceptsParams>No</AcceptsParams></CustomIcon><TiVoVideoDetails><Url>https://192.168.2.10:443/TiVoVideoDetails?id=1336029</Url><ContentType>text/xml</ContentType><AcceptsParams>No</AcceptsParams></TiVoVideoDetails></Links></Item><Item><Details><ContentType>video/x-tivo-raw-tts</ContentType><SourceFormat>video/x-tivo-raw-tts</SourceFormat><Title>Highway to Heaven</Title><SourceSize>2202009600</SourceSize><Duration>3599000</Duration><CaptureDate>0x50EE128E</CaptureDate><ShowingDuration>3600000</ShowingDuration><ShowingStartTime>0x50EE1290</ShowingStartTime><EpisodeTitle>Popcorn, Peanuts and Cracker Jacks</EpisodeTitle><Description>When Jonathan is called away, Mark visits his former partner and uncovers a family secret; guest Shannen Doherty. Copyright Tribune Media Services, Inc.</Description><SourceChannel>186</SourceChannel><SourceStation>KNTVDT2</SourceStation><HighDefinition>No</HighDefinition><ProgramId>EP000020920031</ProgramId><SeriesId>SH002092</SeriesId><EpisodeNumber>7856</EpisodeNumber><StreamingPermission>Yes</StreamingPermission><TvRating>4</TvRating><ShowingBits>513</ShowingBits><SourceType>2</SourceType><IdGuideSource>36151</IdGuideSource></Details><Links><Content><Url>http://192.168.2.10:80/download/Highway%20to%20Heaven.TiVo?Container=%2FNowPlaying&id=1337048</Url><ContentType>video/x-tivo-raw-tts</ContentType></Content><CustomIcon><Url>urn:tivo:image:expired-recording</Url><ContentType>image/*</ContentType><AcceptsParams>No</AcceptsParams></CustomIcon><TiVoVideoDetails><Url>https://192.168.2.10:443/TiVoVideoDetails?id=1337048</Url><ContentType>text/xml</ContentType><AcceptsParams>No</AcceptsParams></TiVoVideoDetails></Links></Item><Item><Details><ContentType>video/x-tivo-raw-tts</ContentType><SourceFormat>video/x-tivo-raw-tts</SourceFormat><Title>The Brass Bottle</Title><SourceSize>4404019200</SourceSize><Duration>7198000</Duration><CaptureDate>0x50EDF66E</CaptureDate><ShowingDuration>7200000</ShowingDuration><ShowingStartTime>0x50EDF670</ShowingStartTime><Description>An architect finds an old bottle, out of which comes a genie eager to do his bidding. Copyright Tribune Media Services, Inc.</Description><SourceChannel>186</SourceChannel><SourceStation>KNTVDT2</SourceStation><HighDefinition>No</HighDefinition><ProgramId>MV000051870000</ProgramId><SeriesId>MV005187</SeriesId><StreamingPermission>Yes</StreamingPermission><TvRating>4</TvRating><MpaaRating>8</MpaaRating><ShowingBits>0</ShowingBits><SourceType>2</SourceType><IdGuideSource>36151</IdGuideSource></Details><Links><Content><Url>http://192.168.2.10:80/download/The%20Brass%20Bottle.TiVo?Container=%2FNowPlaying&id=1337047</Url><ContentType>video/x-tivo-raw-tts</ContentType></Content><CustomIcon><Url>urn:tivo:image:expired-recording</Url><ContentType>image/*</ContentType><AcceptsParams>No</AcceptsParams></CustomIcon><TiVoVideoDetails><Url>https://192.168.2.10:443/TiVoVideoDetails?id=1337047</Url><ContentType>text/xml</ContentType><AcceptsParams>No</AcceptsParams></TiVoVideoDetails></Links></Item><Item><Details><ContentType>video/x-tivo-raw-tts</ContentType><SourceFormat>video/x-tivo-raw-tts</SourceFormat><Title>Madame X</Title><SourceSize>4404019200</SourceSize><Duration>7198000</Duration><CaptureDate>0x50EDDA4E</CaptureDate><ShowingDuration>7200000</ShowingDuration><ShowingStartTime>0x50EDDA50</ShowingStartTime><Description>A young lawyer defends an alcoholic woman accused of murder, unaware that she is his mother. Copyright Tribune Media Services, Inc.</Description><SourceChannel>186</SourceChannel><SourceStation>KNTVDT2</SourceStation><HighDefinition>No</HighDefinition><ProgramId>MV000025610000</ProgramId><SeriesId>MV002561</SeriesId><StreamingPermission>Yes</StreamingPermission><TvRating>4</TvRating><MpaaRating>8</MpaaRating><ShowingBits>0</ShowingBits><SourceType>2</SourceType><IdGuideSource>36151</IdGuideSource></Details><Links><Content><Url>http://192.168.2.10:80/download/Madame%20X.TiVo?Container=%2FNowPlaying&id=1337046</Url><ContentType>video/x-tivo-raw-tts</ContentType></Content><CustomIcon><Url>urn:tivo:image:expired-recording</Url><ContentType>image/*</ContentType><AcceptsParams>No</AcceptsParams></CustomIcon><TiVoVideoDetails><Url>https://192.168.2.10:443/TiVoVideoDetails?id=1337046</Url><ContentType>text/xml</ContentType><AcceptsParams>No</AcceptsParams></TiVoVideoDetails></Links></Item><Item><Details><ContentType>video/x-tivo-raw-tts</ContentType><SourceFormat>video/x-tivo-raw-tts</SourceFormat><Title>The Millionaire Matchmaker</Title><SourceSize>2202009600</SourceSize><Duration>3598000</Duration><CaptureDate>0x50EDA20E</CaptureDate><ShowingDuration>3600000</ShowingDuration><ShowingStartTime>0x50EDA210</ShowingStartTime><EpisodeTitle>Dateapause</EpisodeTitle><Description>A globetrotting DJ and a mother of four search for matches. Copyright Tribune Media Services, Inc.</Description><SourceChannel>48</SourceChannel><SourceStation>BRAVOP</SourceStation><HighDefinition>No</HighDefinition><ProgramId>EP010175710037</ProgramId><SeriesId>SH01017571</SeriesId><EpisodeNumber>405</EpisodeNumber><StreamingPermission>Yes</StreamingPermission><TvRating>5</TvRating><ShowingBits>514</ShowingBits><SourceType>2</SourceType><IdGuideSource>31555</IdGuideSource></Details><Links><Content><Url>http://192.168.2.10:80/download/The%20Millionaire%20Matchmaker.TiVo?Container=%2FNowPlaying&id=1335933</Url><ContentType>video/x-tivo-raw-tts</ContentType></Content><CustomIcon><Url>urn:tivo:image:expired-recording</Url><ContentType>image/*</ContentType><AcceptsParams>No</AcceptsParams></CustomIcon><TiVoVideoDetails><Url>https://192.168.2.10:443/TiVoVideoDetails?id=1335933</Url><ContentType>text/xml</ContentType><AcceptsParams>No</AcceptsParams></TiVoVideoDetails></Links></Item><Item><Details><ContentType>video/x-tivo-raw-tts</ContentType><SourceFormat>video/x-tivo-raw-tts</SourceFormat><Title>Adventure in Baltimore</Title><SourceSize>3953131520</SourceSize><Duration>6300000</Duration><CaptureDate>0x50E69D92</CaptureDate><ShowingDuration>6300000</ShowingDuration><ShowingStartTime>0x50E69D94</ShowingStartTime><Description>A minister's teenage daughter grows up, gains a suitor and speaks out for women's rights. Copyright Tribune Media Services, Inc.</Description><SourceChannel>501</SourceChannel><SourceStation>TCM</SourceStation><HighDefinition>No</HighDefinition><ProgramId>MV000087180000</ProgramId><SeriesId>MV008718</SeriesId><StreamingPermission>Yes</StreamingPermission><MpaaRating>8</MpaaRating><ShowingBits>0</ShowingBits><SourceType>2</SourceType><IdGuideSource>12852</IdGuideSource></Details><Links><Content><Url>http://192.168.2.10:80/download/Adventure%20in%20Baltimore.TiVo?Container=%2FNowPlaying&id=1336373</Url><ContentType>video/x-tivo-raw-tts</ContentType></Content><CustomIcon><Url>urn:tivo:image:expired-recording</Url><ContentType>image/*</ContentType><AcceptsParams>No</AcceptsParams></CustomIcon><TiVoVideoDetails><Url>https://192.168.2.10:443/TiVoVideoDetails?id=1336373</Url><ContentType>text/xml</ContentType><AcceptsParams>No</AcceptsParams></TiVoVideoDetails></Links></Item><Item><Details><ContentType>video/x-tivo-raw-tts</ContentType><SourceFormat>video/x-tivo-raw-tts</SourceFormat><Title>Upside.Down.2012.BRRIP.XVID-AC3-PULSAR</Title><CopyProtected>Yes</CopyProtected><SourceSize>4278190080</SourceSize><Duration>6466000</Duration><CaptureDate>0x50E68505</CaptureDate><ShowingDuration>6420000</ShowingDuration><ShowingStartTime>0x50E68504</ShowingStartTime><EpisodeTitle>Upside.Down.2012.BRRIP.XVID-AC3-PULSAR</EpisodeTitle><Description>Upside.Down.2012.BRRIP.XVID-AC3-PULSAR Copyright Tribune Media Services, Inc.</Description><HighDefinition>No</HighDefinition><ProgramId>BS15000171</ProgramId><SeriesId>BS1430576535</SeriesId><StreamingPermission>Yes</StreamingPermission><ShowingBits>0</ShowingBits></Details><Links><Content><Url>http://192.168.2.10:80/download/Upside.Down.2012.BRRIP.XVID-AC3-PULSAR.TiVo?Container=%2FNowPlaying&id=1336589</Url><ContentType>video/x-tivo-raw-tts</ContentType><Available>No</Available></Content><CustomIcon><Url>urn:tivo:image:expired-recording</Url><ContentType>image/*</ContentType><AcceptsParams>No</AcceptsParams></CustomIcon><TiVoVideoDetails><Url>https://192.168.2.10:443/TiVoVideoDetails?id=1336589</Url><ContentType>text/xml</ContentType><AcceptsParams>No</AcceptsParams></TiVoVideoDetails></Links></Item><Item><Details><ContentType>video/x-tivo-raw-tts</ContentType><SourceFormat>video/x-tivo-raw-tts</SourceFormat><Title>Step.Brothers[2008][Unrated.Edition]DvDrip-ColinWithaT</Title><CopyProtected>Yes</CopyProtected><SourceSize>1929379840</SourceSize><Duration>6335000</Duration><CaptureDate>0x50E682F1</CaptureDate><ShowingDuration>6300000</ShowingDuration><ShowingStartTime>0x50E682EF</ShowingStartTime><EpisodeTitle>Step.Brothers[2008][Unrated.Edition]DvDrip-ColinWithaT</EpisodeTitle><Description>Step.Brothers[2008][Unrated.Edition]DvDrip-ColinWithaT Copyright Tribune Media Services, Inc.</Description><HighDefinition>No</HighDefinition><ProgramId>BS15000161</ProgramId><SeriesId>BS988614116</SeriesId><StreamingPermission>Yes</StreamingPermission><ShowingBits>0</ShowingBits></Details><Links><Content><Url>http://192.168.2.10:80/download/Step.Brothers%5B2008%5D%5BUnrated.Edition%5DDvDrip-ColinWithaT.TiVo?Container=%2FNowPlaying&id=1336588</Url><ContentType>video/x-tivo-raw-tts</ContentType><Available>No</Available></Content><CustomIcon><Url>urn:tivo:image:expired-recording</Url><ContentType>image/*</ContentType><AcceptsParams>No</AcceptsParams></CustomIcon><TiVoVideoDetails><Url>https://192.168.2.10:443/TiVoVideoDetails?id=1336588</Url><ContentType>text/xml</ContentType><AcceptsParams>No</AcceptsParams></TiVoVideoDetails></Links></Item><Item><Details><ContentType>video/x-tivo-raw-tts</ContentType><SourceFormat>video/x-tivo-raw-tts</SourceFormat><Title>Little Girl Lost: The Delimar Vera Story</Title><SourceSize>2202009600</SourceSize><Duration>7199000</Duration><CaptureDate>0x50E67DEE</CaptureDate><ShowingDuration>7200000</ShowingDuration><ShowingStartTime>0x50E67DF0</ShowingStartTime><Description>A woman who lost her daughter in a fire tries to prove that a young girl is the same child. Copyright Tribune Media Services, Inc.</Description><SourceChannel>504</SourceChannel><SourceStation>LMN</SourceStation><HighDefinition>No</HighDefinition><ProgramId>MV002286640000</ProgramId><SeriesId>MV228664</SeriesId><StreamingPermission>Yes</StreamingPermission><TvRating>4</TvRating><MpaaRating>8</MpaaRating><ShowingBits>1</ShowingBits><SourceType>2</SourceType><IdGuideSource>18480</IdGuideSource></Details><Links><Content><Url>http://192.168.2.10:80/download/Little%20Girl%20Lost%20The%20Delimar%20Vera%20Story.TiVo?Container=%2FNowPlaying&id=1336585</Url><ContentType>video/x-tivo-raw-tts</ContentType></Content><CustomIcon><Url>urn:tivo:image:expired-recording</Url><ContentType>image/*</ContentType><AcceptsParams>No</AcceptsParams></CustomIcon><TiVoVideoDetails><Url>https://192.168.2.10:443/TiVoVideoDetails?id=1336585</Url><ContentType>text/xml</ContentType><AcceptsParams>No</AcceptsParams></TiVoVideoDetails></Links></Item><Item><Details><ContentType>video/x-tivo-raw-tts</ContentType><SourceFormat>video/x-tivo-raw-tts</SourceFormat><Title>I'll Be Seeing You</Title><SourceSize>3282042880</SourceSize><Duration>5397000</Duration><CaptureDate>0x50E668DB</CaptureDate><ShowingDuration>5400000</ShowingDuration><ShowingStartTime>0x50E668D8</ShowingStartTime><Description>A woman on leave from prison meets a shellshocked veteran on furlough, and they fall in love at Christmas. Copyright Tribune Media Services, Inc.</Description><SourceChannel>501</SourceChannel><SourceStation>TCM</SourceStation><HighDefinition>No</HighDefinition><ProgramId>MV000009860000</ProgramId><SeriesId>MV000986</SeriesId><StreamingPermission>Yes</StreamingPermission><MpaaRating>8</MpaaRating><ShowingBits>0</ShowingBits><SourceType>2</SourceType><IdGuideSource>12852</IdGuideSource></Details><Links><Content><Url>http://192.168.2.10:80/download/I'll%20Be%20Seeing%20You.TiVo?Container=%2FNowPlaying&id=1334494</Url><ContentType>video/x-tivo-raw-tts</ContentType></Content><CustomIcon><Url>urn:tivo:image:expired-recording</Url><ContentType>image/*</ContentType><AcceptsParams>No</AcceptsParams></CustomIcon><TiVoVideoDetails><Url>https://192.168.2.10:443/TiVoVideoDetails?id=1334494</Url><ContentType>text/xml</ContentType><AcceptsParams>No</AcceptsParams></TiVoVideoDetails></Links></Item><Item><Details><ContentType>video/x-tivo-raw-tts</ContentType><SourceFormat>video/x-tivo-raw-tts</SourceFormat><Title>Weekend for Three</Title><SourceSize>2202009600</SourceSize><Duration>4500000</Duration><CaptureDate>0x50E617FA</CaptureDate><ShowingDuration>4500000</ShowingDuration><ShowingStartTime>0x50E617FC</ShowingStartTime><Description>A loud friend gets too friendly and wears out his welcome in a couple's home. Copyright Tribune Media Services, Inc.</Description><SourceChannel>501</SourceChannel><SourceStation>TCM</SourceStation><HighDefinition>No</HighDefinition><ProgramId>MV000166700000</ProgramId><SeriesId>MV016670</SeriesId><StreamingPermission>Yes</StreamingPermission><MpaaRating>8</MpaaRating><ShowingBits>0</ShowingBits><SourceType>2</SourceType><IdGuideSource>12852</IdGuideSource></Details><Links><Content><Url>http://192.168.2.10:80/download/Weekend%20for%20Three.TiVo?Container=%2FNowPlaying&id=1336372</Url><ContentType>video/x-tivo-raw-tts</ContentType></Content><CustomIcon><Url>urn:tivo:image:expired-recording</Url><ContentType>image/*</ContentType><AcceptsParams>No</AcceptsParams></CustomIcon><TiVoVideoDetails><Url>https://192.168.2.10:443/TiVoVideoDetails?id=1336372</Url><ContentType>text/xml</ContentType><AcceptsParams>No</AcceptsParams></TiVoVideoDetails></Links></Item><Item><Details><ContentType>video/x-tivo-raw-tts</ContentType><SourceFormat>video/x-tivo-raw-tts</SourceFormat><Title>Chelsea Lately</Title><SourceSize>2202009600</SourceSize><Duration>1796000</Duration><CaptureDate>0x50E54186</CaptureDate><ShowingDuration>1800000</ShowingDuration><ShowingStartTime>0x50E54188</ShowingStartTime><Description>Christina Aguilera; Blake Shelton; Adam Levine. Copyright Tribune Media Services, Inc.</Description><SourceChannel>64</SourceChannel><SourceStation>EP</SourceStation><HighDefinition>No</HighDefinition><ProgramId>EP009387531133</ProgramId><SeriesId>SH938753</SeriesId><StreamingPermission>Yes</StreamingPermission><TvRating>5</TvRating><ShowingBits>852480</ShowingBits><SourceType>2</SourceType><IdGuideSource>17561</IdGuideSource></Details><Links><Content><Url>http://192.168.2.10:80/download/Chelsea%20Lately.TiVo?Container=%2FNowPlaying&id=1335625</Url><ContentType>video/x-tivo-raw-tts</ContentType></Content><CustomIcon><Url>urn:tivo:image:expired-recording</Url><ContentType>image/*</ContentType><AcceptsParams>No</AcceptsParams></CustomIcon><TiVoVideoDetails><Url>https://192.168.2.10:443/TiVoVideoDetails?id=1335625</Url><ContentType>text/xml</ContentType><AcceptsParams>No</AcceptsParams></TiVoVideoDetails></Links></Item><Item><Details><ContentType>video/x-tivo-raw-tts</ContentType><SourceFormat>video/x-tivo-raw-tts</SourceFormat><Title>The Squall</Title><SourceSize>2202009600</SourceSize><Duration>7200000</Duration><CaptureDate>0x50E528EA</CaptureDate><ShowingDuration>7200000</ShowingDuration><ShowingStartTime>0x50E528EC</ShowingStartTime><Description>A gypsy woman applies her feminine charms to the male members of a farmhouse where she takes refuge during a storm. Copyright Tribune Media Services, Inc.</Description><SourceChannel>501</SourceChannel><SourceStation>TCM</SourceStation><HighDefinition>No</HighDefinition><ProgramId>MV000419870000</ProgramId><SeriesId>MV041987</SeriesId><StreamingPermission>Yes</StreamingPermission><MpaaRating>8</MpaaRating><ShowingBits>0</ShowingBits><SourceType>2</SourceType><IdGuideSource>12852</IdGuideSource></Details><Links><Content><Url>http://192.168.2.10:80/download/The%20Squall.TiVo?Container=%2FNowPlaying&id=1336371</Url><ContentType>video/x-tivo-raw-tts</ContentType></Content><CustomIcon><Url>urn:tivo:image:expired-recording</Url><ContentType>image/*</ContentType><AcceptsParams>No</AcceptsParams></CustomIcon><TiVoVideoDetails><Url>https://192.168.2.10:443/TiVoVideoDetails?id=1336371</Url><ContentType>text/xml</ContentType><AcceptsParams>No</AcceptsParams></TiVoVideoDetails></Links></Item></TiVoContainer>

Hope it's helpful!


----------



## Allanon

Vanclute, thanks for the data, it's always good to get more data to test. Did you try the latest version of the program? Are you still having problems?


Bradleys, I have no idea why the "&Format=video/x-tivo-mpeg" is being added to the end of your URL. I tested the XML File you gave me and it doesn't append that to the end. That XML file doesn't even have "&Format=" located in it. Today I will have access to a Windows 7 computer and I will test to see if I can reproduce the error. You might try removing the "&Format" part of the URL and see if that works. If it does then I can just remove it before opening the URL.


----------



## bradleys

Allanon said:


> Vanclute, thanks for the data, it's always good to get more data to test. Did you try the latest version of the program? Are you still having problems?
> 
> Bradleys, I have no idea why the "&Format=video/x-tivo-mpeg" is being added to the end of your URL. I tested the XML File you gave me and it doesn't append that to the end. That XML file doesn't even have "&Format=" located in it. Today I will have access to a Windows 7 computer and I will test to see if I can reproduce the error. You might try removing the "&Format" part of the URL and see if that works. If it does then I can just remove it before opening the URL.


_From your first post:
http://192.168.1.100:8000/download/...owPlaying&id=4707752&Format=video/x-tivo-mpeg_

I am sorry, that was based on the origional format from your first post. I have tried it with and without the "&Format="... Let me try it again tonight without. Sorry if I missed something.


----------



## Allanon

You should be using the unmodified URLs from the RSS feed that you get when you enter:

http://<Server_URL>:<Port>/rss

Server_URL and Port should be the same as what you set in the code.

I know Firefox doesn't show the urls in the RSS Feed but on my computer. I can click the listed .tivo link and have them play in Firefox. Or you can right click on the .tivo link and save the location and paste it in to VLC. View the page source to see the actual RSS Feed that was sent from my program. Chrome and IE show the actual RSS Feed code and you can just copy and paste.

Also, hope I don't sound frustrated or angry in my posts because I'm not. I enjoy programming and I really want to find this error and help you get it working. I have other feature ideas for this program so I would really want this to work on everyone's computer before going forward.

Edit:

I just tested the program on a Windows 7 computer and it worked fine without modifications.


----------



## vanclute

I did try the latest version, here's my result of pulling the RSS feed (get only a partial list) and clicking a link which tries to open in VLC:



Code:


192.168.2.16 - - [15/Jan/2013 12:48:56] "GET /rss HTTP/1.1" 200 -
RSS Feed Send

/download/I%27ll%20Be%20Seeing%20You.TiVo?Container=%2FNowPlaying&id=1334494

Video URL:  http://192.168.2.10:80/download/I%27ll%20Be%20Seeing%20You.TiVo?Container=%2FNowPlaying&id=1334494

192.168.2.16 - - [15/Jan/2013 12:49:07] "GET /download/I%27ll%20Be%20Seeing%20You.TiVo?Container=%2FNowPlaying&id=1334494 HTTP/1.1" 200 -

Decoding video

----------------------------------------
Exception happened during processing of request from ('192.168.2.16', 50824)
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 310, in process_request
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 323, in finish_request
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 639, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 343, in handle
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 331, in handle_one_request
  File "/Volumes/iMac Storage/Downloads/kmttg_MacOSX_tools_v0p8l/tivodecode/Tivo Proxy Server 4.py", line 162, in do_GET
    decode = subprocess.Popen(['tivodecode', '-m', Tivo_MAK, '--', '-'],shell=False,bufsize=0,stdin=subprocess.PIPE,stdout=subprocess.PIPE)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 679, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1228, in _execute_child
OSError: [Errno 2] No such file or directory
----------------------------------------

So still no joy. Ideas?


----------



## Allanon

vanclute said:


> So still no joy. Ideas?


That error occurs when the program can't find tivodecode. Do you have tivodecode in the same folder and the program?


----------



## bradleys

I am going to start over tonight with a complete reinstall. But I want to duplicate your setup.

Can you tell me where you installed TivoProxy:

C:\Program Files (x86)\TivoProxy\

Where you installed Tivodecode:

C:\Program Files (x86)\TivoProxy\tivodecode\

Where you installed python:

C:\Python27\


----------



## Allanon

bradleys said:


> I am going to start over tonight with a complete reinstall. But I want to duplicate your setup.
> 
> Can you tell me where you installed TivoProxy:
> 
> C:\Program Files (x86)\TivoProxy\
> 
> Where you installed Tivodecode:
> 
> C:\Program Files (x86)\TivoProxy\tivodecode\
> 
> Where you installed python:
> 
> C:\Python27\


I have Python in the c:\Python27 folder and for easy access I placed the "Tivo Proxy Server.py" and tivodecode.exe files on my desktop, but you can place them in any folder you like. I also have a batch file that looks like this:

*Tivo Proxy Server.bat*:


Code:


mode 150,10000
c:\python27\python.exe "Tivo Proxy Server.py"
pause

This is optional, I use it because it makes debugging the program easier. The pause command keeps the command window open when an error occurs.


----------



## bradleys

I will show you what I am getting:

I placed *Tivo Proxy Server.py* and *Tivodecode* on the desktop in a directory called Tivoproxy. This time I extracted Tivodecode into the directory *tivodecode-0.2pre4 *under Tivoproxy. Last time I extracted it directly into the directory. Same outcome. I edited *Tivo Proxy Server.py* and updated the params thusly:

Tivo_MAK = 'mymak'
Server_URL = '192.168.1.6'
Tivo_URL = '192.168.1.7'
Port = 10000










Right Click *Tivo Proxy Server.py* -> Open with -> Python and the console registers *Serving at Port 10000
*









Open the URL:


Code:


[B][url]http://192.168.1.6:10000/rss[/url][/B]

 in firefox and I get the RSS feed in xml form.


----------



## bradleys

I then try to open a url in firefox formatted in this way:


Code:


[B]http://192.168.1.6:10000/download/Face%20Off.TiVo?Container=%2FNowPlaying&id=2338141[/B]











And get a result in the python console showing the error:









I get the exact same results running via VLN


----------



## vanclute

Allanon said:


> That error occurs when the program can't find tivodecode. Do you have tivodecode in the same folder and the program?


Yep sure do, this server script is in the tivodecode directory.


----------



## Allanon

Bradleys, try running the program as administrator. Also try coping the URL from the RSS feed and pasting it in to VLC. The video doesn't play in every video player. My Firefox browser shows a VLC logo instead of a Quicktime logo when playing the video in the browser.

Vanclute, I'm unfamiliar with Mac's OS so I really don't know what is causing the problem. Maybe someone with Mac experience and Python knowledge can step in and help?


----------



## vanclute

Yeah I feel like it's a python issue but I have almost no experience with it at all. I do PHP development so it doesn't look totally unfamiliar but it's different enough to have me stumped. I did install the latest python version but that doesn't seem to have helped.


----------



## bradleys

OK, I created a batch file and ran it as administrator in VLN:

Still does not work, but the error code looks a little different. Personally, I think it is having problems finding tivodecode...



Code:


C:\Windows\system32>c:\python27\python.exe "C:\Users\Scott\Desktop\TivoProxy\Tivo Proxy Server.py"
serving at port 10000
/rss
HOME_OFFICE.home - - [15/Jan/2013 21:27:58] "GET /rss HTTP/1.1" 200 -
RSS Feed Send

/favicon.ico
/download/The%20Big%20Bang%20Theory.TiVo?Container=%2FNowPlaying&id=2338150

Video URL:  http://192.168.1.7:80/download/The%20Big%20Bang%20Theory.TiVo?Container=%2FNowPlaying&id=2338150

HOME_OFFICE.home - - [15/Jan/2013 21:28:10] "GET /download/The%20Big%20Bang%20Theory.TiVo?Container=%2FNowPlaying&id=2338150 HTTP/1.1" 200 -

Decoding video

----------------------------------------
Exception happened during processing of request from ('192.168.1.6', 54014)
Traceback (most recent call last):
  File "c:\python27\lib\SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "c:\python27\lib\SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "c:\python27\lib\SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "c:\python27\lib\SocketServer.py", line 638, in __init__
    self.handle()
  File "c:\python27\lib\BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "c:\python27\lib\BaseHTTPServer.py", line 328, in handle_one_request
    method()
  File "C:\Users\Scott\Desktop\TivoProxy\Tivo Proxy Server.py", line 160, in do_GET
    decode = subprocess.Popen(['tivodecode', '-m', Tivo_MAK, '--', '-'],shell=False,bufsize=0,stdin=subprocess.PIPE,stdout=subprocess.PIPE)
  File "c:\python27\lib\subprocess.py", line 679, in __init__
    errread, errwrite)
  File "c:\python27\lib\subprocess.py", line 896, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
----------------------------------------


----------



## Allanon

Bradleys, give this a try. It is a version of the program that includes tivodecode. Just copy the folder on to your desktop and run Tivo Server Proxy.bat as admin. If this doesn't work then I have no idea why it's failing on your computer. I've run this exact build on Windows 7 and it worked.

The tivodecode.exe included in this attachment is for Windows only.


----------



## bradleys

I brought home my work laptop that is running Windows XP and did a fresh install on everything... This works perfectly. 

I also installed it on my media server and it works great in that environment as well... But, just does not work on my Windows 7 desktop. Weird....


----------



## tatergator1

I've also tried my hand at getting this setup. I've had partial success. It seems to be choking on something in my XML file. I've got TivoServer.py running fine and I am using the "podcast" method in VLC to serve the files. Using this method, it pulls in only the most recent 6 programs recorded. When I then attempt to play any of those files, it is unable to serve the first 5, which is probably a result of Time Warner's "copy once" CCI byte. The 6th program is from a local channel and is not affected by the CCI byte.

I know I'm probably out of luck regarding that, but the real question is what is causing the XML to cut-out after the first 6 most recent shows.



Code:


serving at port 8000
/rss
Desktop - - [20/Jan/2013 22:24:58] "GET /rss HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('192.168.1.6', 59854)
Traceback (most recent call last):
  File "C:\Python27\lib\SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Python27\lib\SocketServer.py", line 639, in __init__
    self.handle()
  File "C:\Python27\lib\BaseHTTPServer.py", line 343, in handle
    self.handle_one_request()
  File "C:\Python27\lib\BaseHTTPServer.py", line 331, in handle_one_request
    method()
  File "C:\Users\Andrew\Desktop\Tivo Server\Tivo Proxy Server.py", line 130, in
do_GET
    writeRSS(self.wfile)
  File "C:\Users\Andrew\Desktop\Tivo Server\Tivo Proxy Server.py", line 96, in w
riteRSS
    p.feed(XML.read(), wfile)
  File "C:\Users\Andrew\Desktop\Tivo Server\Tivo Proxy Server.py", line 42, in f
eed
    self._parser.Parse(data, 0)
  File "C:\Users\Andrew\Desktop\Tivo Server\Tivo Proxy Server.py", line 64, in e
nd
    self.wfile.write('\t\t<' + tag + '>' + self.data + '</' + tag + '>\n')
  File "C:\Python27\lib\socket.py", line 316, in write
    data = str(data) # XXX Should really reject non-string non-buffers
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in position 33:
 ordinal not in range(128)
----------------------------------------

When I try to play the 6 videos, I get:



Code:


----------------------------------------
/download/Max%20%26%20Ruby.TiVo?Container=%2FNowPlaying&id=232446

Video URL:  [url]http://192.168.1.100:80/download/Max%20%26%20Ruby.TiVo?Container=%2FNowPlaying&id=232446[/url]


Desktop - - [20/Jan/2013 22:28:20] "GET /download/Max%20%26%20Ruby.TiVo?Container=%2FNowPlaying&id=2
32446 HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('192.168.1.6', 59866)
Traceback (most recent call last):
  File "C:\Python27\lib\SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Python27\lib\SocketServer.py", line 639, in __init__
    self.handle()
  File "C:\Python27\lib\BaseHTTPServer.py", line 343, in handle
    self.handle_one_request()
  File "C:\Python27\lib\BaseHTTPServer.py", line 331, in handle_one_request
    method()
  File "C:\Users\Andrew\Desktop\Tivo Server\Tivo Proxy Server.py", line 153, in do_GET
    videoFile =  openUrl(link, 'tivo', Tivo_MAK)
  File "C:\Users\Andrew\Desktop\Tivo Server\Tivo Proxy Server.py", line 24, in openUrl
    return urllib2.urlopen(url)
  File "C:\Python27\lib\urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\Python27\lib\urllib2.py", line 400, in open
    response = meth(req, response)
  File "C:\Python27\lib\urllib2.py", line 513, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python27\lib\urllib2.py", line 432, in error
    result = self._call_chain(*args)
  File "C:\Python27\lib\urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 1072, in http_error_401
    host, req, headers)
  File "C:\Python27\lib\urllib2.py", line 957, in http_error_auth_reqed
    return self.retry_http_digest_auth(req, authreq)
  File "C:\Python27\lib\urllib2.py", line 968, in retry_http_digest_auth
    resp = self.parent.open(req, timeout=req.timeout)
  File "C:\Python27\lib\urllib2.py", line 400, in open
    response = meth(req, response)
  File "C:\Python27\lib\urllib2.py", line 513, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python27\lib\urllib2.py", line 438, in error
    return self._call_chain(*args)
  File "C:\Python27\lib\urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 521, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 403: Forbidden
----------------------------------------
/download/Mickey%20Mouse%20Clubhouse.TiVo?Container=%2FNowPlaying&id=232443

Video URL:  [url]http://192.168.1.100:80/download/Mickey%20Mouse%20Clubhouse.TiVo?Container=%2FNowPlaying[/url]
&id=232443

Desktop - - [20/Jan/2013 22:28:20] "GET /download/Mickey%20Mouse%20Clubhouse.TiVo?Container=%2FNowPl
aying&id=232443 HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('192.168.1.6', 59871)
Traceback (most recent call last):
  File "C:\Python27\lib\SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Python27\lib\SocketServer.py", line 639, in __init__
    self.handle()
  File "C:\Python27\lib\BaseHTTPServer.py", line 343, in handle
    self.handle_one_request()
  File "C:\Python27\lib\BaseHTTPServer.py", line 331, in handle_one_request
    method()
  File "C:\Users\Andrew\Desktop\Tivo Server\Tivo Proxy Server.py", line 153, in do_GET
    videoFile =  openUrl(link, 'tivo', Tivo_MAK)
  File "C:\Users\Andrew\Desktop\Tivo Server\Tivo Proxy Server.py", line 24, in openUrl
    return urllib2.urlopen(url)
  File "C:\Python27\lib\urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\Python27\lib\urllib2.py", line 400, in open
    response = meth(req, response)
  File "C:\Python27\lib\urllib2.py", line 513, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python27\lib\urllib2.py", line 432, in error
    result = self._call_chain(*args)
  File "C:\Python27\lib\urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 1072, in http_error_401
    host, req, headers)
  File "C:\Python27\lib\urllib2.py", line 957, in http_error_auth_reqed
    return self.retry_http_digest_auth(req, authreq)
  File "C:\Python27\lib\urllib2.py", line 968, in retry_http_digest_auth
    resp = self.parent.open(req, timeout=req.timeout)
  File "C:\Python27\lib\urllib2.py", line 400, in open
    response = meth(req, response)
  File "C:\Python27\lib\urllib2.py", line 513, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python27\lib\urllib2.py", line 438, in error
    return self._call_chain(*args)
  File "C:\Python27\lib\urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 521, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 403: Forbidden
----------------------------------------
/download/Blue's%20Clues.TiVo?Container=%2FNowPlaying&id=232448

Video URL:  [url]http://192.168.1.100:80/download/Blue's%20Clues.TiVo?Container=%2FNowPlaying&id=232448[/url]

Desktop - - [20/Jan/2013 22:28:21] "GET /download/Blue's%20Clues.TiVo?Container=%2FNowPlaying&id=232
448 HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('192.168.1.6', 59876)
Traceback (most recent call last):
  File "C:\Python27\lib\SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Python27\lib\SocketServer.py", line 639, in __init__
    self.handle()
  File "C:\Python27\lib\BaseHTTPServer.py", line 343, in handle
    self.handle_one_request()
  File "C:\Python27\lib\BaseHTTPServer.py", line 331, in handle_one_request
    method()
  File "C:\Users\Andrew\Desktop\Tivo Server\Tivo Proxy Server.py", line 153, in do_GET
    videoFile =  openUrl(link, 'tivo', Tivo_MAK)
  File "C:\Users\Andrew\Desktop\Tivo Server\Tivo Proxy Server.py", line 24, in openUrl
    return urllib2.urlopen(url)
  File "C:\Python27\lib\urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\Python27\lib\urllib2.py", line 400, in open
    response = meth(req, response)
  File "C:\Python27\lib\urllib2.py", line 513, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python27\lib\urllib2.py", line 432, in error
    result = self._call_chain(*args)
  File "C:\Python27\lib\urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 1072, in http_error_401
    host, req, headers)
  File "C:\Python27\lib\urllib2.py", line 957, in http_error_auth_reqed
    return self.retry_http_digest_auth(req, authreq)
  File "C:\Python27\lib\urllib2.py", line 968, in retry_http_digest_auth
    resp = self.parent.open(req, timeout=req.timeout)
  File "C:\Python27\lib\urllib2.py", line 400, in open
    response = meth(req, response)
  File "C:\Python27\lib\urllib2.py", line 513, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python27\lib\urllib2.py", line 438, in error
    return self._call_chain(*args)
  File "C:\Python27\lib\urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 521, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 403: Forbidden
----------------------------------------
/download/Hercules.TiVo?Container=%2FNowPlaying&id=234088

Video URL:  [url]http://192.168.1.100:80/download/Hercules.TiVo?Container=%2FNowPlaying&id=234088[/url]

Desktop - - [20/Jan/2013 22:28:21] "GET /download/Hercules.TiVo?Container=%2FNowPlaying&id=234088 HT
TP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('192.168.1.6', 59881)
Traceback (most recent call last):
  File "C:\Python27\lib\SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Python27\lib\SocketServer.py", line 639, in __init__
    self.handle()
  File "C:\Python27\lib\BaseHTTPServer.py", line 343, in handle
    self.handle_one_request()
  File "C:\Python27\lib\BaseHTTPServer.py", line 331, in handle_one_request
    method()
  File "C:\Users\Andrew\Desktop\Tivo Server\Tivo Proxy Server.py", line 153, in do_GET
    videoFile =  openUrl(link, 'tivo', Tivo_MAK)
  File "C:\Users\Andrew\Desktop\Tivo Server\Tivo Proxy Server.py", line 24, in openUrl
    return urllib2.urlopen(url)
  File "C:\Python27\lib\urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\Python27\lib\urllib2.py", line 400, in open
    response = meth(req, response)
  File "C:\Python27\lib\urllib2.py", line 513, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python27\lib\urllib2.py", line 432, in error
    result = self._call_chain(*args)
  File "C:\Python27\lib\urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 1072, in http_error_401
    host, req, headers)
  File "C:\Python27\lib\urllib2.py", line 957, in http_error_auth_reqed
    return self.retry_http_digest_auth(req, authreq)
  File "C:\Python27\lib\urllib2.py", line 968, in retry_http_digest_auth
    resp = self.parent.open(req, timeout=req.timeout)
  File "C:\Python27\lib\urllib2.py", line 400, in open
    response = meth(req, response)
  File "C:\Python27\lib\urllib2.py", line 513, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python27\lib\urllib2.py", line 438, in error
    return self._call_chain(*args)
  File "C:\Python27\lib\urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 521, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 403: Forbidden
----------------------------------------
/download/Mickey%20Mouse%20Clubhouse.TiVo?Container=%2FNowPlaying&id=232231

Video URL:  [url]http://192.168.1.100:80/download/Mickey%20Mouse%20Clubhouse.TiVo?Container=%2FNowPlaying[/url]
&id=232231

Desktop - - [20/Jan/2013 22:28:22] "GET /download/Mickey%20Mouse%20Clubhouse.TiVo?Container=%2FNowPl
aying&id=232231 HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('192.168.1.6', 59886)
Traceback (most recent call last):
  File "C:\Python27\lib\SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Python27\lib\SocketServer.py", line 639, in __init__
    self.handle()
  File "C:\Python27\lib\BaseHTTPServer.py", line 343, in handle
    self.handle_one_request()
  File "C:\Python27\lib\BaseHTTPServer.py", line 331, in handle_one_request
    method()
  File "C:\Users\Andrew\Desktop\Tivo Server\Tivo Proxy Server.py", line 153, in do_GET
    videoFile =  openUrl(link, 'tivo', Tivo_MAK)
  File "C:\Users\Andrew\Desktop\Tivo Server\Tivo Proxy Server.py", line 24, in openUrl
    return urllib2.urlopen(url)
  File "C:\Python27\lib\urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\Python27\lib\urllib2.py", line 400, in open
    response = meth(req, response)
  File "C:\Python27\lib\urllib2.py", line 513, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python27\lib\urllib2.py", line 432, in error
    result = self._call_chain(*args)
  File "C:\Python27\lib\urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 1072, in http_error_401
    host, req, headers)
  File "C:\Python27\lib\urllib2.py", line 957, in http_error_auth_reqed
    return self.retry_http_digest_auth(req, authreq)
  File "C:\Python27\lib\urllib2.py", line 968, in retry_http_digest_auth
    resp = self.parent.open(req, timeout=req.timeout)
  File "C:\Python27\lib\urllib2.py", line 400, in open
    response = meth(req, response)
  File "C:\Python27\lib\urllib2.py", line 513, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python27\lib\urllib2.py", line 438, in error
    return self._call_chain(*args)
  File "C:\Python27\lib\urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 521, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 403: Forbidden
----------------------------------------
/download/CBS%20Evening%20News%20With%20Scott%20Pelley.TiVo?Container=%2FNowPlaying&id=232019

Video URL:  [url]http://192.168.1.100:80/download/CBS%20Evening%20News%20With%20Scott%20Pelley.TiVo?Container=%2FNowPlaying&id=232019[/url]


Desktop - - [20/Jan/2013 22:28:22] "GET /download/CBS%20Evening%20News%20With%20Scott%20Pelley.TiVo?Container=%2FNowPlaying&id=232019 HTTP/1.1" 200 -

Decoding video

Encryption by QUALCOMM ;)

I'd appreciate any effort you might make to see what's going on. Also, If i try to load the RSS via Firefox, I get the following:



> XML Parsing Error: no element found
> Location: http://192.168.1.6:8000/rss
> Line Number 45, Column 1:


Here's the accompanying XML file:

Thanks,


----------



## Allanon

Tatergator1, the Tivo XML file had an episode title with unicode (Daisy, la Quinceañera). I fixed the program so it replaces the unicode with the equivalent ascii character. If there isn't one then a ? is put in place of the character.

Also, try running the program as administrator to get rid of the forbidden error.

Attached is the updated code:


----------



## tatergator1

Thanks so much for the update. I really appreciate you taking the time to review my situation. My RSS feed has increased to 16 times and no errors are listed anywhere. 

The question is, why isn't it parsing all 90+ items that I can see in my XML file?

As for the Forbidden 403's, I'm very confident those are related to the copy protection blocking transfers of those programs. I am currently running as admin, so that shouldn't be a problem. For example, with the larger RSS feed, I can play 3 of the 16 items, with the 3 items I can play being on CBS and PBS, which Time Warner Cable can't legally copy-protect.

Any thoughts on why I only get 16 of my 90+ items?


----------



## Allanon

tatergator1 said:


> The question is, why isn't it parsing all 90+ items that I can see in my XML file?


Is this a different XML file than the one posted? The one posted only had 16 items.


----------



## tatergator1

My mistake. There are only 16 items in the XML generated yesterday evening, What was throwing me off was the <Total Items> line that shows 98. I just reloaded the XML file off the Tivo Premiere and it's still only showing the most recent 16 Items, while <total items> is now 99.

Now the question is why is the Tivo generated XML file incomplete?

Update: I just loaded the XML off my old Series 2 DT for the first time as a test and the generated XML shows <total items> 58 and <item count> 58. Everything looks good from the Series 2. Now, why is the Premiere XML incomplete?

Another update:

Found this discussion here.

Looks like Premiere's have deliberately truncated XML's. I can get up to 50 items in the XML by adding &ItemCount=50 to the URL. I would then need to run another XML grab by using AnchorOffset=51&ItemCount=50. Makes things a bit more complicated.


----------



## Allanon

Tatergator1, I will update the program to account for this. Guess I better start recording some shows so I can test.


----------



## Allanon

Attached is an updated version of the code. This version will list all videos in the RSS feed, not just the first 16.

Tatergator1, thanks for discovering the bug and providing a link to a way to solve the problem. It made fixing the problem very easy.


----------



## tatergator1

That did it! Thanks for taking the time to address my problems. This should be a good way to let my wife watch some of her shows in the Office/Craft Room without having to spend the 10+ minutes to download the whole .tivo file. This is a nice way to MRV without the Tivo. You give up trick-play capabilities, but you get near-instant playback straight from the host Tivo.

This will be a nice solution until Tivo finally releases more details and pricing on the Mini!


----------



## bradleys

What we need now is a decent video server that can take a custom RSS feed and be served in the home (maybe externally). I have tried plugins for both plex and Windows Media server and haven't found anything that works perfectly yet. 

Most of what I am looking at are designed around video podcasts...


----------



## Allanon

bradleys said:


> What we need now is a decent video server that can take a custom RSS feed and be served in the home (maybe externally). I have tried plugins for both plex and Windows Media server and haven't found anything that works perfectly yet.
> 
> Most of what I am looking at are designed around video podcasts...


I got it to work with both Serviio Media Server and PS3 Media Server. I use these to stream to my Sony TV and Xbox 360.


----------



## bradleys

I want to say that this new version has fixed all of my issues! The rss is properly formatted and I can play and stream video's. 

Allanon, when you have a chance - can you take a quick screen print to show me how you have the rss feed configured on the Serviio counsole? 

I am not seeing the feed and I am sure it is just me being dense.


----------



## Allanon

bradleys said:


> Allanon, when you have a chance - can you take a quick screen print to show me how you have the rss feed configured on the Serviio counsole?












1. Open the Serviio console
2. Click on "Library" 
3. Click on "Online sources"
4. Click on "Add"
5. Enter RSS feed and name then click "Add"
6. Click on "Save"

Serviio should read the RSS feed and launch ffmpeg to check each video in the feed. You should probably turn on transcoding so the video is converted in to the proper format for your devices. It might take a while before the program actually reads the RSS feed. You won't be able to see the videos on your device until the RSS feed and ffmpeg process has been preformed.


----------



## bradleys

OK, that is how I set it up - but I wasn't very patient! 

I want to say again that this is now working perfectly. I am wondering if the number of shows on my TiVo was giving us an invalid xml file at the break. Anyway, thanks a lot for the work.


----------



## tatergator1

Out of curiosity, using Serviio and serving to your Sony TV or Xbox, do you have FF/REW capabilities of the video?


----------



## Allanon

tatergator1 said:


> Out of curiosity, using Serviio and serving to your Sony TV or Xbox, do you have FF/REW capabilities of the video?


No, FF/REW, just pause.


----------



## csell

Quick question - I finally was able to get this working (for the most part). Anyway, is it true that this does not work on copyrighted video? It seems to not play any copyrighted material but will play all of the ones that are not. Is this true or am I missing something?


----------



## tatergator1

Yes. It will not play anything that you would not be able to transfer to your computer. This is using the capabilities of the TIVO HME system. The only way to watch copy-protected videos is via true streaming between Tivo Premieres or in your home network with the Tivo Stream.

The set-up acts like a video "stream", but this is really just transferring and displaying the video on to non-Tivo peripherals, and transfers aren't permitted with copy-protected shows.


----------



## jlobello

I found this thread & tried out the software last night. It seems to be working perfectly from VLC. I was able to have VLC view the RSS feed, then click on an entry & the video starts up right away! This seems like a great idea, rather than waiting for the whole video to transfer -- you can start viewing it right away. Trick play is obviously not working, as is to be expected. 

I also tried viewing a show on my iphone. Mobile safari doesn't know how to deal with RSS feeds, so that didn't work. Instead I sent an e-mail to myself with the direct URL to a show. I was then able to use the app, oplayer lite, to view a show!! But, sound was not working, which I think is due to an oplayer bug.


----------



## csell

jlobello said:


> I found this thread & tried out the software last night. It seems to be working perfectly from VLC. I was able to have VLC view the RSS feed, then click on an entry & the video starts up right away! This seems like a great idea, rather than waiting for the whole video to transfer -- you can start viewing it right away. Trick play is obviously not working, as is to be expected.
> 
> I also tried viewing a show on my iphone. Mobile safari doesn't know how to deal with RSS feeds, so that didn't work. Instead I sent an e-mail to myself with the direct URL to a show. I was then able to use the app, oplayer lite, to view a show!! But, sound was not working, which I think is due to an oplayer bug.


I just found it yesterday as well and spent a few hours to get it up and running. Very cool and great work was done on it. Unfortunately it seems like 80% of my shows are copyrighted and thus can't be transferred. So I probably won't spend anymore time on it cause of that fact. But again, great work by all involved.


----------



## tatergator1

csell said:


> I just found it yesterday as well and spent a few hours to get it up and running. Very cool and great work was done on it. Unfortunately it seems like 80% of my shows are copyrighted and thus can't be transferred. So I probably won't spend anymore time on it cause of that fact. But again, great work by all involved.


Let me guess, Time Warner Cable? I feel you pain. Only broadcast stations (CBS, NBC, etc.) are viewable for me.

I think a lot of people would find this useful, but it's been flying under the radar for a while. I see two drawbacks to the method: copy-protection, and lack of FF/REW. Perhaps a solution to FF/REW could be developed, but copy-protection circumvention is a non-starter. Still, Allanon has developed a relatively easy to implement MRV method that doesn't require another Tivo box.


----------



## csell

tatergator1 said:


> Still, Allanon has developed a relatively easy to implement MRV method that doesn't require another Tivo box.


Tell me more!


----------



## tatergator1

I was speaking some what generally, but I believe he's had success using Serviio Media Server in conjunction with the python script. Serviio can deliver the video to a number of Smart TV's as well as PS3's, Xbox 360's, etc. See here: http://www.serviio.org/features.

There is some discussion of how to set that up within this thread as well.


----------



## csell

tatergator1 said:


> I was speaking some what generally, but I believe he's had success using Serviio Media Server in conjunction with the python script. Serviio can deliver the video to a number of Smart TV's as well as PS3's, Xbox 360's, etc. See here: http://www.serviio.org/features.
> 
> There is some discussion of how to set that up within this thread as well.


But the copy protection issue still applies?


----------



## tatergator1

csell said:


> But the copy protection issue still applies?


Yes, as I mentioned above, getting around the copy-protection is not possible. We just have to wait for the Tivo Mini (which will do true streaming) and hope the pricing is reasonable, or have multiple Premiere boxes to stream the copy-protected stuff.


----------



## Allanon

I first developed this program so I could instantly watch TiVo videos on my Sony smart TV. I knew FF/REW and copy protected files was not going to be possible. But after thinking about the FF/REW problem there is probably a solution, it would require decoding the TiVo file to a file on disk then feeding that file to the media server. The downside is you will need a few GB of free space on your hard drive. I could probably add this feature as an option.

I also would like to add a HTML webpage that will have links to the videos. This will make it easier to play in a browser. And I've also thought about adding my own UPNP server which would eliminate the need for a separate media server. But these are just things I'd like to do and I'm making no promises on them ever being added. 

If you have any ideas for this program please post them.

Also, I will probably start a new thread on this forum for this program. It will have a description and documentation as the first post and I can just keep updating that post with changes opposed to a new version in each post I make.


----------



## vanclute

Been absent a bit and I see that much has happened with this! I can now see the entire Now Playing list. Unfortunately, playback still fails completely. 



Code:


Video URL:  http://192.168.2.10:80/download/The%20Asphalt%20Jungle.TiVo?Container=%2FNowPlaying&id=1336368

192.168.2.16 - - [26/Jan/2013 01:42:05] "GET /download/The%20Asphalt%20Jungle.TiVo?Container=%2FNowPlaying&id=1336368 HTTP/1.1" 200 -

Decoding video

----------------------------------------
Exception happened during processing of request from ('192.168.2.16', 50181)
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 310, in process_request
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 323, in finish_request
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 639, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 337, in handle
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 325, in handle_one_request
  File "/Applications/Tivo Proxy Server 5.py", line 172, in do_GET
    decode = subprocess.Popen(['tivodecode', '-n','-m', Tivo_MAK, '--', '-'],shell=False,bufsize=0,stdin=subprocess.PIPE,stdout=subprocess.PIPE)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
OSError: [Errno 2] No such file or directory
----------------------------------------

Any idea why?


----------



## Allanon

vanclute said:


> Been absent a bit and I see that much has happened with this! I can now see the entire Now Playing list. Unfortunately, playback still fails completely.
> 
> 
> 
> Code:
> 
> 
> Video URL:  http://192.168.2.10:80/download/The%20Asphalt%20Jungle.TiVo?Container=%2FNowPlaying&id=1336368
> 
> 192.168.2.16 - - [26/Jan/2013 01:42:05] "GET /download/The%20Asphalt%20Jungle.TiVo?Container=%2FNowPlaying&id=1336368 HTTP/1.1" 200 -
> 
> Decoding video
> 
> ----------------------------------------
> Exception happened during processing of request from ('192.168.2.16', 50181)
> Traceback (most recent call last):
> File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
> File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 310, in process_request
> File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 323, in finish_request
> File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 639, in __init__
> File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 337, in handle
> File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 325, in handle_one_request
> File "/Applications/Tivo Proxy Server 5.py", line 172, in do_GET
> decode = subprocess.Popen(['tivodecode', '-n','-m', Tivo_MAK, '--', '-'],shell=False,bufsize=0,stdin=subprocess.PIPE,stdout=subprocess.PIPE)
> File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
> File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
> OSError: [Errno 2] No such file or directory
> ----------------------------------------
> 
> Any idea why?


That error happens when tivodecode can't be found. Do you have tivodecode in the same directory as the program? Are you running the program directly out of the program's directory?


----------



## vanclute

As a matter of fact I was not running it where tivodecode was, so thanks for pointing that out.

However, even when running it within the tivodecode directory, I get the identical error.


----------



## Allanon

vanclute said:


> As a matter of fact I was not running it where tivodecode was, so thanks for pointing that out.
> 
> However, even when running it within the tivodecode directory, I get the identical error.


Attached is a new version that attaches the current directory path to the front of tivodecode in the popen() call. It also prints out the command that is being called which might help debug the problem. Make sure tivodecode is in the same folder as Tivo Proxy Server before running. If you get an error then please post the output so I can see the command that is being called.

This version also adds a HTML webpage that has links and descriptions for the videos. I have VLC as my default player and I can just click on the link and have the video play in the web browser. To use just enter the following in to a web browser:


Code:


http://<Server_IP>:<Port>/html


----------



## srauly

bradleys said:


> If I get this working the next step is to try to feed this to my Plex Media Server using the feed me plugin. With that you can stream to Roku boxes, xbox... Heck, any number of devices.


Please post back if you get this working with Plex.


----------



## vanclute

No apparent change I don't think...



Code:


Video URL:  http://192.168.2.10:80/download/Biggest%20Baddest%20Model%20Moments.TiVo?Container=%2FNowPlaying&id=1338396

192.168.2.16 - - [28/Jan/2013 15:04:37] "GET /download/Biggest%20Baddest%20Model%20Moments.TiVo?Container=%2FNowPlaying&id=1338396 HTTP/1.1" 200 -

Decoding video

['/Users/user/tivodecode', '-n', '-m', '***********', '--', '-']

----------------------------------------
Exception happened during processing of request from ('192.168.2.16', 51563)
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 310, in process_request
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 323, in finish_request
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 639, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 337, in handle
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 325, in handle_one_request
  File "/Users/user/Desktop/tivodecode/Tivo Proxy Server 6.py", line 229, in do_GET
    decode = subprocess.Popen(cmd,shell=False,bufsize=0,stdin=subprocess.PIPE,stdout=subprocess.PIPE)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
OSError: [Errno 2] No such file or directory
----------------------------------------


----------



## vanclute

OK I might be onto something. I noticed in the output, this line is wrong:

['/Users/user/tivodecode', '-n', '-m', '***********', '--', '-']

The correct path would be /Users/user/Desktop/tivodecode since I have my tivodecode folder on the desktop. So I changed this:



Code:


                cmd = [os.path.join(os.getcwd(), 'tivodecode'), '-n','-m', Tivo_MAK, '--', '-']

to this:



Code:


                cmd = [os.path.join(os.getcwd(), 'Desktop/tivodecode/tivodecode'), '-n','-m', Tivo_MAK, '--', '-']

and now I get this:



Code:


serving at port 10001
/rss
Sending RSS Feed

192.168.2.16 - - [28/Jan/2013 15:59:28] "GET /rss HTTP/1.1" 200 -
RSS Feed Sent

/download/Biggest%20Baddest%20Model%20Moments.TiVo?Container=%2FNowPlaying&id=1338396

Video URL:  http://192.168.2.10:80/download/Biggest%20Baddest%20Model%20Moments.TiVo?Container=%2FNowPlaying&id=1338396

192.168.2.16 - - [28/Jan/2013 15:59:50] "GET /download/Biggest%20Baddest%20Model%20Moments.TiVo?Container=%2FNowPlaying&id=1338396 HTTP/1.1" 200 -

Decoding video

['/Users/user/Desktop/tivodecode/tivodecode', '-n', '-m', '***********', '--', '-']

Launch of "tivodecode" failed: the PowerPC architecture is no longer supported.
Disconnect

Progress?


----------



## Allanon

vanclute said:


> OK I might be onto something. I noticed in the output, this line is wrong:
> 
> ['/Users/user/tivodecode', '-n', '-m', '***********', '--', '-']
> 
> The correct path would be /Users/user/Desktop/tivodecode since I have my tivodecode folder on the desktop. So I changed this:
> 
> 
> 
> Code:
> 
> 
> cmd = [os.path.join(os.getcwd(), 'tivodecode'), '-n','-m', Tivo_MAK, '--', '-']
> 
> to this:
> 
> 
> 
> Code:
> 
> 
> cmd = [os.path.join(os.getcwd(), 'Desktop/tivodecode/tivodecode'), '-n','-m', Tivo_MAK, '--', '-']
> 
> and now I get this:
> 
> 
> 
> Code:
> 
> 
> serving at port 10001
> /rss
> Sending RSS Feed
> 
> 192.168.2.16 - - [28/Jan/2013 15:59:28] "GET /rss HTTP/1.1" 200 -
> RSS Feed Sent
> 
> /download/Biggest%20Baddest%20Model%20Moments.TiVo?Container=%2FNowPlaying&id=1338396
> 
> Video URL:  http://192.168.2.10:80/download/Biggest%20Baddest%20Model%20Moments.TiVo?Container=%2FNowPlaying&id=1338396
> 
> 192.168.2.16 - - [28/Jan/2013 15:59:50] "GET /download/Biggest%20Baddest%20Model%20Moments.TiVo?Container=%2FNowPlaying&id=1338396 HTTP/1.1" 200 -
> 
> Decoding video
> 
> ['/Users/user/Desktop/tivodecode/tivodecode', '-n', '-m', '**********', '--', '-']
> 
> Launch of "tivodecode" failed: the PowerPC architecture is no longer supported.
> Disconnect
> 
> Progress?


Apparently on a mac the path is not being set to the program's path. You corrected the path and tivodecode must have been launched. What I don't know is if tivodecode or python is putting the "no longer supported" message. Can you try running tivodecode on a .tivo file from a command promp without my program? I want to see if tivodecode prints that message. If it does then you might need a different version that supports your OS.


----------



## vanclute

Ooooh... I think we might be getting somewhere.

I grabbed the copy of tivodecode that I actually use currently with kmttg, and got something new:



Code:


Encryption by QUALCOMM ;)

Disconnect
----------------------------------------
Exception happened during processing of request from ('192.168.2.16', 51787)
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 310, in process_request
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 323, in finish_request
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 641, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 694, in finish
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 303, in flush
error: [Errno 32] Broken pipe
----------------------------------------

So, are we close to something perhaps?


----------



## Allanon

Vanclute, attached is an update that should fix the tivodecode path problem and hopefully fix the latest error you are getting.


----------



## vanclute

sigh... afraid not:



Code:


/Users/user/Desktop/tivodecode/tivodecode

Encryption by QUALCOMM ;)

Disconnect
----------------------------------------
Exception happened during processing of request from ('192.168.2.16', 50955)
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 310, in process_request
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 323, in finish_request
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 641, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 694, in finish
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 303, in flush
error: [Errno 32] Broken pipe
----------------------------------------

Path is correct now but still no playback.


----------



## vanclute

oops nevermind this... last post still accurate.


----------



## Allanon

Vanclute, remove the # character from these three lines of code at the bottom of the code then try running:



Code:


httpd.socket.setsockopt(socket.SOL_TCP, socket.TCP_KEEPIDLE, 1)
httpd.socket.setsockopt(socket.SOL_TCP, socket.TCP_KEEPINTVL, 1)
httpd.socket.setsockopt(socket.SOL_TCP, socket.TCP_KEEPCNT, 5)

This code doesn't work on Windows but research shows it might work for mac and Linux.


----------



## vanclute

Uncommenting those lines and running the script, I get:



Code:


Traceback (most recent call last):
  File "/Users/user/Desktop/tivodecode_MacOSX_intel/Tivo Proxy Server 7.py", line 326, in <module>
    httpd.socket.setsockopt(socket.SOL_TCP, socket.TCP_KEEPIDLE, 1)
AttributeError: 'module' object has no attribute 'TCP_KEEPIDLE'
logout

[Process completed]

Next ideas?


----------



## Allanon

Vanclute, delete those three lines, I guess they only work in Linux. I've seen reports of that "Broken pipe" error being caused by a firewall. Try turning off your firewall and testing the program. I'm starting to run out of ideas so hopefully it's your firewall.


----------



## vanclute

sadly the firewall isn't running so... that's definitely not it.

Will delete those lines (though they were commented out previously weren't they?) and see what happens...

EDIT: No joy... broken pipe. Are there by chance any other Mac users who could take a stab at this so I can make sure it's not just me?


----------



## Allanon

Vanclute, try this version. In case tivodecode is taking it's time loading, I put a 5 second delay before sending any data to tivodecode. Also, maybe data is being transferred too fast so I reduced the number of bytes being read and written at one time.


----------



## wmcbrine

Allanon said:


> Vanclute, try this version. In case tivodecode is taking it's time loading, I put a 5 second delay before sending any data to tivodecode. Also, maybe data is being transferred too fast so I reduced the number of bytes being read and written at one time.


I haven't looked at this in enough detail to know what the problem _is_, but I can guarantee you're barking up the wrong tree with those changes.


----------



## vanclute

Alas wmcbrine appears to be correct, no change with the latest version.


----------



## vanclute

So are we at a dead on with this on Mac?  I was so hopeful...


----------



## Allanon

vanclute said:


> So are we at a dead on with this on Mac?  I was so hopeful...


I don't know how to correct your error. Someone with better knowledge of Python and Mac will need to help out.


----------



## bradleys

I finally figured out how to get VLC to read directly from the Proxy server...

simply add the rss url as podcast under the playlist options. I do have javascript that can lookup poster art for the TV shows and movies - but not being familiar with python, it would take me quite a bit of effort to integrate it.










But it was nice getting it to this point.


----------



## vanclute

That's great... now if only the videos would play for me in the first place.


----------



## bradleys

I am anxiously waiting for VLC for windows 8 to use this on the Surface Pro tablet - that I am chomping at the bit to buy.

Sorry it doesn't work for you... It is still really unstable presented via the browser for me, but rock solid through VLC.


----------



## Allanon

Here is an update that fixes file transfers. The problem is detailed in this thread:

http://www.tivocommunity.com/tivo-vb/showthread.php?t=501420.

This version added a cookie with sid='ABC'.


----------



## mulscully

here is the error I am getting now... Any help would be appreciated.. I am running Windows 7 and am running the version of the proxy server listed in post #103 above

it does look like its starting to decode the video because the line right before the ---- it says

Decoding video

c:\Python27\tivodecode ( and I do have tivodecode in that directory, I copied the tivodecode dir from kmmttg into the Pyhton dir)


----------



## Allanon

Mulscully, I don't have Windows 7 or this problem so I was only able to look the error up on the internet and see how others fixed it. Some say just changing the directory to the path will solve the problem, so I added that code to this version. You might also try running as admin.


----------



## mulscully

Thanks, I will give this a try sometime tonight or tomorrow and post the result....


----------



## mulscully

Nah... still getting the same error... Believe its a win 7 issue....


----------



## vanclute

I suspect you aren't really tracking the Mac issues since you aren't a Mac user, but I'm back to this error again. This is with the version you posted on 02.28.13:


Code:


/download/The%20Piano%20Guy.TiVo?Container=%2FNowPlaying&id=1339151

Video URL:  http://192.168.2.10:80/download/The%20Piano%20Guy.TiVo?Container=%2FNowPlaying&id=1339151

192.168.2.16 - - [10/Mar/2013 19:11:27] "GET /download/The%20Piano%20Guy.TiVo?Container=%2FNowPlaying&id=1339151 HTTP/1.1" 200 -

Decoding video

/Users/user/tivodecode

----------------------------------------
Exception happened during processing of request from ('192.168.2.16', 57057)
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 310, in process_request
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 323, in finish_request
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 639, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 337, in handle
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 325, in handle_one_request
  File "/Users/user/Desktop/tivodecode/Tivo Proxy Server.py", line 231, in do_GET
    decode = subprocess.Popen(cmd,shell=False,bufsize=0,stdin=subprocess.PIPE,stdout=subprocess.PIPE)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
OSError: [Errno 2] No such file or directory
----------------------------------------


----------



## Allanon

Vanclute, for some reason the last version didn't have the code that fixed your path problem. This version should work.


----------



## vanclute

Unfortunately, no go here either.



Code:


Video URL:  http://192.168.2.10:80/download/The%20Piano%20Guy.TiVo?Container=%2FNowPlaying&id=1343114

192.168.2.16 - - [28/Mar/2013 22:15:58] "GET /download/The%20Piano%20Guy.TiVo?Container=%2FNowPlaying&id=1343114 HTTP/1.1" 200 -

Decoding video


/Users/user/Desktop/tivodecode/tivodecode

Encryption by QUALCOMM ;)

Disconnect
----------------------------------------
Exception happened during processing of request from ('192.168.2.16', 51043)
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 310, in process_request
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 323, in finish_request
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 641, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 694, in finish
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 303, in flush
error: [Errno 32] Broken pipe
----------------------------------------


----------



## ligand

So I tried setting this up last night on my mac and got it to work.  I used the latest script that was posted. Compiled TivoDecode and copied to the same directory as the python script. Started the python script using sudo. Using firefox, I was able to retrieve the RSS feed and then I copied the link to VLC and to my pleasant surprise it worked!  Great Job!


----------



## berkinet

ligand said:


> ...Compiled TivoDecode and copied to the same directory as the python script. Started the python script using sudo... Great Job!


Thanks to @allanon for the hard work on this, and to @ligand for the key hint on MacOS.

I found the _sudo_ was not necessary. Also, the problem with tivodecode is caused by the path. Following the previous tip of entering the url into VLC as a podcast, I am able to see the program list and view the video in VLC.

On the other hand, if I quit viewing a video the proxy server does not gracefully trap the errors. For example, I get:


Code:


Disconnect
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 52581)
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/SocketServer.py", line 222, in handle_request
    self.process_request(request, client_address)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/SocketServer.py", line 241, in process_request
    self.finish_request(request, client_address)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/SocketServer.py", line 254, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/SocketServer.py", line 522, in __init__
    self.handle()
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/BaseHTTPServer.py", line 316, in handle
    self.handle_one_request()
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/BaseHTTPServer.py", line 310, in handle_one_request
    method()
  File "Tivo_Proxy_server.py", line 268, in do_GET
    decode.terminate()
AttributeError: 'Popen' object has no attribute 'terminate'

I'll take a look at this and see if I can figure out why Popen is unhappy.


----------



## berkinet

I resolved the (non) issue with _AttributeError: 'Popen' object has no attribute 'terminate'_. Seems my installation was incorrectly referencing the Python 2.5 framework.

However, of greater interest, I resolved the errors thrown when a stream display is interrupted. I sub-classed SocketServer to add error handling. I added the class mySocketServer and changed the https setup server to reference it. Here is the changed part of the code:


Code:


class mySocketServer(SocketServer.TCPServer):
  def handle_error(self, _, client_address):
    """Handle exceptions; overrides SocketServer.handle_error.
    """
    print "Stream display unexpectedly interrupted"

# Start Proxy Server
httpd = mySocketServer(("", Port), Handler)
print "serving at port", Port
httpd.serve_forever()


----------



## cyberweasel

Is it possible to make this work with Plex? That would be awesome. I have Plex setup and the Tivo Proxy running and working. I would love to have them work together


----------



## Allanon

cyberweasel said:


> Is it possible to make this work with Plex? That would be awesome. I have Plex setup and the Tivo Proxy running and working. I would love to have them work together


I looked in to doing this and found that Plex needs a URL service to read a RSS feed. It doesn't recognize Tive Proxy Server as a URL service so it won't read the RSS feed. I was able to save the RSS feed from Tivo Proxy Server to a file and get it to display in Plex using the RSS Feed plugin. But when selecting a video to be played it didn't play. Tivo Proxy Server seemed to be streaming the video to Plex but the loading icon remained displayed on the Plex video player. I don't know how to solve this problem.


----------



## ppeewang

I got the rss feed to work once, but now it seems like it is stuck, I will report back "Working......." in the log screen and I never get any thing returned to my browser. any ideas ?


----------



## Allanon

ppeewang said:


> I got the rss feed to work once, but now it seems like it is stuck, I will report back "Working......." in the log screen and I never get any thing returned to my browser. any ideas ?


The "Working...." text is the program downloading and parsing the RSS feed from the Tivo. If you have a lot of videos on the Tivo it can take a long time. Also if it doesn't find the Tivo or can't download the Tivo XML file then the program may just keep printing dots. Make sure the Tivo's URL and MAK are correct.


----------



## ppeewang

Allanon said:


> The "Working...." text is the program downloading and parsing the RSS feed from the Tivo. If you have a lot of videos on the Tivo it can take a long time. Also if it doesn't find the Tivo or can't download the Tivo XML file then the program may just keep printing dots. Make sure the Tivo's URL and MAK are correct.


MAK and Url were correct. For whatever reason, my Tivo's httpd must have died and I ended up having to re-start the Tivo to get it working again. After I got it back up it worked for a bit, but as I started watching a show it ended up flaking out on the stream. It would stop playing and repeat a few seconds of the show I was watching. Any useful tweaks or suggestions ? I really love this program!


----------



## Allanon

ppeewang said:


> MAK and Url were correct. For whatever reason, my Tivo's httpd must have died and I ended up having to re-start the Tivo to get it working again. After I got it back up it worked for a bit, but as I started watching a show it ended up flaking out on the stream. It would stop playing and repeat a few seconds of the show I was watching. Any useful tweaks or suggestions ? I really love this program!


I know Series 3 Tivos can't stream HD fast enough to watch in real time, SD works fine. You will need to pause the stream and let it buffer before watching an HD video. Also your computer speed might be a factor because it is decoding the Tivo video in real time and if you have a slow computer then it might have problems. I was using a Pentium 4 CPU without problems but anything slower might not work.


----------



## ppeewang

Thanks, I'll run this hard wired on a better system and see what happens. Was using a laptop wirelessly initially.


----------



## tlc

I'm seeing "Broken pipe" as well.


> Disconnect
> ----------------------------------------
> Exception happened during processing of request from ('192.168.1.222', 48490)
> Traceback (most recent call last):
> File "/usr/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
> self.process_request(request, client_address)
> File "/usr/lib/python2.7/SocketServer.py", line 310, in process_request
> self.finish_request(request, client_address)
> File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
> self.RequestHandlerClass(request, client_address, self)
> File "/usr/lib/python2.7/SocketServer.py", line 640, in __init__
> self.finish()
> File "/usr/lib/python2.7/SocketServer.py", line 693, in finish
> self.wfile.flush()
> File "/usr/lib/python2.7/socket.py", line 303, in flush
> self._sock.sendall(view[write_offset:write_offset+buffer_size])
> error: [Errno 32] Broken pipe


Print statement debugging puts it in the self.wfile.write(chunk) call.


----------



## Allanon

Tlc, please give more information. What video player were you using to access Tivo Proxy Server? Did this happen while the video was playing or before seeing any of the video? Did TivoDecode start? Describe what you were doing when the error occurred.


----------



## tlc

Allanon said:


> Tlc, please give more information. What video player were you using to access Tivo Proxy Server? Did this happen while the video was playing or before seeing any of the video? Did TivoDecode start? Describe what you were doing when the error occurred.


The Broken pipe (SIGPIPE) happened when I was trying to test through a ssh tunnel from work with VLC. We have a crappy connection at work, so I can imagine the pipe getting full. But IIRC, that should give EWOULDBLOCK, not SIGIPIPE. (I don't know python does with these though.)

I saw zero video, but based on my print statements, the read/write loop ran MANY times before the exception.

Today I tested at home and it worked. But sometimes the connection fails (and VLC tries the next one). Sometimes it fails for many before one catches. VLC writes:


> [0x107da27d0] main access error: connection failed: Connection refused
> [0x107da27d0] access_http access error: cannot connect to 192.168.1.222:10000
> [0x107da27d0] main access error: connection failed: Connection refused
> [0x107da27d0] access_mms access error: cannot connect to 192.168.1.222:10000
> [0x10ae24100] main input error: open of `http://192.168.1.222:10000/download/Major League.TiVo?Container=/NowPlaying&id=83290' failed
> [0x107da27d0] main access error: connection failed: Connection refused
> [0x107da27d0] access_http access error: cannot connect to 192.168.1.222:10000
> [0x107da27d0] main access error: connection failed: Connection refused
> [0x107da27d0] access_mms access error: cannot connect to 192.168.1.222:10000
> [0x10ae24100] main input error: open of `http://192.168.1.222:10000/download/South Park.TiVo?Container=/NowPlaying&id=80700' failed
> ...


----------



## telemark

Most internet connections will have trouble keeping up with an HD stream coming from a Tivo. Keep in mind, Tivo Corp invented the Stream for this reason.

Using an SSH tunnel will limit the bandwidth available even more.

I would test the bandwidth available between those two points over SSH before thinking there's anything wrong with the software.


----------



## Allanon

tlc said:


> The Broken pipe (SIGPIPE) happened when I was trying to test through a ssh tunnel from work with VLC. We have a crappy connection at work, so I can imagine the pipe getting full. But IIRC, that should give EWOULDBLOCK, not SIGIPIPE. (I don't know python does with these though.)
> 
> I saw zero video, but based on my print statements, the read/write loop ran MANY times before the exception.


I guess the pipe can be overflowing. TivoDecode may be decoding the video faster than it can be sent through the SSH tunnel making the pipe back up and overflow. I only have a Tivo HD which doesn't have very fast video streaming so this isn't a problem for me but if you have a newer Tivo that can stream fast then maybe this is your problem.

Right now there is no buffering on the pipe but you can change bufsize to -1 in the following code and it will add a buffer:


Code:


decode = subprocess.Popen(cmd, shell=False,bufsize=0,stdin=subprocess.PIPE,stdout=subprocess.PIPE)




tlc said:


> Today I tested at home and it worked. But sometimes the connection fails


The connection fails and VLC skips when the video is copy protected but I don't get those errors. You might try rebooting the Tivo.


----------



## a_gizmo

I know it's been several months since anything was posted in this thread, but I wanted to know if I have to do anything special to make Tivo Proxy Server work for PS3MediaServer. I've have tivodecode & Tivo proxy server setup and working on my Ubuntu server and can watch unencrypted streams on my laptop using VLC.

I just started setting PS3MS up for the first time got local video playback to work to my PS3. To use the TiVo as a source I I added the following code to my WEB.conf file.


Code:


# video feeds
videofeed.Web,Tivo=http:/isengard2:10000/rss <had to omit a "/" in the URL example because my post count is 1 right now>

When I try to play a video from the Tivo through PS3MS I get the following error message in PS3MS regardless of trying to play it straight or transcode it through ffmpeg or Mencoder:


Code:


[Hanging External Process Stopper] External input stream instance is null... stopping process
[New I/O worker #1] There is no inputstream to return for Red Band Society

On Tivo Proxy Server's side the video starts to decode but PS3MS immediately disconnects.


Code:


Decoding video


/home/tony/tivo/tivodecode-0.2pre4/tivodecode

Encryption by QUALCOMM ;)

Disconnect
----------------------------------------
Exception happened during processing of request from ('192.168.1.251', 52750)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__
    self.finish()
  File "/usr/lib/python2.7/SocketServer.py", line 710, in finish
    self.wfile.close()
  File "/usr/lib/python2.7/socket.py", line 279, in close
    self.flush()
  File "/usr/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
----------------------------------------

The "Broken pipe" error looks to appear whenever a video stream stops. I got the error message when watching a video through VLC directly from Tivo Proxy Server and pressing stop.

I wonder if my problem has more to do with PS3MS not being able to parse out the URL. Any ideas what I need to do to get this working?

Thanks,
a_gizmo


----------



## telemark

Yes, "Broken Pipe" is an internal error that you could remap in your head to, connection terminated.

Is the RSS feed rendering correctly? And then you select a file and that's when it breaks?

If so, have you tested the file format compatibility yet? 
Download a show from the Tivo, 
tivodecode but leave it in .TS format. 
Feed it to PS3MS, see what happens.

If you use kmttg or pytivo, you'll have to find the right settings to just decode.


----------



## a_gizmo

telemark said:


> Yes, "Broken Pipe" is an internal error that you could remap in your head to, connection terminated.
> 
> Is the RSS feed rendering correctly? And then you select a file and that's when it breaks?
> 
> If so, have you tested the file format compatibility yet?
> Download a show from the Tivo,
> tivodecode but leave it in .TS format.
> Feed it to PS3MS, see what happens.
> 
> If you use kmttg or pytivo, you'll have to find the right settings to just decode.


Thanks of the suggestion telemark. Yes, the RSS feed is rendering correctly. Through VLC I can view the feed and play the recordings back with no issues. I will try your suggestion of testing format compatibility in PS3MS by manually downloading, decoding a recording, and sharing it to my PS3. I'll report back my findings.

Thanks,
a_gizmo


----------



## Allanon

a_gizmo said:


> The "Broken pipe" error looks to appear whenever a video stream stops. I got the error message when watching a video through VLC directly from Tivo Proxy Server and pressing stop.


Berkinet posted code that handles errors and removes that message from being displayed.



a_gizmo said:


> I wonder if my problem has more to do with PS3MS not being able to parse out the URL. Any ideas what I need to do to get this working?


I wrote this program hoping it would work with media servers. I tested PS3MS, TVersity, Plex, etc. but the only one I could get it to work with was Serviio. Serviio met all my media server needs so I stopped trying to get it to work with others.

The main problem is probably the way it handles the responses to the video requests. I really don't know a lot about proper responses to HTTP requests so I just copied code from Internet samples. I think more robust HTTP response handling will be needed to get this working with other media servers. I don't have plans to do that since my media server needs are met using Serviio.


----------



## a_gizmo

telemark said:


> Yes, "Broken Pipe" is an internal error that you could remap in your head to, connection terminated.
> 
> Is the RSS feed rendering correctly? And then you select a file and that's when it breaks?
> 
> If so, have you tested the file format compatibility yet?
> Download a show from the Tivo,
> tivodecode but leave it in .TS format.
> Feed it to PS3MS, see what happens.
> 
> If you use kmttg or pytivo, you'll have to find the right settings to just decode.


I downloaded a video using tivodecode and saved it locally on my server. There were no issues streaming the mpegts tivo file to my PS3.



Allanon said:


> Berkinet posted code that handles errors and removes that message from being displayed.
> 
> I wrote this program hoping it would work with media servers. I tested PS3MS, TVersity, Plex, etc. but the only one I could get it to work with was Serviio. Serviio met all my media server needs so I stopped trying to get it to work with others.
> 
> The main problem is probably the way it handles the responses to the video requests. I really don't know a lot about proper responses to HTTP requests so I just copied code from Internet samples. I think more robust HTTP response handling will be needed to get this working with other media servers. I don't have plans to do that since my media server needs are met using Serviio.


I assume your right. WGET and CURL have issues downloading directly from the url provided by Tivo Proxy Server. I'm unfortunately not programmatically inclined so I can't offer a solution. It was a fun thing to try even though I can't get it to work for my particular situation. Thanks for making Tivo Proxy Server. It's a really cool script.


----------



## telemark

a_gizmo said:


> I assume your right. WGET and CURL have issues downloading directly from the url provided by Tivo Proxy Server. I'm unfortunately not programmatically inclined so I can't offer a solution. It was a fun thing to try even though I can't get it to work for my particular situation. Thanks for making Tivo Proxy Server. It's a really cool script.


I'm fluent in HTTP so if that's the problem I could probably fix it.

I can't find a license attached to the code though. The original author(s) have to specify that it's under an open source license, public domain, or none of the above.


----------



## Allanon

telemark said:


> I'm fluent in HTTP so if that's the problem I could probably fix it.
> 
> I can't find a license attached to the code though. The original author(s) have to specify that it's under an open source license, public domain, or none of the above.


Do whatever you like with my code, it's public domain.


----------



## telemark

This fixes wget and curl.


Code:


# diff orig/Tivo\ Proxy\ Server.py Tivo\ Proxy\ Server.py 
234c235
<                 self.send_header('Content-Length','0')
---
>                 #self.send_header('Content-Length','0')

I don't know what it breaks if anything.


----------



## a_gizmo

telemark said:


> This fixes wget and curl.
> 
> 
> Code:
> 
> 
> # diff orig/Tivo\ Proxy\ Server.py Tivo\ Proxy\ Server.py
> 234c235
> <                 self.send_header('Content-Length','0')
> ---
> >                 #self.send_header('Content-Length','0')
> 
> I don't know what it breaks if anything.


Commenting out that line of code definitely made a difference. Using I was able to successfully stream a show from my Tivo to the PS3.


----------

