libreelec_autoplay/service.autoexec/autoexec.py
2021-09-30 12:28:39 +09:00

24 lines
489 B
Python

# 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)