2016-11-27, 02:08
Hi, I am trying to create a Python script (called from Kodi Favourites) that will start a picture slideshow, then auto-restart it if the folder contents change (e.g. new images added). Before writing that code, I am starting with some simple monitoring code to see if I can get that working.
I am currently struggling to understand how xbmc.getCondVisibility('Slideshow.IsActive') works.
Here is my very basic and debug heavy test code (please forgive the code - I'm a novice at this):
My issue is that the value of xbmc.getCondVisibility('Slideshow.IsActive') doesn't change to 0 if the user manually exits the slideshow.
From the code above and other basic testing I've done, it seems like Slideshow.IsActive gets set to 1 the first time a slideshow is started, but never resets to 0 when the slideshow is stopped.
From reading the Wiki it would appear simple - Slideshow.IsActive should be 1 when a slideshow is running, and 0 when one is not running.
Am I missing something simple here?
I am currently struggling to understand how xbmc.getCondVisibility('Slideshow.IsActive') works.
Here is my very basic and debug heavy test code (please forgive the code - I'm a novice at this):
Code:
import xbmc
from time import sleep
monitor = xbmc.Monitor()
picfolder = "/home/osmc/images"
xbmc.executebuiltin('SlideShow(%s)' %(picfolder))
xbmc.log("[slideshowtesting] Started")
sleep(5)
xbmc.log("[slideshow] Entering check loop")
while 1:
print "Here is the slideshow active boolean:"
print xbmc.getCondVisibility('Slideshow.IsActive')
if xbmc.getCondVisibility('Slideshow.IsActive'):
xbmc.log("[slideshow] Still running")
else:
xbmc.log("[slideshow] Finished")
break
xbmc.log("[slideshow] Sleeping...")
sleep(10)
xbmc.log("[slideshow] Exiting")
My issue is that the value of xbmc.getCondVisibility('Slideshow.IsActive') doesn't change to 0 if the user manually exits the slideshow.
From the code above and other basic testing I've done, it seems like Slideshow.IsActive gets set to 1 the first time a slideshow is started, but never resets to 0 when the slideshow is stopped.
From reading the Wiki it would appear simple - Slideshow.IsActive should be 1 when a slideshow is running, and 0 when one is not running.
Am I missing something simple here?