1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

HME for Python

Discussion in 'Developers Corner' started by wmcbrine, Jan 28, 2008.

  1. Feb 1, 2008 #21 of 231
    CuriousMark

    CuriousMark Forum Denizen

    2,606
    0
    Jan 13, 2005
    SoCal
    I did some testing, but the results were a little better, and unfortunately less revealing.

    Here is my annotated PuTTy log of the test:
    Code:
    =~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2008.01.31 20:17:06 =~=~=~=~=~=~=~=~=~=~=~=
    Thu Jan 31 20:15:44 2008 Server Stops
    ### Start HME
    Serenity:/home/mark/hme# ./hmeserver.py
    Thu Jan 31 20:15:57 2008 Server Starts
    192.168.2.101 - - [31/Jan/2008 20:16:11] "GET /animate/icon.png HTTP/1.0" 200 -
    192.168.2.101 - - [31/Jan/2008 20:16:11] "GET /clock/icon.png HTTP/1.0" 200 -
    192.168.2.101 - - [31/Jan/2008 20:16:11] "GET /effects/icon.png HTTP/1.0" 200 -
    192.168.2.101 - - [31/Jan/2008 20:16:11] "GET /fontinfo/icon.png HTTP/1.0" 200 -
    192.168.2.101 - - [31/Jan/2008 20:16:11] "GET /hello/icon.png HTTP/1.0" 200 -
    192.168.2.101 - - [31/Jan/2008 20:16:11] "GET /test/icon.png HTTP/1.0" 200 -
    192.168.2.101 - - [31/Jan/2008 20:16:11] "GET /tictactoe/icon.png HTTP/1.0" 200 -
    192.168.2.101 - - [31/Jan/2008 20:18:00] "GET /clock/ HTTP/1.1" 200 -
    Thu Jan 31 20:18:00 2008 Starting HME: clock
    Thu Jan 31 20:21:11 2008 Ending HME: clock
    
    ###See pictures showing clock working correctly
    ###Returned to TiVo Central using TiVo button, all is good
    
    192.168.2.101 - - [31/Jan/2008 20:21:28] "GET /animate/icon.png HTTP/1.0" 200 -
    192.168.2.101 - - [31/Jan/2008 20:21:28] "GET /clock/icon.png HTTP/1.0" 200 -
    192.168.2.101 - - [31/Jan/2008 20:21:28] "GET /effects/icon.png HTTP/1.0" 200 -
    192.168.2.101 - - [31/Jan/2008 20:21:28] "GET /fontinfo/icon.png HTTP/1.0" 200 -
    192.168.2.101 - - [31/Jan/2008 20:21:28] "GET /hello/icon.png HTTP/1.0" 200 -
    192.168.2.101 - - [31/Jan/2008 20:21:28] "GET /test/icon.png HTTP/1.0" 200 -
    192.168.2.101 - - [31/Jan/2008 20:21:28] "GET /tictactoe/icon.png HTTP/1.0" 200 -
    192.168.2.101 - - [31/Jan/2008 20:21:37] "GET /animate/ HTTP/1.1" 200 -
    Thu Jan 31 20:21:37 2008 Starting HME: animate
    Thu Jan 31 20:24:03 2008 Ending HME: animate
    
    ### See pictures showing mostly blank screen with occasional tall rectangle flashing briefly
    ### Hit TiVo button, no text on TiVo Central, had to restart TiVo
    ### ARGH   ---   Smallville was recording
     
    Thu Jan 31 20:26:21 2008 Server Stops
    Serenity:/home/mark/hme# exit
    logout
    Photos of the screen are here

    So if I run clock first, it works well, not like it did when I ran other samples first last night. The middle picture shows the last digit fading from 0 to 1, a very nice effect.

    I then ran animate and the screen showed the corect animation for about a second and then blanked showing an occasional tall rectangle. I took a long sequence of shots at about 2 per second to capture one of the rare appearances of a rectangle. They were appearing every 5 to 10 seconds, in different locations on the screen, but mostly to the right side.

    When I exited the TiVo had lost fonts and rebooted. Luckily Smallville is also being recorded on the other TiVo too.

    I will try some more later, just thought I would share what I have now. As you can see, there were no exceptions in the code this time around.

    CuriousMark
     
  2. Feb 1, 2008 #22 of 231
    wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    It's password-protected.
     
  3. Feb 1, 2008 #23 of 231
    CuriousMark

    CuriousMark Forum Denizen

    2,606
    0
    Jan 13, 2005
    SoCal
  4. Feb 1, 2008 #24 of 231
    CuriousMark

    CuriousMark Forum Denizen

    2,606
    0
    Jan 13, 2005
    SoCal
    Image showing clock changing seconds with a nice fade between digits. I had reported this not working before, but it works fine now, assuming clock is run before an example that messes with the TiVo.
    [​IMG]

    Image showing screen during animate, after it breaks down and stops showing the moving squares.
    [​IMG]

    Image showing all fonts gone after TiVo Button escape from failed animate run.
    [​IMG]

    Hopefully these won't require a password.

    I will try the modified the versions you emailed me tonight and let you know how they perform.
     
  5. Feb 1, 2008 #25 of 231
    wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    Well, I just checked with the simulator again, and the Java version of Animate sends somewhere over 576 animations before removing any (because that's where I stopped it, with no removals).* So the potential explanations are down to a) activating the root view too soon, or b) still unknown.

    If you have the problem, and you want to test 'a', then take the line in hme.py that says "self.root.set_visible()", and move it down a few lines, to just under the call to "self.startup()". Also, if you can, try the Java version and tell me if you see the same problem.

    * Edit: On that run. Then only 74 on the next. (And the simulator was restarted in between.) I wish I could figure out the logic behind that.
     
  6. Feb 4, 2008 #26 of 231
    wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    It's become apparent from this thread that I need a Series 2 to test on. So, I've just ordered one. It should be free after rebate, but there's still the service charge. Since I only need it for this project, if you'd like to help defray the cost, please consider donating via PayPal to the address in the documentation. (That's this same username at gmail.com.)

    Just ten people donating $10, or twenty donating $5, would pay for my year's subscription.

    Current donations: $102.00

    Thanks!

    -------------------------------------------------------------------

    Update on January 12, 2009 (with donations at $102):

    I've met my original goal. However:

    - I also spent $25 on a TiVo Desktop Plus license, just so I could study its "push" capability to try and get it into pyTivo. (A couple of the donations I've already received were actually specified as for this, so technically I haven't quite met my original goal after all.)

    - My year's worth of service on the Series 2 is about to expire. I still use it almost exclusively to test my HME projects and pyTivo.

    - My old laptop has just died, which means I no longer have a working Windows system (just Linux and Mac). Even before that, I didn't have a Vista system. I'm a Linux guy, so I wouldn't care for myself, but I need Windows to test on to support you, the users.

    Minor points:

    - My Mac is a G4 Mini running 10.4. I can't test Intel or 10.5. But I expect that doesn't matter all that much.

    - Even my main Linux system has shown signs of ailing recently. I list this as a minor point because I'll replace it regardless of donations.

    So, for all these reasons, your contributions are still welcome. :)

    New donations: $140.00 and a Windows computer!

    Thanks!
     
  7. Feb 5, 2008 #27 of 231
    CuriousMark

    CuriousMark Forum Denizen

    2,606
    0
    Jan 13, 2005
    SoCal
    Sorry to hear that. Even a 540 or a dual tuner might work better than my 595 so I will keep trying to help as best I can.
     
  8. Feb 5, 2008 #28 of 231
    wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    eb3604 has a 2 DT and has the same trouble. So it's got to be the Series 2 hardware and/or version 9.1 (since S3's and HD's are on 9.2 and don't have the problem).

    Anyway, even solving that, it probably won't be the last time having a Series 2 around would be useful for testing.

    No donation too small! :)
     
  9. Feb 6, 2008 #29 of 231
    windracer

    windracer joined the 10k club

    11,580
    3
    Jan 3, 2003
    St. Pete, FL
    Soooo .... who's going to port the Galleon apps to Python? ;) pyTiVo already supports music and photos, so all I need is the weather app and I can dump java. :up:
     
  10. Feb 6, 2008 #30 of 231
    wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    I have many plans for this library, but first I want to get it working solidly on S2's, or else rule out that possibility (if the same errors appear with the Java SDK). So for now, I'm working on pyTivo while I wait for my S2 to arrive. (Of course the S2 should help with pyTivo development as well; but this is the thing I need it for.)
     
  11. Feb 7, 2008 #31 of 231
    refried

    refried New Member

    145
    0
    Dec 21, 2005
    Brunswick, ME
    Are you using a version control system (CVS, SVN, git, etc)?
    Do you plan on having a public repository?
     
  12. Feb 7, 2008 #32 of 231
    wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    Yes, I have it in git on my own system.

    If people show sufficient interest. So far, I'm not blown away by the response. That's OK; I needed it for my own purposes, and additional users are just a bonus. But it doesn't make me want to bother hosting it anywhere.
     
  13. Feb 7, 2008 #33 of 231
    s2kdave

    s2kdave New Member

    515
    0
    Jan 27, 2005
    Not me. :D If anything I'll componentize a couple of them that I use for the Catnip server I started working on. But I really don't want to touch the beast that is Galleon much more.

    Have fun whomever wants to try and port it. :rolleyes: It would be easier/cleaner to just rewrite it.
     
  14. Feb 7, 2008 #34 of 231
    wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    So, my new 540 came today. It came with 7.2, which was interesting -- my demo apps didn't come up at all; the screen just sat at "Please wait..." It turns out that, in that version, the TiVo won't send the "active: true" message until after it's already received something more than the handshake from the app. That was easily fixed -- I'm just not waiting for that anymore -- but it broke my original design to have resolution changes handled before startup(). Ah well. Anyway, that done, all the apps worked fine, including Animate and Clock. I'll see what happens once it upgrades to 9.1. There was some odd behavior with pyTivo, too, that I haven't fully characterized yet.
     
  15. Feb 7, 2008 #35 of 231
    wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    OK! Here's the story: It's 9.1. I ran Animate for several hours under 7.2; no problem. Upgraded to 9.1 -- saw what others have reported. Then I tried the original Java version: exactly the same problem. So, there's another one for the 9.1 bug list. I'm surprised no one has reported it before.

    I can only hope and expect that TiVo will fix it with their next software release for the Series 2, since it doesn't happen in either 7.2 or 9.2. But it happens in 9.1 regardless of the language or library used.

    I'll be attaching a new version to the first post shortly.
     
  16. Feb 8, 2008 #36 of 231
    CuriousMark

    CuriousMark Forum Denizen

    2,606
    0
    Jan 13, 2005
    SoCal
    Thanks, glad to know it isn't just me.
     
  17. Feb 8, 2008 #37 of 231
    wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    Some further experiments with my 540: I tried forcing a short pause after each command sent. That didn't fix it, although it did make a difference -- I could see a little bit more of the rectangles, and the menu text didn't disappear. I extended the pause all the way to "don't send the next command until I press a key," but it didn't improve further.

    I found that Effects caused the same problem as Animate -- not too surprising, since it also has many views in constant motion. One interesting thing here: when I inserted a delay, the "Visible" test actually worked (on my S3), for the first time (i.e., that square disappeared and reappeared). This hadn't worked even in the original Java version.

    Then I took out the pause, and tried reducing the number of sprites instead. That was interesting. With one sprite, no problems. Two also seemed fine. With four, the first run seemed to freeze, although there was no visual distortion -- just four rectangles stopped. At first I assumed that the TiVo had frozen, but it responded just fine to the TiVo key. So I ran the four-square Animate again, and it seemed to work OK. Then I upped it to eight. Now I could see what I'd missed with four -- it actually started out normal, and only gradually came to a halt, with some squares still moving (based on their last animation, I assume) while others had already stopped; eventually, they all stopped. This happened every time with eight, although there was still no distortion or loss of text. Then I tried scaling it back down and letting it run a long time. Even with just three, after a few hours, I got the distortion and lost text.

    Anyway, there doesn't seem to be anything I can do about it, but I kinda knew that already.

    Instead, I offer you the next version of HME for Python. It adds two new event handlers (they're needed now, since startup() runs before the startup events are handled), and incidentally makes use of one of them in the demos to keep you from running Animate or Effects on a 9.1 system. (The others seem to be safe.) It also suppresses any exceptions during reading or writing the stream, since the socket can close at any time, but you still might need to run cleanup(). Plus it looks neater that way.
     
  18. Feb 9, 2008 #38 of 231
    jbcooley

    jbcooley New Member

    55
    0
    May 13, 2007
    I tried an older version of your software and only got an occasional artifact on my Series 2 240. I got similar artifacts from the java animate sample and my animate sample. None of them affected the usability of my tivo. This is all with 9.1.
     
  19. Feb 9, 2008 #39 of 231
    wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    New version -- adds handle_active(), which handles EVT_APP_INFO events of "active = true"; and better import exception handling in hmeserver.py -- empty directories are silently passed over without masking errors in real apps.
     
  20. Feb 9, 2008 #40 of 231
    refried

    refried New Member

    145
    0
    Dec 21, 2005
    Brunswick, ME
    I'm trying out the test app on my Humax DVD Recorder (595) and it looks like the optional keys aren't coming back with the right key codes. Here are the key names, the spec codes, and what I actually get.

    KEY_OPT_STOP 51 190
    KEY_OPT_MENU 52 179
    KEY_OPT_TOP_MENU 53 178
    KEY_OPT_ANGLE 54 182

    Odd, it looks like the vint parsing is correct and the packets coming over the wire sure use two bytes to specify the key number.
     

Share This Page