Kodi Community Forum
How to programmatically display all the videos in a directory in a loop? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Raspberry Pi (https://forum.kodi.tv/forumdisplay.php?fid=166)
+---- Thread: How to programmatically display all the videos in a directory in a loop? (/showthread.php?tid=328699)



How to programmatically display all the videos in a directory in a loop? - kxb3292 - 2018-02-19

Hello All,

I have a set up of raspberry pi 3 with raspbian operating system with kodi v16.1. I am trying to come up with a way to display all the videos I have in a directory (/home/pi/media) in a loop using kodi. My requirements are :

- I would like the video slideshow to start automatically when kodi is started using a script
- The slideshow should keep displaying all the videos in a particular directory in a loop and update itself if some content is added/removed from this directory (/home/pi/media)

Is there a step by step way that we could make this work? Perhaps there is a script/set up that can do this? Somebody else also must have stumbled upon this need. Perhaps I could get some hints/pointers to get there? Can this set up be created programmatically (assuming that the slideshow should run smoothly without having to intervene with keyboard/mouse)?

I would really appreciate any thoughts/help/ideas

Thank you so much!
kxb3292


RE: How to programmatically display all the videos in a directory in a loop? - DaVu - 2018-02-23

Probably it´s possbile to do that with an autoexec.py placed in your userdata folder.

it might look something like this:

python:

import xbmc
xmbc.executebuiltin('PlayMedia(/home/pi/media),isdir)')
xbmc.executebuiltin('PlayerControl(RepeatAll)')

Another way might be using a smart playlist and then play this at startup using a similar command for the autoexec.py. But I guess this won´t be updated automatically if you add content to a folder. Not so sure about smart playlists as I don´t use them very often. But I guess you need to update the playlist each time you add or remove content. For the example above, where you have your content in a specific folder, Kodi plays the content from that folder (,isdir) and if you add something to it, it should play that as well.

I hope that helps at least in a bit Wink