2013-02-19, 01:10
Sounds like the image is being cached. Try adding a bogus parameter to the url like:
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:
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
Code:
url = "http://sdf.com/camera/?bogus=%s" %time.time()
urllib.urlretrieve(url, '/tmp/bell.jpg')
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