I'm terrible at python and need your help with two questions
#12
Sounds like the image is being cached. Try adding a bogus parameter to the url like:
Code:
url = "http://sdf.com/camera/?bogus=%s" %time.time()
urllib.urlretrieve(url, '/tmp/bell.jpg')
The camera's server should ignore the extra param (try it in your browser to be sure) and xbmc will see a different url each time and won't return a cached image.

The other possibility is that it's showing a cached thumbnail of /tmp/bell.jpg. In that case, you'll need to change the location passed in to setImage() call. You can do this by saving each image separately:
Code:
# Import the XBMC/XBMCGUI modules.
import xbmc, xbmcgui, 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
        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()

count = 1
while(count < 10):
    #NEW
    location = '/tmp/bell%s.jpg' %count
    urllib.urlretrieve("http://sdf.com/camera/", location)
    viewer.image.setImage(location)
    xbmc.sleep(1000)
viewer.close()
del viewer

The drawback is this will always show 10 images, regardless of how long it takes. It shouldn't normally matter, but it's something to keep in mind
Reply


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