I'm terrible at python and need your help with two questions
#16
Damnit, now I'm intrigued and have to dig through the rest of your blog lol
I think this should handle the different platform quirks and etc:
Code:
# Import the XBMC/XBMCGUI modules.
import xbmc, xbmcgui, urllib2, os

def get_image(remote, local):
    imgData = urllib2.urlopen(url).read()
    output = open(local,'wb')
    output.write(imgData)
    output.close()
    return local

#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
        self.tmp = xbmc.translatePath('special://temp')
        fn = os.path.join(self.tmp, 'bell.jpg')
        firstimg = get_image("http://sdf.com/camera/", fn)
        self.image = xbmcgui.ControlImage(100, 0, 1080, 720, fn)
        self.addControl(self.image)


viewer = CamView()
viewer.show()

count = 1
while(count < 10):
    fn = 'bell%s.jpg' %count
    location = os.path.join(viewer.tmp, fn)
    new_img = get_image('http://sdf.com/camera/', location)
    viewer.image.setImage(new_img)
    xbmc.sleep(1000)
viewer.close()
del viewer
Reply


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