Kodi Community Forum
[RELEASE] Autoplay directory (script) - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Program Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=151)
+---- Thread: [RELEASE] Autoplay directory (script) (/showthread.php?tid=69797)

Pages: 1 2


RE: [RELEASE] Autoplay directory (script) - whoozwah - 2014-10-13

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?


RE: [RELEASE] Autoplay directory (script) - Moharram - 2015-02-02

(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


RE: [RELEASE] Autoplay directory (script) - MovingDots - 2015-02-23

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 !!


RE: [RELEASE] Autoplay directory (script) - tzahovy - 2015-11-04

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


RE: [RELEASE] Autoplay directory (script) - robwiel - 2015-11-10

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


RE: [RELEASE] Autoplay directory (script) - ban007 - 2016-01-13

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)


RE: [RELEASE] Autoplay directory (script) - ban007 - 2016-01-28

Does anyone knows how can i update the playlist automatically (crontab?) without rebooting?
Thanks in advance!