commit d0eb2034431b18c1b5da14b1c2e8c17d436a4aa6 Author: Dooho Yi Date: Thu Sep 30 12:28:39 2021 +0900 init diff --git a/README.md b/README.md new file mode 100644 index 0000000..3e74245 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +## an autoplay script for LibreELEC @ RPI + +- put this at /STORAGE/.kodi/addons/service.autoexec/ + diff --git a/service.autoexec/addon.xml b/service.autoexec/addon.xml new file mode 100644 index 0000000..15e3604 --- /dev/null +++ b/service.autoexec/addon.xml @@ -0,0 +1,14 @@ + + + + + + + + + Automatically run python code when Kodi starts. + The Autoexec Service will automatically be run on Kodi startup. + all + GNU GENERAL PUBLIC LICENSE Version 2 + + diff --git a/service.autoexec/autoexec.py b/service.autoexec/autoexec.py new file mode 100644 index 0000000..efc7817 --- /dev/null +++ b/service.autoexec/autoexec.py @@ -0,0 +1,23 @@ +# 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)