Installing PyTiVo on Mac for New User

Discussion in 'Developers Corner' started by Tagno, Aug 11, 2019.

  1. Dan203

    Dan203 Super Moderator Staff Member TCF Club

    46,665
    4,026
    Apr 17, 2000
    Nevada
    The certificate is good for another year or so, but no telling if they'll be able to get a new one when it expires.

    The developer program is dead. That's what I tried to use to get a certificate and no one could figure out how to help me. (I even tried personal contacts inside TiVo and no one could figure it out)

    Yes. It was published by TiVo at one time. It uses your MAK for authorization, not a certificate, so it should work as long as TiVo doesn't disable the HTTP server on the TiVo itself. (which is possible, but hasn't happened yet)
     
  2. Tagno

    Tagno New Member

    24
    3
    Aug 5, 2019
    So the best bet is HTTP and hope they don't disable it. I went to my TiVo's IP address with an HTTPS connection. I see the full listing of shows. I can use that to compare to what's on my hard drive and easily keep them in sync. Parsing the HTML isn't hard. (And I bet they haven't updated that HTML in years, right?)

    I see there are two files for each recording and they're downloadable, a -TS file and a -PS file. The .tivo file extension is added to the filenames when I download. When I play the PS file in VLC, it's bad video, but behaves like when I play a video downloaded from pyTiVo Desktop. So do the .tivo files still need to be converted to be used? Or can a program like Plex use them as-is?
     
  3. Dan203

    Dan203 Super Moderator Staff Member TCF Club

    46,665
    4,026
    Apr 17, 2000
    Nevada
    The .tivo files are encrypted. pyTiVo desktop includes a program that can decrypt them called tivo-libre. If you want to play them in VLC or convert them to another format, like for Plex, you'll need to decrypt them.

    If you want to do automated comparison of shows pyTivo can supply the list as json data or XML, which would be easier to parse than the HTML page TiVo shows. The TiVo page also has issues with pagination. When they added One Passes, which are essentially shows that might not actually have and recordings, it confused that page and makes it nearly impossible to get past page 1 if you have any streaming only 1Ps.
     
  4. Tagno

    Tagno New Member

    24
    3
    Aug 5, 2019
    Okay, here's what I've got for the HTTP interface. I don't know how much more there is, but this is from multiple pages, including a few on this forum. (I'm putting this here for my future use, if I forget, and for completeness for anyone following this thread.

    Use "tivo" for the user name and your MAK for the password. Always use https:// instead of just http://

    The one thing I have not yet figured out is how to include your username and MAK in the URL as parameters.

    Note that some lines have been split up for formatting. There are no spaces or return characters in the URLS.

    You can get a list of your programs, in HTML, from this URL:
    You can get the same, in XML, with this:

    The problem is that only gives a limited listing of your shows, so, to get a full listing, use this for the first page of XML listings. I was using a count of 10 for testing purposes (to make it easy to count and track show titles). You can use other numbers. I think I had trouble with getting more than 16 items at a time.
    And use this for the next. Just keep incrementing the AnchorOffset for each page as you step through.

    If you want to go into folders, add "&Recurse=Yes" and, of course, for the 2nd and following pages, add the "&AnchorOffset=10" (Or whatever you need the offset to be.)
    Then:
     
  5. Dan203

    Dan203 Super Moderator Staff Member TCF Club

    46,665
    4,026
    Apr 17, 2000
    Nevada
    It's been a while since I wrote this, so my memory is a bit fuzzy, but that looks right. If you really want to break it down the source for pyTivo is available on github.

    Dan203/pytivo
     
  6. Tagno

    Tagno New Member

    24
    3
    Aug 5, 2019
    I'm combing through the Python code and have been looking at the Java code for kmttg. At this point, I'm rather frustrated because I'm not even clear just what routine, in what library, I call just to make the initial call when connecting to the TiVo. That's an issue because, at this point, I'm not sure how to handle the login credentials. (I've tried using them as parameters on the URL, but I can't get that to work.) I know I can do this with a one line command using wget, but that isn't transparent enough to show me just what is happening in the login process.
     
  7. Dan203

    Dan203 Super Moderator Staff Member TCF Club

    46,665
    4,026
    Apr 17, 2000
    Nevada
    If you're using pyTivo you don’t have to do the authentication manually. It does it for you.

    Think of pyTivo as a sort of proxy server. You send http commands to it, and it talks to the TiVo.

    The commands you can send to pyTivo use the same URL syntax as the TiVo, but they are actually unique to pyTivo itself. The easiest way to see how it works is just to play with the web UI in a browser. That will put the URLs right in the browser address bar.

    Another option is to run pyTivo Desktop in a browser and then use the developer console to look at the URLs it sends. You can do this by going to....

    localhost:9032/Desktop

    That will load the same Desktop UI you get in the app right into the browser. (it's all just Angular) You can then click the buttons and look at the network tab in the Chrome developer console and see the calls it makes.
     
  8. Tagno

    Tagno New Member

    24
    3
    Aug 5, 2019
    I'll try with PTD in my browser. I've having trouble getting PyTiVo to install on my Mac. I got PTD to install, but, from what you said, that's a frozen file binary. I had to try to wrestle with PyTiVo.
    ------------------------------------------
    Okay, used the PyTiVo that came with PTD - I hadn't looked into the folder in /Applications. So I am able to access through localhost:9032. I'm learning the URLs by playing with it. They're definitely different. I was hoping to just step through the list of shows in XML format, but I don't see how to get that.

    Does PTD install FFMpeg along with PyTiVo?
     
    Last edited: Aug 16, 2019
  9. Dan203

    Dan203 Super Moderator Staff Member TCF Club

    46,665
    4,026
    Apr 17, 2000
    Nevada
    Look at the calls PTD makes. Those all return json data which is very easy to use in many languages. If you don’t know json it's very easy to learn. It's basically a collection of name value pairs where the value can be one of four types.... string, int, array or object. Objects are basically just nested collections of more name value pairs. So it's simple to understand.

    The json retutrned by pyTivo is minimized, but if you copy and paste it into an IDE or text editor that understands json it's structure will be a lot more clear.

    FYI: All of the mind/rpc functions that kmttg, and TiVo's own apps, use also return json. XML is only used for the very old APIs like the one used for TiVoToGo.
     
  10. Tagno

    Tagno New Member

    24
    3
    Aug 5, 2019
    So if I just go to the normal links, like I listed above, for the XML, I'm using an older interface and TiVo now uses json formatted data instead, so that's probably the best to use at this point? (Since TiVo is using it, it's less likely to be deprecated soon.)

    I haven't been programming for a while and really didn't want to dive in for a while, since I'm dealing with a lot going on right now, but I jumped in anyway. I thought, at first, that pyTiVo would be a library, so it took me a while to grasp that it's more a service and to send it URLs directly. So I'm working on dealing with that.

    You mentioned the certificate issue for kmttg. There's nothing similar for pyTiVo, is there?
     
  11. Dan203

    Dan203 Super Moderator Staff Member TCF Club

    46,665
    4,026
    Apr 17, 2000
    Nevada
    pyTivo uses the old API for everything. When I was doing Desktop I added code to convert to json because it’s easier to parse in Angular. But it’s also easier to parse in other languages so it might be easier to deal with.
     

Share This Page