Picture Slideshow update from external folder
#1
Hi,

I have been trying to make a slideshow in Kodi which will automatically load on start up and play a slide show from a folder stored in a remote location.

Using some very useful work arounds in this forum I have it almost working as I need now but I have one more hurdle to overcome.

The code I have adapted from this site is as follows.

autoexec.py (to load on start up) works great
PHP Code:
import xbmc

xbmc
.executebuiltin('XBMC.RunScript("special://home/slideshow.py")'

slideshow.py
PHP Code:
import xbmc

from time import sleep
from os import listdir

minutes 
1
picfolder 
"Pictures"

l1 = []
while 
1:
 
l2 listdir(picfolder)
 if (
l1 != l2):
   
xbmc.executebuiltin("ActivateWindow(Pictures,Pictures)")
   
xbmc.executebuiltin("Action(Play)")
   
l1 l2
 
for seconds in range(minutes 60):
   
sleep(1

'Pictures' links to a remote folder via FTP. This part works fine. My sources.xml file shows the ftp path to the name Pictures.

What i'snt working is the 'listdir', 'picfolder' should be a link to the folder that stores the picture so that it can check for changes. If I use something like 'C://Pictures' it works fine but because I am trying to get this information from a remote folder it keeps saying that it cannot be found. I have tried 'Pictures', 'ftp://"server address"' but still cant get it to go.

So I guess my question is how can get listdir to work with an ftp connection.

Hope you can help
Reply
#2
the os module only supports local filesystems.
you can use the xbmcvfs module instead for access to remote filesystems.
Code:
from xbmcvfs import listdir
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
Thanks very much this now works.

Code:
import xbmc

from time import sleep
from xbmcvfs import listdir

minutes = 1
picfolder = "ftp://user:pass@domain:21/web/images/"

l1 = []
while 1:
l2 = listdir(picfolder)
if (l1 != l2):
  
   xbmc.executebuiltin("ActivateWindow(Pictures,ftp://user:pass@domain:21/web/images/)")
   xbmc.executebuiltin("Action(Play)")
   l1 = l2
for seconds in range(minutes * 60):
   sleep(1)

is there a more efficient way of adding the url to the external folder. I have tried Pictures as it is listed in sources but it didn't update but the direct address works.
Reply
#4
Hello,

I am tryin to run same script, but I am getting some errors:

Code:
[quote] Error Type: <type 'exceptions.IndentationError'>
Error Contents: ('unexpected indent', ('/storage/.kodi/userdata/autoexec.py', 3, 1, '\txbmc.executebuiltin(\'XBMC.RunScript("special://masterprofile/slideshow.py")\') \n'))
IndentationError: ('unexpected indent', ('/storage/.kodi/userdata/autoexec.py', 3, 1, \txbmc.executebuiltin(\'XBMC.RunScript("special://masterprofile/slideshow.py")\') \n'))
-->End of Python script error report<--[/quote]

I know, it has something to do with my code formating. My code looks like this:


Code:
import xbmc

from time import sleep
from xbmcvfs import listdir

minutes = 1
picfolder = "//storage/pictures/"

l1 = []
while 1:
l2 = listdir(picfolder)
if (l1 != l2):
  xbmc.executebuiltin("ActivateWindow(Pictures,//storage/pictures/)")
  xbmc.executebuiltin("Action(Play)")
  l1 = l2
for seconds in range(minutes * 60):
  sleep(1)
Reply

Logout Mark Read Team Forum Stats Members Help
Picture Slideshow update from external folder0