From d0eb2034431b18c1b5da14b1c2e8c17d436a4aa6 Mon Sep 17 00:00:00 2001 From: Dooho Yi Date: Thu, 30 Sep 2021 12:28:39 +0900 Subject: [PATCH] init --- README.md | 4 ++++ service.autoexec/addon.xml | 14 ++++++++++++++ service.autoexec/autoexec.py | 23 +++++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 README.md create mode 100644 service.autoexec/addon.xml create mode 100644 service.autoexec/autoexec.py 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)