Kodi Community Forum
Simple picture addon restarts after close - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+--- Thread: Simple picture addon restarts after close (/showthread.php?tid=151508)



Simple picture addon restarts after close - coaster - 2013-01-10

I've written a very simple picture addon that uses Python urlib to saves latest images from various websites (traffics, weather cameras, etc) to a folder, then uses the XBMC builtin function SlideShow to view them. It works fine, except that when I use Esc or stop, the slide show ends as expected but then restarts once a few seconds later regardless of what page I've moved to. I haven't added a function to kill the script as I didn't see one in the other addons I've looked at. Below is the code in default.py. Any suggestions would be great. Thanks

# a simple XBMC addon written to show webcam images
import urllib
import xbmc

#if the Webcam directory doesn't exist, create it
d="C:\Webcams"
if not os.path.exists(d):
os.makedirs(d)

#Retrieve the latest web images and save them to the webcam directory
urllib.urlretrieve("http://images.drivebc.ca/bchighwaycam/pub/cameras/17.jpg", os.path.join("C:\Webcams","1 stanleypark causeway.jpg"))
urllib.urlretrieve("http://images.drivebc.ca/bchighwaycam/pub/cameras/179.jpg", os.path.join("C:\Webcams","2 alicelake.jpg"))

#Start a slideshow of the webcam directory using XBMC's builtin function
xbmc.executebuiltin("SlideShow(C:\Webcams)")