What I am trying to do is pull back a comic from a webpage and display it on one of our dashboard screens. I have gotten some interesting results. I run the update script on a timer to go and check for a new comic every hour and if there is a new one display the new one using the section of the sites source html. (This way it updates each day) Here is where the issue is. I can run the designer and the new image will load and I can even save the dashboard screen with the new image in it so it will start on that for the initial load of a client. The screen will then snap back to the older image from when it was initially launched after I push out an update.
For example, if I launch the client today the comic for today will load and all is well. Now when tomorrow comes the old image(from today) will still be showing where as if I launch a new client the new one loads. Is Ignition caching the html for the image somewhere? I don’t see how I can get different results on the same computer all depending on when I launch the client.
Here is the code I run every hour on a timer. Once ran I add in front of it and it shows the image in a label.
[code] import system
import xml.dom.minidom
#url to use for comic
url = "https://kimmo.suominen.com/stuff/dilbert.xml"
header = ["img"]
data = []
# go get source from url
try:
response = system.net.httpGet(url).encode("ascii", "ignore")
# Put it in the dom
dom = xml.dom.minidom.parseString(response)
# Sort by element item
for node in dom.getElementsByTagName("item"):
#find the image section and replace everything before it with <img
img = node.getElementsByTagName("description")[0].firstChild.data
img_end = img.find("<img")
img_src = img.replace(img[:img_end],"<html>")
# set desired height and width of returned image
img_final = img_src.replace("/></a>",'height ="250" width ="655"/>')
#add to data list
data.append([img_final])
# get todays comic from data
final = data[0][0]
self.newsStories = final
#print self.newStories
self.live = 1
except:
self.live = 0
[/code]