TiVo Community
TiVo Community
TiVo Community
Go Back   TiVo Community > Underground Playground > Developers Corner
TiVo Community
Reply
Forum Jump
 
Thread Tools
Old 10-02-2008, 04:42 PM   #91
noseph
Registered User
 
noseph's Avatar
 
Join Date: Oct 2003
Location: MA
Posts: 58
I am a noob to this. I see references that we are able to stream video to a Series 3 with this app. What configuration is required to accomplish this? I have MPG4s on my system under v:\video. How would I access them?
noseph is offline   Reply With Quote
Old 10-02-2008, 07:28 PM   #92
wmcbrine
Resistance Useless
 
wmcbrine's Avatar
 
Join Date: Aug 2003
Posts: 8,759
No, you want HME/VLC (see my sig below). HME for Python is for developers.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
wmcbrine is offline   Reply With Quote
Old 10-26-2008, 01:24 PM   #93
Allanon
Registered User
 
Join Date: Nov 2005
Posts: 494
I am loading an image like this:

Code:
self.screen = View(self ,0, 0, 640, 480,visible=True,parent=self.root)

self.screen.child(0, self.height, self.width, self.height, image='TEST.PNG',visible=True,id=ID_CLIENT+1)
After the image is displayed on the Tivo I overwrite the TEST.PNG file with a new TEST.PNG file that is the same width and height. Can you show me the best way to update that image on the Tivo?

I am currently using the following code but is there a better way?
Code:
Image(self.app,name='TEST.PNG').remove()
self.screen.child(id=ID_CLIENT+1).remove()
self.screen.child(0, self.height, self.width, self.height, image='TEST.PNG',visible=True,id=ID_CLIENT+1)

Allanon is offline   Reply With Quote
Old 10-26-2008, 03:57 PM   #94
wmcbrine
Resistance Useless
 
wmcbrine's Avatar
 
Join Date: Aug 2003
Posts: 8,759
Here's what I'd do...

Quote:
Originally Posted by Allanon View Post
self.screen = View(self ,0, 0, 640, 480,visible=True,parent=self.root)
becomes:
Code:
self.screen = self.root.child()
Everything else is the default, so you don't need to specify it.
Quote:
self.screen.child(0, self.height, self.width, self.height, image='TEST.PNG',visible=True,id=ID_CLIENT+1)
could be:
Code:
img_view = self.screen.child(image='test.png')
(Same notation. Actually, wait -- you have self.height as the ypos. Were you planning to do an upwards wipe? Also, height and width aren't standard attributes of an Application instance, so I don't know how you've defined these. But, the rest still applies -- you don't need to specify visible, and you should not specify id.) We'll use the name img_view to keep track of the new view rather than trying to manipulate its id.

Now, I'm assuming here that you have a reason for wanting the image to be in a child view of self.screen -- namely, that self.screen will have its own resource assigned to it elsewhere -- otherwise, there's no reason to use two views, and both lines could be combined to:
Code:
self.screen = self.root.child(image='test.png')
For that matter, if you're not going to assign a resource to self.root, you could just do this:
Code:
self.root.set_image('test.png')
Note that the "id" parameter is meant for use with the built-in resources. I'd never use it for client-created resources.
Quote:
Image(self.app,name='TEST.PNG').remove()
self.screen.child(id=ID_CLIENT+1).remove()
self.screen.child(0, self.height, self.width, self.height, image='TEST.PNG',visible=True,id=ID_CLIENT+1)
could be (following the above):
Code:
img_view.remove_resource()
img_view.set_image('test.png')
I see no reason to destroy the old view and create a new one -- you can just assign the new image to the old view -- but if you did want to, it could be done like this:
Code:
img_view.remove_resource()
img_view.remove()
img_view = self.screen.child(image='test.png')
There are circumstances in which you'd replace an old view with a new one, but generally that would be for the purpose of doing a transition between them -- fade, wipe, etc.

And if you really, really need to find a child of self.screen without having given it a name at creation time, you can use the self.screen.children list:
Code:
self.screen.children[0].remove()
(equivalent to img_view.remove() in the above).
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
wmcbrine is offline   Reply With Quote
Old 10-26-2008, 08:35 PM   #95
Allanon
Registered User
 
Join Date: Nov 2005
Posts: 494
Thanks for the help, here is a little insight in to what I'm doing. I have a large picture that gets updated frequently that I want to display but Tivo can't display it all as one image so I broke it into 14 images that are 1024 x 240. I add all the images as children to the view so when I scale or scroll the view it moves or scales all the child images at the same time. I paired down my example in my post so it would be easier to understand. I have it working but had a feeling that I wasn't using the API correctly so I thought I would ask for the proper way to do it. Thanks again for the help.

UPDATE:

This is the code I am now using to load the images the first time:
Code:
self.screen = self.root.child()
for i in range(1,15):
    self.screen.child(0, self.height*(i-1), self.width, self.height,image="TEST %i.PNG" % i)
And this is the code I am using to update the images:
Code:
for i in range(1,15):
    self.screen.children[i-1].remove_resource()
    self.screen.children[i-1].set_image("TEST %i.PNG" % i)
This code works good and it's much easier to read than what I had before. I can move and scale self.screen and all the images will move and scale.

Last edited by Allanon : 10-27-2008 at 04:03 AM.
Allanon is offline   Reply With Quote
Old 10-30-2008, 12:33 AM   #96
Allanon
Registered User
 
Join Date: Nov 2005
Posts: 494
This code is from the Color class code found in the hme.py file:
Code:
   def __init__(self, app, colornum=None):
        if colornum is None:
            colornum = 0xffffffff
        # I set the alpha to full opacity here for the sake of the 
        # simulator.
        colornum |= 0xff000000
        self.colornum = colornum
        if colornum in app.colors:
            Resource.__init__(self, app, app.colors[colornum].id)
        else:
            Resource.__init__(self, app)
            self.put(_CMD_RSRC_ADD_COLOR, 'r', struct.pack('!I', colornum))
            app.colors[colornum] = self
        app.last_color = self
I'm just wondering why the default code disables the alpha value making semi transparent views not work? Using an alpha value in the simulator also works so why disable it?

Last edited by Allanon : 10-30-2008 at 02:37 AM.
Allanon is offline   Reply With Quote
Old 10-30-2008, 02:56 AM   #97
wmcbrine
Resistance Useless
 
wmcbrine's Avatar
 
Join Date: Aug 2003
Posts: 8,759
Using an alpha value only works in the simulator. (See the comments just above the code you quoted.) I mask it out so you get the same results in the simulator as on a real TiVo, and so you only have to specify the three color bytes, instead of having to preface every color with an ff (full opacity) for the alpha.

Semi-transparent views work fine, BTW. You just set the transparency via the "transparency" option when creating the view, or via the set_transparency() method later -- not via a color resource. See the "test" app for an example. This is how it's done wherever you see that effect in an HME app.

Edit: I just tested this again now, and it's not working the way I remember -- which is to say, alpha in color resources apparently is working now. Perhaps this was a change in a recent TiVo software update. Or perhaps I'm misremembering... the way I remember it, when I was first writing HME for Python, I had the alpha part unused (i.e., set to zero), and everything looked normal on the TiVo, but blank in the simulator.

I'll revisit this in the next version.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Last edited by wmcbrine : 10-30-2008 at 06:34 PM. Reason: clarification
wmcbrine is offline   Reply With Quote
Old 10-30-2008, 04:54 AM   #98
Allanon
Registered User
 
Join Date: Nov 2005
Posts: 494
I commented out the colornum |= 0xff000000 code and I'm able to create a semi transparent view using an alpha value on both the Tivo HD and simulator.
Allanon is offline   Reply With Quote
Old 10-30-2008, 11:56 AM   #99
wmcbrine
Resistance Useless
 
wmcbrine's Avatar
 
Join Date: Aug 2003
Posts: 8,759
Yes, as I said, it seems to work now. Thanks for bringing it to my attention.

BTW, I should point out that, although it's supported, the TiVo really hates transparency. I quote from the HME SDK Developer's Guide:

Quote:
Originally Posted by TiVo
Hardware rendering constraints include the following:

• Maximum of 8 images per scanline (a scanline is a horizontal line on the display)
• Maximum of 3 images per pixel (4 on some systems)
• Maximum of 56 bits of depth per pixel (128 on some systems)

Note: The maximum depth of 56 bits per pixel means that placing two transparent images on top of each other results in software rendering for the overlapping portions. (Transparent images — which includes any image with at least one transparent pixel or any GIF image — require 32 bits each. Two transparent images would thus require 64 bits, which exceeds the limit of 56 bits per pixel.)

Workarounds

To avoid software rendering, use opaque images instead of transparent images. Opaque images require 16 bits and are faster to decode and render. Using transparent images to create shading and texturing effects is costly in this environment and should be avoided.
This probably doesn't apply to the S3/HD, but it still does on the S2. I'm not sure how this translates to non-image resources, though.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Last edited by wmcbrine : 10-30-2008 at 06:30 PM.
wmcbrine is offline   Reply With Quote
Old 10-31-2008, 02:40 PM   #100
Allanon
Registered User
 
Join Date: Nov 2005
Posts: 494
There is an odd problem with this test code:

Code:
self.screen = self.root.child()

for i in range(0,10):
    self.screen.child(0, self.height*i, self.width, self.height,image="TEST %i.PNG" % i)
      
for i in range(0,10):
    self.screen.children[i].remove_resource()
    self.screen.children[i].remove()
The first loop loads all the images without a problem but the second loop stops at the remove_resource() line with a "list index out of range" error when i = 5. Another odd thing is if I set the second loop to stop at 4 so the error doesn't occur then it show that every other image was removed instead of the first 4 images.

Any idea why this might occur?
Allanon is offline   Reply With Quote
Old 10-31-2008, 02:46 PM   #101
wmcbrine
Resistance Useless
 
wmcbrine's Avatar
 
Join Date: Aug 2003
Posts: 8,759
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()

__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
wmcbrine is offline   Reply With Quote
Old 10-31-2008, 02:59 PM   #102
Allanon
Registered User
 
Join Date: Nov 2005
Posts: 494
Thanks for the fast response, that seems to have worked.
Allanon is offline   Reply With Quote
Old 11-29-2008, 01:11 AM   #103
lelele
Registered User
 
Join Date: Apr 2007
Posts: 14
Does Apps.tv allow python apps? I think it's self-hosted so it shouldn't matter right?
lelele is offline   Reply With Quote
Old 11-29-2008, 02:07 AM   #104
wmcbrine
Resistance Useless
 
wmcbrine's Avatar
 
Join Date: Aug 2003
Posts: 8,759
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.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
wmcbrine is offline   Reply With Quote
Old 12-01-2008, 02:27 PM   #105
wmcbrine
Resistance Useless
 
wmcbrine's Avatar
 
Join Date: Aug 2003
Posts: 8,759
Version 0.16

Some changes that I found useful now that I'm hosting an apps.tv game, and support for alpha values in colors.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
wmcbrine is offline   Reply With Quote
Old 01-13-2009, 03:21 PM   #106
Joe Q
Registered User
 
Join Date: Apr 2004
Location: Annapolis,MD
Posts: 114
Quote:
Originally Posted by wmcbrine View Post
Quick Start
-----------

In Windows:

python start.py

This will serve the example apps. The default port is 9042 (not TiVo's
7288). To see more options, run "./start.py --help".

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
Joe Q is offline   Reply With Quote
Old 01-13-2009, 03:32 PM   #107
wmcbrine
Resistance Useless
 
wmcbrine's Avatar
 
Join Date: Aug 2003
Posts: 8,759
Quote:
Originally Posted by Joe Q View Post
From your quick start, start.py runs and is obviously sitting there waiting to be told something after it displays "Server Starts".
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.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
wmcbrine is offline   Reply With Quote
Old 01-13-2009, 04:26 PM   #108
Joe Q
Registered User
 
Join Date: Apr 2004
Location: Annapolis,MD
Posts: 114
Quote:
Originally Posted by wmcbrine View Post
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.

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.
Joe Q is offline   Reply With Quote
Old 01-13-2009, 05:10 PM   #109
Joe Q
Registered User
 
Join Date: Apr 2004
Location: Annapolis,MD
Posts: 114
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
Joe Q is offline   Reply With Quote
Old 01-13-2009, 07:11 PM   #110
wmcbrine
Resistance Useless
 
wmcbrine's Avatar
 
Join Date: Aug 2003
Posts: 8,759
Show me the exact messages, from both sides. Also your config.ini.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
wmcbrine is offline   Reply With Quote
Old 01-14-2009, 01:53 AM   #111
Allanon
Registered User
 
Join Date: Nov 2005
Posts: 494
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?
Allanon is offline   Reply With Quote
Old 01-14-2009, 03:34 AM   #112
wmcbrine
Resistance Useless
 
wmcbrine's Avatar
 
Join Date: Aug 2003
Posts: 8,759
Quote:
Originally Posted by Allanon View Post
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.
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.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
wmcbrine is offline   Reply With Quote
Old 01-14-2009, 11:47 AM   #113
Joe Q
Registered User
 
Join Date: Apr 2004
Location: Annapolis,MD
Posts: 114
Quote:
Originally Posted by wmcbrine View Post
Show me the exact messages, from both sides. Also your config.ini.
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
Joe Q is offline   Reply With Quote
Old 01-14-2009, 11:50 AM   #114
Allanon
Registered User
 
Join Date: Nov 2005
Posts: 494
Quote:
Originally Posted by wmcbrine View Post
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.

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.
Allanon is offline   Reply With Quote
Old 01-14-2009, 01:13 PM   #115
wmcbrine
Resistance Useless
 
wmcbrine's Avatar
 
Join Date: Aug 2003
Posts: 8,759
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.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
wmcbrine is offline   Reply With Quote
Old 01-14-2009, 02:07 PM   #116
Joe Q
Registered User
 
Join Date: Apr 2004
Location: Annapolis,MD
Posts: 114
Quote:
Originally Posted by wmcbrine View Post
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.

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 Images
File Type: jpg tivo.jpg (36.1 KB, 21 views)
Joe Q is offline   Reply With Quote
Old 01-14-2009, 05:10 PM   #117
Joe Q
Registered User
 
Join Date: Apr 2004
Location: Annapolis,MD
Posts: 114
Got it working

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/....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
Joe Q is offline   Reply With Quote
Old 09-03-2009, 08:23 PM   #118
wmcbrine
Resistance Useless
 
wmcbrine's Avatar
 
Join Date: Aug 2003
Posts: 8,759
Version 0.17

It's past time I updated this. The changes are minor, but potentially important.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
wmcbrine is offline   Reply With Quote
Old 09-03-2009, 08:42 PM   #119
jbcooley
Registered User
 
Join Date: May 2007
Posts: 54
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.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
jbcooley is offline   Reply With Quote
Old 04-06-2010, 01:42 AM   #120
wmcbrine
Resistance Useless
 
wmcbrine's Avatar
 
Join Date: Aug 2003
Posts: 8,759
Version 0.18

More automatic resource management, and some bug fixes and enhancements for the Premiere.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
wmcbrine is offline   Reply With Quote
Reply
Forum Jump




Thread Tools


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Advertisements

TiVo Community
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
vBulletin Skins by: Relivo Media

(C) 2013 Magenium Solutions - All Rights Reserved. No information may be posted elsewhere without written permission.
TiVoŽ is a registered trademark of TiVo Inc. This site is not owned or operated by TiVo Inc.
All times are GMT -5. The time now is 02:45 AM.
OUR NETWORK: MyOpenRouter | TechLore | SansaCommunity | RoboCommunity | MediaSmart Home | Explore3DTV | Dijit Community | DVR Playground |