PDA

View Full Version : Jpeg to display from website?


ronmojohny
2004-11-26, 20:59
i want to be able to display a jpeg from a website. the webcam updates the jpeg every 30 seconds, but i don't care about it updating; i just want to see how heavy the traffic is at the time i go there. i tried to set it up as a stream on http://www.onlinestreams.nl/ but they don't support jpegs it seems. does anyone have a solution? many webcams work like this.

thanks

dude
2004-11-30, 00:06
this little script should do the trick...

import urllib
import xbmc
import xbmcgui

action_menu = 10 #'back'
root_dir = "q:\\scripts\\"
url_webcam = "http://www.tcomeng.com/webcams/emeraldhills.jpg"

class webcam(xbmcgui.window):
* *def (self):
* * * *imgpath = root_dir + "webcam.jpg"
* * * *loc = urllib.urlopener()
* * * *loc.retrieve(url_webcam, imgpath)
* * * *self.addcontrol(xbmcgui.controlimage(100, 100, 0, 0, imgpath)) * *

* *def onaction(self, action):
* * * *if action == action_menu:
* * * * * *self.close()

win = webcam()
win.domodal()
del win

senergy
2004-12-12, 07:01
hi, im using this code
the script downloads the pic fine but then it just stays on a blank screen. checking the logs i get
"error picture::load:unable to open image: q:\scripts\wip\webcam.jpg" multiple times.
any help?


import urllib
import xbmc
import xbmcgui

action_menu = 10 #'back'
root_dir = "q:\\scripts\\wip\\"
url_webcam = "http://www.tcomeng.com/webcams/emeraldhills.jpg"

class webcam(xbmcgui.window):
* def (self):
* * * imgpath = root_dir + "webcam.jpg"
* * * loc = urllib.urlopener()
* * * loc.retrieve(url_webcam, imgpath)
* * * self.addcontrol(xbmcgui.controlimage(100, 100, 0, 0, imgpath)) * *

* def onaction(self, action):
* * * if action == action_menu:
* * * * * self.close()

win = webcam()
win.domodal()
del win