# Autoplay videodirectory import os, xbmc # set path to dir you want to play path = "/var/media/USB" dirList = os.listdir(path) dirList[:] = [d for d in dirList if not os.path.isdir(path + d)] videoList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) videoList.clear() for fname in dirList: videoList.add(path + "/" + fname) # shuffle playlist #videoList.shuffle() # put playlist on repeat xbmc.executebuiltin("xbmc.playercontrol(RepeatAll)") # play playlist xbmc.Player().play(videoList)