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. wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    Yeah, the problem there is a Python thing -- if you remove items from a list while you're iterating over it, it gets confused. (The remove() method of Views also removes them from their parents' "children" lists.) You can get around that by using a copy of the list -- maybe something like this:

    Code:
    for child in self.screen.children[:]:  # [:] makes a copy
        child.remove_resource()
        child.remove()
     
  2. Allanon

    Allanon Member

    580
    0
    Nov 2, 2005
    Thanks for the fast response, that seems to have worked. :)
     
  3. lelele

    lelele New Member

    14
    0
    Apr 26, 2007
    Does Apps.tv allow python apps? I think it's self-hosted so it shouldn't matter right?
     
  4. wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    Yeah, you host it yourself (however you want to arrange that), and just give them the URL. There's a Python app there right now: my Reversi game.

    Hosting is the hard part. Since I've so far been unable to get HME working as CGI (and am increasingly pessimistic about the prospect), you pretty much have to be able to run start.py as a server and bind your own port. This means a more expensive plan. For now, I'm just running Reversi from my own PC.
     
  5. Dec 1, 2008 #105 of 231
    wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    Some changes that I found useful now that I'm hosting an apps.tv game, and support for alpha values in colors.
     
  6. Joe Q

    Joe Q New Member

    114
    0
    Apr 21, 2004
    Annapolis,MD
    I am a programmer but have never used python. I mostly do C/C++.


    I know I am missing one little step.

    From your quick start, start.py runs and is obviously sitting there waiting to be told something after it displays "Server Starts".

    So,I go into the animate directory,for example, and try __init__.py but all I get from any of the apps, is this:

    D:\Tivo\pytivo\hme-python-0.16\animate>__init__.py
    Traceback (most recent call last):
    File "D:\Tivo\pytivo\hme-python-0.16\animate\__init__.py", line 13, in <module
    >
    from hme import *
    ImportError: No module named hme


    I assume then that I am supposed to also run hme.py but when I do, all it does is simply exit back to the command line.

    What am I doing wrong or what step am I missing?

    Thank You
     
  7. wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    No, it's just waiting for requests from a TiVo (or the simulator), which will be shown in that window. There's nothing more for you to type. Just go to your TiVo and pull up the Music, Photos & More Showcases menu.
     
  8. Joe Q

    Joe Q New Member

    114
    0
    Apr 21, 2004
    Annapolis,MD

    Thank you.

    Turns out that it was NOT properly running.

    I was not sure what I was supposed to see so your reply was all I needed.


    After you told me this, I made some change to the config.ini file and I am now getting the printfs of the HTTP connections.

    I see the various apps on the Tivo now.




    The kicker is that I did not save the config.ini and I edited it and NOW I do not get any connections.
     
  9. Joe Q

    Joe Q New Member

    114
    0
    Apr 21, 2004
    Annapolis,MD
    I am not sure what I have done but the server no longer seems to be connecting to the Tivo.

    When I run the server, it says that it is registering the various apps but I no longer get print statements that says it is connected.

    I can see the various apps ON the Tivo but of course, when I Select them I get a file not found error since the server is not connecting anymore.

    Any ideas?

    I guess you can tell that I am new to this. Both the Tivo HME as well as Python.

    I am trying this on a TIVO HD XL

    Thanks
     
  10. wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    Show me the exact messages, from both sides. Also your config.ini.
     
  11. Allanon

    Allanon Member

    580
    0
    Nov 2, 2005
    How can I wrap text to a text window? If a new line character is added anywhere in the text string then the simulator will wrap that text correctly but the same text doesn't wrap when viewed with my Tivo HD. Am I going to have to write code to wrap the text manually?
     
  12. wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    I'm not sure what you're saying here. New line characters should always be processed, and are, in my experience. But as for automatic wrapping, that doesn't happen unless you set the RSRC_TEXT_WRAP flag. These are two separate issues.
     
  13. Joe Q

    Joe Q New Member

    114
    0
    Apr 21, 2004
    Annapolis,MD
    There is not much to show you.

    Here is the ini file:
    [hmeserver]
    port=7288

    #zeroconf=False
    basepath=d:\Tivo\pytivo\hme-python-0.16
    datapath=D:\Tivo\pytivo\hme-python-0.16

    Here is the results from running start.py with that config.ini:
    D:\Tivo\pytivo\hme-python-0.16>start.py
    HME Server for Python 0.16
    Skipping: picture - No module named Image
    Wed Jan 14 12:45:04 2009 Server Starts
    Registering: animate
    Registering: clock
    Registering: effects
    Registering: fontinfo
    Registering: hello
    Registering: test
    Registering: tictactoe
    Registering: transition






    I get the same exact resultrs with NO config.ini file
     
  14. Allanon

    Allanon Member

    580
    0
    Nov 2, 2005

    I was talking about automatic wrapping. I didn't know there was a flag for it. When the text has a new line character anywhere in the text the simulator will wrap all the text automaticly as if the flag was set.
     
  15. wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    Really? Huh. That's another bug in the simulator, then.

    Joe Q: You've overlooked the part where I said "from both sides"; i.e, the TiVo side as well as the server.
     
  16. Joe Q

    Joe Q New Member

    114
    0
    Apr 21, 2004
    Annapolis,MD

    I appreciate all the help as well as patience.

    As I had said, Last night, one time I got a connection from the Server and the Tivo was displaying the clock/fontinfo/etc. as items to choose on the menu.

    I just took this photo of the tivo and I see they are now gone.

    So here is 'the tivo side':
     

    Attached Files:

  17. Joe Q

    Joe Q New Member

    114
    0
    Apr 21, 2004
    Annapolis,MD
    After I found a bug on the SDK website where they have the wrong name for sampleS.jar, I finally was able to use the simulator and the java test sample.

    With that, I could verify using the simulator.

    (see http://tivohme.sourceforge.net/docs/hmesdk/01_Overview.html#wp998762)


    I had all your code under this path "d:\tivo\pytivo\hme-python-0.16" but it would not work so I got your code to work by moving it all up under d:\hme and deleting my config.ini file


    Your apps show up in the Java simulator now as well as on my Tivo

    Here is the output of start.py
    HME Server for Python 0.16
    Skipping: picture - No module named Image
    Wed Jan 14 18:00:35 2009 Server Starts
    Registering: animate
    Registering: clock
    Registering: effects
    Registering: fontinfo
    Registering: hello
    Registering: test
    Registering: tictactoe
    Registering: transition
    192.168.1.5:5239 - - [14/Jan/2009 18:00:41] "GET /animate/icon.png HTTP/1.1" 200
    -
    192.168.1.5:5241 - - [14/Jan/2009 18:00:41] "GET /animate/icon.png HTTP/1.1" 200
    -
    192.168.1.5:5242 - - [14/Jan/2009 18:00:41] "GET /effects/icon.png HTTP/1.1" 200
    -
    192.168.1.5:5243 - - [14/Jan/2009 18:00:41] "GET /effects/icon.png HTTP/1.1" 200
    -
    192.168.1.5:5244 - - [14/Jan/2009 18:00:41] "GET /fontinfo/icon.png HTTP/1.1" 20
    0 -
    192.168.1.5:5245 - - [14/Jan/2009 18:00:41] "GET /fontinfo/icon.png HTTP/1.1" 20
    0 -
    192.168.1.5:5246 - - [14/Jan/2009 18:00:41] "GET /hello/icon.png HTTP/1.1" 200 -

    192.168.1.5:5247 - - [14/Jan/2009 18:00:41] "GET /hello/icon.png HTTP/1.1" 200 -

    192.168.1.5:5248 - - [14/Jan/2009 18:00:41] "GET /test/icon.png HTTP/1.1" 200 -
    192.168.1.5:5249 - - [14/Jan/2009 18:00:41] "GET /test/icon.png HTTP/1.1" 200 -
    192.168.1.5:5250 - - [14/Jan/2009 18:00:41] "GET /tictactoe/icon.png HTTP/1.1" 2
    00 -
    192.168.1.5:5251 - - [14/Jan/2009 18:00:41] "GET /tictactoe/icon.png HTTP/1.1" 2
    00 -



    Thanks
     
  18. Sep 3, 2009 #118 of 231
    wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    It's past time I updated this. The changes are minor, but potentially important.
     
  19. Sep 3, 2009 #119 of 231
    jbcooley

    jbcooley New Member

    55
    0
    May 13, 2007
    It's funny how these things happen. I'd just posted a (long over due) update to my .NET libraries a few days ago. I'm glad to see you're still publishing updates to your library.
     
  20. Apr 6, 2010 #120 of 231
    wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    More automatic resource management, and some bug fixes and enhancements for the Premiere.
     

Share This Page