[RELEASE] Autoplay directory (script)
#16
I am currently using openelec on an intel NUC. I have created the script file and copied it to my installation inside the userdata folder and modified it to point to a directory of files on my hard drive. Then I created a function on xbmc home menu that runs RunScript(Special://profile/autoplaydir.py) but it just returns "script failed". Any ideas?
Reply
#17
(2014-10-13, 10:32)yvanof Wrote: found solution:

Quote:# Autoplay videodirectory
import os, xbmc

# set path to dir you want to play
path="/mnt/SATA Disk #1 GeeXboX (0)/media/"

dirList=os.listdir(path)

dirList.sort()

videoList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
videoList.clear()

for fname in dirList:
videoList.add(path + "\\" + fname)

# shuffle playlist
#videoList.unshuffle()

# put playlist on repeat
xbmc.executebuiltin("xbmc.playercontrol(RepeatAll)")

# play playlist
xbmc.Player().play(videoList)

i have downloaded this script on my pi board, but it doesn't work and an error message apears on screen.
is the syntax of this script true.

for example '\' and '/' in two sections of code.

is there a final version of this script (that was written correctly) without errors.

thanks
Reply
#18
Hi, i have the script working but i would love to be able to play a directory on my nas, i'm using NFS.
But any way i've tried this, the script doesn't do anything or gives me an error.
Does anybody know how i have to refer to my NFS folder when using this or another script?

The reason why i want to do this is because i want to be able to change the files on the nas and have multiple pi's play them, without having to copy the files to multiple devices.

thanks so much !!
Reply
#19
Hi,

I wanted to run a youtube play list with shuffle. Apparently the shuffle is not working very well in this .m3u file. I found out that by toggling the shuffle ON and OFF I get a shuffled list, hence I've blased the shuffle in a for loop that runs a random number of iterations. Next I've added a shortcut in the favourites.xml file for the script

import os, xbmc, xbmcgui,random, time, xbmcaddon


path="C:\\Users\\19009843\\AppData\\Roaming\\Kodi\\userdata\\playlists\\video"

dirList=os.listdir(path)

videoList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
videoList.clear()


videoList.load(path+"\\grunge.m3u")


t=random.randint(1, 100)

# shuffle playlist
for x in range(0, t):
videoList.shuffle()
videoList.unshuffle()
videoList.shuffle()

# put playlist on repeat
xbmc.executebuiltin("xbmc.playercontrol(RepeatAll)")

# play playlist
xbmc.Player().play(videoList)


Hope this helps...

Tzahovy
Reply
#20
Hi, thanks for script,

I am using it to play various materials found on network drive (including pptx and jpg through external players).
How can I achieve restart of kodi on changing of folder contents (or dynamic loading files into that playlist)?

regards,
R
Reply
#21
The sript that worked for me:
# -*- coding: utf-8 -*-
# Autoplay videodirectory
import os, xbmc
# set path to dir you want to play
path='/home/osmc/Movies'
dirList=os.listdir(path)
dirList.sort()
videoList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
videoList.clear()
for fname in dirList:
videoList.add(path+'/'+fname)
# shuffle playlist
#videoList.unshuffle()
# put playlist on repeat
xbmc.executebuiltin('xbmc.playercontrol(RepeatAll)')
# play playlist
xbmc.Player().play(videoList)
Reply
#22
Does anyone knows how can i update the playlist automatically (crontab?) without rebooting?
Thanks in advance!
Reply



Logout Mark Read Team Forum Stats Members Help
[RELEASE] Autoplay directory (script)1
This forum uses Lukasz Tkacz MyBB addons.