I'm terrible at python and need your help with two questions
#11
Hey thanks that seems to work well, however it's still not refreshing the image that im downloading with urlretrieve. I've included two changes.

Code:
# Import the XBMC/XBMCGUI modules.
import xbmc, xbmcgui, time, urllib

#inherit from WindowDialog instead of Window so that it's shown on top of
#what's onscreen instead of replacing it entirely
class CamView(xbmcgui.WindowDialog):

    def __init__(self):
        #set the initial image before the window is shown
        #NEW
        urllib.urlretrieve("http://sdf.com/camera/", '/tmp/bell.jpg')
        self.image = xbmcgui.ControlImage(100, 0, 1080, 720, "/tmp/bell.jpg")
        self.addControl(self.image)


viewer = CamView()
viewer.show()
start_time = time.time()
while(time.time() - start_time <= 10):
    #NEW
    urllib.urlretrieve("http://sdf.com/camera/", '/tmp/bell.jpg')
    viewer.image.setImage("/tmp/bell.jpg")
    xbmc.sleep(500)
viewer.close()
del viewer

(2013-02-19, 00:53)ronie Wrote: since the filename of your image is static, xbmc won't pick up the new image when it changes.

to address this (as mentioned in one of the examples above), you need to use imgControl.setImage("") in the loop.
...and you may even have to set some sleep time between clearing and setting the image.

Thanks I was wondering about that. That actually fixed a big part of the problem.

(2013-02-19, 00:38)Bstrdsmkr Wrote: #inherit from WindowDialog instead of Window so that it's shown on top of
#what's onscreen instead of replacing it entirely
class CamView(xbmcgui.WindowDialog):

Can you tell me if it's possible to set the transparency of this? I'd like any video playing to be somewhat viewable.

Also I have 4 instances of xbmc running that I'm testing against, 2 windows, 2 linux and all of them seem to crash upon completion of this script at various times. Could there be anything specific or is it just flakey?
Reply


Messages In This Thread
RE: I'm terrible at python and need your help with two questions - by doobiest - 2013-02-19, 00:54
Logout Mark Read Team Forum Stats Members Help
I'm terrible at python and need your help with two questions0