33 lines
710 B
Python
33 lines
710 B
Python
# Autoplay videodirectory
|
|
import os, xbmc
|
|
import re
|
|
|
|
# set path to dir you want to play
|
|
path = "/var/media/USB"
|
|
|
|
# filter out unwanted
|
|
|
|
# dot(.) files
|
|
PATTERN1 = re.compile(r"^\..+")
|
|
# System Volume Information folder
|
|
PATTERN2 = re.compile(r"System Volume Information")
|
|
|
|
dirList = os.listdir(path)
|
|
dirList[:] = [d for d in dirList if not PATTERN1.match(d)]
|
|
dirList[:] = [d for d in dirList if not PATTERN2.match(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)
|