A better /nowplaying/index.html

Discussion in 'TiVo Home Media Features & TiVoToGo' started by gman622, Mar 28, 2005.

  1. Apr 10, 2005 #41 of 168
    gman622

    gman622 New Member

    111
    0
    Feb 17, 2005
    the file extension must be .XHTML

    if you save the file in IE or notepad, it will change it on you.
     
  2. Apr 10, 2005 #42 of 168
    gonzotek

    gonzotek tivo_xml developer

    2,538
    59
    Sep 24, 2004
    Outside...
    Just keeps getting better :)


    /edit: See gman's post above directly above this one, we were both replying at the same time, and I'll bet he has the better answer.
    To the users with the cdata error: Are you using any extensions that might cause a conflict? Are you using the most recent released version of Firefox(1.0.2 as of today)? If not, what version are you using? You could perhaps try creating a clean profile in Firefox.
     
  3. Apr 10, 2005 #43 of 168
    morac

    morac Cat God TCF Club

    12,421
    1,224
    Mar 14, 2003
    NJ
    The page never finished loading when I tried it. It downloaded a number of the expiration information and then started generating javascript errors. I got about 50 of the following error:
    If I lower the amount of shows downloaded to around 5 than I don't get errors. I checked the .status field of the returns and the ones that get errors have a status of 503 (which is gateway timeout). If I had to guess I would say that the TiVo can't handle that many requests at once. It seems to max out at around 9 connections at once.

    Instead of sending all the requests at once, you should probably pace the requests and send around 5 at once to start. Then as each request comes in you can send out another request.

    I couldn't figure out how to easily send out 5 requests at once without losing count (a global variable could be used), but the following will send out 1 at a time which seems to work rather well:

    In getContent around line 77 change
    Code:
                for (i = 0; i < tblNP.rows.length; i++) {
                    getExpDate(tivo_ip, tblNP.rows[i].cells[2], i, tblNP.rows.length-1);
                }
    
    to
    Code:
     getExpDate(tivo_ip, 0, tblNP.rows.length-1);
    Then change getExpDate call to take 3 parameters
    Code:
    function getExpDate(tivo_ip, node, timesCalled, timesToBeCalled){
        var showId = node.childNodes[0].childNodes[0].nodeValue;
    to
    Code:
    function getExpDate(tivo_ip, timesCalled, timesToBeCalled){
        var tblNP = document.getElementById('nowPlay');
        var node = tblNP.rows[timesCalled].cells[2];
        var showId = node.childNodes[0].childNodes[0].nodeValue;
    and finally add and else clause to the if (timesCalled==timesToBeCalled) statement at the bottom of getExpDate
    Code:
                else {
                        getExpDate(tivo_ip, timesCalled + 1, timesToBeCalled)
                }
    
     
  4. Apr 10, 2005 #44 of 168
    morac

    morac Cat God TCF Club

    12,421
    1,224
    Mar 14, 2003
    NJ
    I updated my version with the latest changes from gman662 or more precisely I incorporated my changes into his new code. I also put my fix above into the code. If you have less than 128 shows on your TiVo then you won't get any benefits from this version (unless you are experiencing the zulutime has no properties error which this fixes).

    Just a note, I defaulted to download 10 shows at a time because I added code to update the title page as the shows are downloaded for indication purposes. Feel free to change the value or remove it and it will try to download all the listings at once (or as many as the TiVo will respond with at once which is 128).
     
  5. Apr 10, 2005 #45 of 168
    gman622

    gman622 New Member

    111
    0
    Feb 17, 2005
    hmm, it's been working fine all day for me. i've got 14 shows right now, maybe the max number of requests is 16? would the server be set to only handle that many though? its not a browser setting issue is it?

    you're code works ok, except if you sort the columns while the expiration dates are loading then it screws up. it needs a handle to the node for each request. i think it's maybe the better way to do it though.

    i'm curious if anyone else is getting these errors, and how many shows(requests) their tivos can handle.
     
  6. Apr 10, 2005 #46 of 168
    smithrl

    smithrl Member

    96
    0
    Sep 23, 2002
    Ann Arbor, MI

    Thanks!

    That was exactly it. I didn't catch that Wordpad had changed the extension.


    Great app!
     
  7. Apr 10, 2005 #47 of 168
    morac

    morac Cat God TCF Club

    12,421
    1,224
    Mar 14, 2003
    NJ
    I figured out the problem. Firefox defaults to only allow 2 open connections per server. This is controlled via the configuration "network.http.max-persistent-connections-per-server" which can be changed by typing "about:config" into the location bar in Firefox.
    Many people, including myself bump this value up to a higher number in order to increase download performance (it's in most tweak guides). I use 8. So while 2 connections works with the TiVo, 8 apparently does not. I've tested and anything greater than 4 causes problems.

    In any case by default Firefox will only allow 2 open TiVo connections at once so it basically acts like my code except two requests are sent at the same time instead of only one. So it will work as long as the user didn't increase "network.http.max-persistent-connections-per-server" to greater than 4.
     
  8. Apr 11, 2005 #48 of 168
    morac

    morac Cat God TCF Club

    12,421
    1,224
    Mar 14, 2003
    NJ
    I figured out a way to keep from screwing up the tables when sorting.

    I created an array of all the nodes and passed that to getExpDate. It might be better to pass an array of the tr's node ids and then get the cell's node from the id in getExpDate. This might save on memory depending on how pointer to nodes are stored.

    In any case this is what I came up with:
    Code:
                    var nodes = new Array(tblNP.rows.length);
                    for (i = 0; i < tblNP.rows.length; i++) {
                        nodes[i] = tblNP.rows[i].cells[2];
                    }
                    getExpDate(tivo_ip, nodes, 0, tblNP.rows.length-1);
    .
    .
    .
    
    function getExpDate(tivo_ip, nodes, timesCalled, timesToBeCalled){
        var node = nodes[timesCalled];
    .
    .
    .
                else {
                        getExpDate(tivo_ip, nodes, timesCalled + 1, timesToBeCalled)
                }
    
    I update my code with these changes so sorting won't mess up grabing the expiration date. Once again this is only useful for people who either have more than 128 shows or increased their "network.http.max-persistent-connections-per-server" value to a number greater than 4.
     
  9. Apr 16, 2005 #49 of 168
    gman622

    gman622 New Member

    111
    0
    Feb 17, 2005
    A small update and limitation workaround.
    I added some detail to what's now recording (quality, expiration date, and partial recording time.)
    I also fixed an error whereby any bad requests that are made are simply resubmitted- not a great fix but...(shrug). And still I get strange behavior if pipelining is enabled. It seems the TiVo's little webserver is easily overwhelmed. I'm curious what server is in there - probably a small custom one they wrote themselves?

    Anyway: nowPlaying.xhtml
     
  10. Apr 17, 2005 #50 of 168
    morac

    morac Cat God TCF Club

    12,421
    1,224
    Mar 14, 2003
    NJ
    Did you upload the new version? I'm still getting the old version from the link.
     
  11. Apr 17, 2005 #51 of 168
    gman622

    gman622 New Member

    111
    0
    Feb 17, 2005
    oops you're right sorry. it's there(here ) now.

    the weird pipelining issue seems to only occur when the network.http.max-persistent-connections-per-server is less than 5, it doesn't break but it timeouts for a while. i'm not sure what it's doing.
     
  12. Apr 17, 2005 #52 of 168
    morac

    morac Cat God TCF Club

    12,421
    1,224
    Mar 14, 2003
    NJ
    Well this version does eventually download all the expires info, but it takes a while. Also the way it is coded, it will just keep hammering the TiVo's web server until the response comes back. I don't know how well TiVo can handle something like that. I don't think the TiVo was really designed to handle multiple requests at once especially since it seems to take a second or two to process each request.

    I still think a better way of doing this would be to limit the amount of actual request that the code makes to one or two at a time. That way it will work no matter how the user set up Firefox. I do use pipelining, though my per server setting is set to 8.

    I took your code, and added the code to make multiple requests like I normally do. This time though, instead of sending out one request at a time for the expires info, I changed the code to send out 2 requests at a time. It seems to work very well. I had to revert some of your code from getExpDate to do so though. I did leave in the code to retry on failure though.

    You can check it out here.
     
  13. Apr 17, 2005 #53 of 168
    gman622

    gman622 New Member

    111
    0
    Feb 17, 2005
    the time difference seemed negligible to me - of course i only ever have 15-20 shows at any one time.

    the only reason i added the expires column was to see which show would be deleted first,second and so on. as someone with only a 40gb tivo, i like to know the order of deletion for recordings (even this is problematic though, you can't change an expiration date to a date before today. so if you want something recorded today to be deleted before a bunch of shows recorded previously you have to change all the expiration dates)

    for someone with a huge drive and huge number of show who doesn't ever worry about deletions, i think it best just to leave out that column. it would speed up the page load and you could still get the exp info with the show details link.
     
  14. Apr 17, 2005 #54 of 168
    JerkyChew

    JerkyChew New Member

    4
    0
    Sep 10, 2003
    This is neat. One question - it looks like the Tivo size variable is global? Is there a way to make it different for each tivo? My Tivo is an 80 hour, but the roommate's is only a 40 hour.
     
  15. Apr 17, 2005 #55 of 168
    morac

    morac Cat God TCF Club

    12,421
    1,224
    Mar 14, 2003
    NJ
    Shoud be trivial to make it into an array just like the TiVo_ip variable.
     
  16. Apr 17, 2005 #56 of 168
    TheCat

    TheCat New Member

    8
    0
    Mar 10, 2003
    I'm using Firefox on Linux (Fedora Core 3). When I load the .xhtml file, I get two warnings about unsafe scripts. If I accept both, the page title changes to "Loading..." and the status bar says "none." Nothing else happens. Any suggestions?

    p.s. I'm using morac's version, since gman622's links to a "file not found" error.
     
  17. Apr 17, 2005 #57 of 168
    mkop

    mkop New Member

    3
    0
    Jan 20, 2004
    I can not get it to load for anything, I have made sure the extension is correct, just comes up with a blank screen in firefox and does nothing. Any other suggestions?
     
  18. Apr 18, 2005 #58 of 168
    morac

    morac Cat God TCF Club

    12,421
    1,224
    Mar 14, 2003
    NJ
    You should get a number of warnings, unless you select the remember option (which is dangerous do to a bug in Firefox). Check the javascript console for errors.


    On a completely different topic I see this thread got Slashdotted.
     
  19. Apr 18, 2005 #59 of 168
    rog

    rog urban achiever

    794
    0
    Jan 12, 2005
    Oregon
    Dude. You should be worried. They posted a link to your Comcast http server in the comments there. ;)
     
  20. Apr 18, 2005 #60 of 168
    morac

    morac Cat God TCF Club

    12,421
    1,224
    Mar 14, 2003
    NJ
    Yeah I noticed. I got an excited and :eek: feeling at the same time. :)

    Fortunately the file is small, Comcast doesn't seem to have any bandwidth restrictions and, most importantly, a smaller than normal number of people read and commented on the story (probably because it was posted on Sunday).

    I have a feeling though that most people who read Slashdot build their own DVRs instead of buying TiVos in which case the file is useless to them. Though there have been a fair number of TiVo posts on Slashdot recently.
     

Share This Page