Created
March 10, 2020 19:21
-
-
Save georgboe/463f5bb98e08ba8c1a941e1197ca16e6 to your computer and use it in GitHub Desktop.
Script to autoplay videofiles in KODI in random order - put this your kodi userdata directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Autoplay videodirectory | |
import os, xbmc | |
# set path to dir you want to play | |
path = "/var/media/asdf" | |
dirList = os.listdir(path) | |
dirList.sort() | |
videoList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) | |
videoList.clear() | |
for file in dirList: | |
videoList.add(path + "/" + file) | |
# shuffle playlist | |
videoList.shuffle() | |
# put playlist on repeat | |
xbmc.executebuiltin("xbmc.playercontrol(RepeatAll)") | |
# play playlist | |
xbmc.Player().play(videoList) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The script can also be triggered manually using
kodi-send
:kodi-send -a "RunScript(/storage/.kodi/userdata/autoexec.py)"