pyTivo not connecting to Tivo's when running as a service

Discussion in 'TiVo Home Media Features & TiVoToGo' started by brafly, Jan 31, 2012.

  1. brafly

    brafly New Member

    Mar 12, 2009
    Long time user, first time poster.

    FYI - I'm not a python developer but I am in IT and I can read and play with python scripts.

    I recently migrated to Windows 7 Profession x64 and installed pyTivo fresh:

    Python 2.7.2 x64 installed in C:\Python27
    pyTivo (iluvatar's fork) build from Jan 30, 2012 unzipped to C:\Python27\pyTivo
    ffmpeg-SVN-r21659-rdian06-1.02-win-x86_32 installed in \bin folder
    debug.log being written to \log folder
    Did not install support for photo viewer or .Tivo files
    DO have UDP port 5353 open inbound and outbound on Windows Firewall
    Web interface is accessable at localhost:9032
    Tivo boxes are listed in beacon, and do connect when running intreactively from command prompt
    Installed pyWin32, all installed correctly, and the service does create

    My local user account (BRADF) is an administrator. I also have a local user account created named pytivo that is also an administrator, and has log on as a service and interact with the operating system local security rights. Both users have full control rights to the C:\Python27\* folder and all files under it.

    The problem is that the Tivo's will not connect when pytivo is running as a service. If someone can tell me how to increase debugging to a higher logging level, that would be a helpful next step. Startup shown interactively and as a service below the pytivo.conf file. I've even tried running the service as the pytivo user, still no change.

    keys = root


    formatter = basicform
    class = StreamHandler
    args = (sys.stdout,)

    keys = console,rotfile

    formatter = basicform
    class = handlers.RotatingFileHandler
    args = ('C:\Python27\pyTivo\log\debug.log', 'a', 10485760, 5)

    beacon =
    port = 9032
    temp = C:\Python27\pyTivo\tmp
    ffmpeg = C:\Python27\pyTivo\bin\ffmpeg.exe

    format = %(asctime)s %(levelname)-5s %(name)s: %(message)s

    handlers = console,rotfile
    level = DEBUG


    type = video
    path = F:\COMPLETE

    keys = basicform

    Interactive Startup

    2012-01-31 21:02:55,341 INFO pyTivo.beacon: Announcing shares...
    2012-01-31 21:02:56,630 INFO pyTivo.beacon: Registering: VIDS
    2012-01-31 21:02:57,594 INFO pyTivo.beacon: Scanning for TiVos...
    2012-01-31 21:02:58,296 INFO pyTivo: pyTivo is ready.
    2012-01-31 21:02:58,615 INFO pyTivo: [31/Jan/2012 21:02:58] "GET /TiVoConnect?Command=QueryContainer&Container=%2F HTTP/1.0" 200 -
    2012-01-31 21:02:58,619 INFO pyTivo: [31/Jan/2012 21:02:58] "GET /TiVoConnect?Command=QueryContainer&Container=%2F&DoGenres=1 HTTP/1.0" 200 -
    2012-01-31 21:03:07,309 INFO pyTivo.beacon: Unregistering: VIDS


    Running as a service startup

    2012-01-31 21:05:08,315 INFO pyTivo.beacon: Announcing shares...
    2012-01-31 21:05:08,352 INFO pyTivo.beacon: Registering: VIDS
    2012-01-31 21:05:09,158 INFO pyTivo.beacon: Scanning for TiVos...
    2012-01-31 21:05:24,871 INFO pyTivo.beacon: Unregistering: VIDS

    Any assistance is appreicated.

  2. ThAbtO

    ThAbtO TiVoholic by the bay TCF Club

    Apr 6, 2000
    SF Bay Area
    Comparing your Pytivo.conf with mine, I have .....

    tivo_password = {removed}
    tivo_mak = {removed}
    ffmpeg = e:\pyTivo\bin\ffmpeg.exe
    temp = h:\cache\pyTivo
    togo_path = i:\video
    tivo_username = {removed}
    port = 9032
    You need these:

    tivo_username = (your account login)
    Tivo_password= (your account password)
    tivo_mak= (your Media Access Key)
    togo_path = (where to place the files)

    I do not even have "beacon=" line, which may not be needed.
  3. Feb 1, 2012 #3 of 10

    wmcbrine Well-Known Mumbler

    Aug 2, 2003
    He does not need those, unless he wants to do specific things (push and togo) which he is not talking about here.
  4. Feb 1, 2012 #4 of 10

    brafly New Member

    Mar 12, 2009
    Don't need to do push or Tivo to Go. Also tried disabling anti-virus, still no dice.
  5. Feb 1, 2012 #5 of 10

    jgarwacki Jim Garwacki

    Sep 30, 2008
    I'm in the same boat. I'm running WHS 2011 (which is server 2008 R2 based) and I've narrowed it down to the firewall. If I run interactively, it works fine, but when I run as a service the shares don't show up on my Tivo.

    I have the correct rules added to the firewall (UDP 5353), but it only works as a service if I disable the firewall.

    So I figure it's some other port or a rights issue. Haven't nailed it down yet.
  6. Feb 1, 2012 #6 of 10

    brafly New Member

    Mar 12, 2009
    Thanks jgarwacki...that is at least somewhere for me to start!
  7. Feb 1, 2012 #7 of 10

    brafly New Member

    Mar 12, 2009
    I can confirm that just turning off the Windows Firewall for local and domain networks resolves the problem...but I decided to dig further.

    With the Firewall off, and all other applications close, I ran a netstat -s looking for traffic between the pyTivo PC and the Tivo boxes.

    I use static IPs:

    .235 is the pyTivo PC
    .234 is a Tivo Box
    .233 is a Tivo Box


    These are very high ports, and could be random. As you can see from the netstat we are talking on the TCP protocol not just the UDP protocol...and TCP 9032 (the localhost web interface port) is talking to the Tivo boxes. My theory is that there is some sort of communication between the webserver on TCP 9032 which spawns communication on other, possibly random very high TCP ports that the firewall was blocking. If someone wants to do a packet snif/trace and has that ability/knowledge, feel free.

    I re-enabled the firewall and modified my UDP Port 5353 inbound and outbound rule on the Windows Firewall to be an allow all traffic, on all ports, all protocols, in and out of the PC to the IP addresses of the 2 Tivo Boxes. Restarted the service, and it runs like a champ. Note that I only enabled this rule for local and domain networks, not public networks. This still maintains the firewall security, as long as you use static IP addresses for your Tivo boxes, and (in the highly unlikely event) those Tivo boxes (which run a UNIX based kernel) ever get compromised or contract a virus remain a potential vulnerability, but if that happens, we'll all be running around screaming as if our hair were on fire I'm sure.

    If anyone wants to attempt to reproduce the issue, I believe there is more than enough information here to do so. I'd like specific ports to open on specific protocols, but for now, allow all between pyTivo and Tivo boxes will do as a workaround for me.
  8. Feb 1, 2012 #8 of 10

    wmcbrine Well-Known Mumbler

    Aug 2, 2003
  9. Feb 1, 2012 #9 of 10

    brafly New Member

    Mar 12, 2009

    Didn't know who monitored which board...I promise I won't ever do it again. I err'd to the side of too much information rather than what most posters do, not enough. With both threads out there, the chance is higher that someone searching for the same problem will be more apt to find the answer faster due to the duplication...look at it as increasing the overall knowledge available.

    While we're discussing this, can you tell me why a Tivo would be trying to talk directly to the web interface over TCP on those ports, you do seem to be the owner of the main code branch.

    Nowhere is TCP protocol communication mentioned...only UDP. I spent a long time troubleshooting this myself before I posted and I'd really like to know what changed to cause this communication with the newer code base.

    Example being that in a code base from 2 years ago (the package with the Windows installer and pytivoservice.exe, I don't have the exact version) running on Windows 7 Professional x64 does not have this problem.

    What gives wmcbrine?
  10. wmcbrine

    wmcbrine Well-Known Mumbler

    Aug 2, 2003
    Please see the other thread.

    This actually has nothing to do with your problem. That part of the code can fail completely, without affecting anything, except that your TiVos would appear in the push and togo menus without proper names.

    Edit: And what you're saying is incorrect -- TCP is mentioned, albeit not as clearly as it should be.

    The Windows Installer does things its own way. I don't know much about it, except that it wasn't kept up to date. It handles the firewall in its setup.

Share This Page