I managed to get this working, sort of.
I created a new shortcut within /home/osmc/.kodi/userdata/favourites.xml
:
<favourites>
<favourite name="Slideshow">RunScript(/home/osmc/slideshow.py)</favourite>
</favourites>
I then created a new file /home/osmc/slideshow.py
:
import xbmc
from time import sleep
from os import listdir
minutes = 1
picfolder = "/home/osmc/images"
l1 = []
while 1:
l2 = listdir(picfolder)
if (l1 != l2):
xbmc.executebuiltin('xbmc.slideshow(' + picfolder + ')')
l1 = l2
for seconds in range(minutes * 60):
sleep(1)
Note: The Python code is from this thread.
Starting the script from the favourites menu runs a slideshow of images from the folder. The code checks for changes in the directory every minute and restarts the slideshow if anything changes, effectively functioning as an ‘auto refresh’. This works as expected.
Unfortunately I haven’t found a way to stop the script from running. If you exit the slideshow, the Python code keeps running in the background and will restart the slideshow if the folder contents change. Not ideal.
Perhaps the above is useful for someone.
If anyone can suggest a straightforward way to have the script stop running once the slideshow has ended I’d appreciate any pointers. I’m sure it’s possible, but it is probably beyond my skill level…
Edit for future reference: Perhaps look at using xbmc.getCondVisibility(Slideshow.IsActive) ?