Kodi Community Forum

Full Version: Autoplay Playlist on startup
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

i´d like to start kodi with playling a .m3u playlist. I tried to create a script named "autoexec.py" at "C:\Users\[USER]\AppData\Roaming\Kodi\userdata" which contains:

import xbmc
xbmc.executebuiltin( "PlayMedia(/home/pi/.kodi/userdata/playlists/video/startup.m3u)" )
xbmc.executebuiltin( "PlayerControl(repeat)" )

The script is executed at startup but nothing happens. This is what the logfile says:

10:21:13 T:4924 WARNING: CPythonInvoker(3): Script invoked without an addon. Adding all addon modules installed to python path as fallback. This behaviour will be removed in future version.
10:21:13 T:11208   ERROR: PlayMedia could not play media: /home/pi/.kodi/userdata/playlists/video/startup.m3u

Can anyone help me?
I have no idea, but try creating the playlist as an .xsp instead.

Can you post the contents of the playlist?

You can try special://videoplaylists/ as path instead.
I´ve solved my problem with the following script:

# Autoplay videodirectory
import os, xbmc

# set path to dir you want to play


videoList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)

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

# shuffle playlist

# put playlist on repeat

# play playlist
Hi, thanks for sharing your code. I am new to Kodi and I was looking for an example like this one.
In my case I launch Kodi from an application in Widows on my second Display, and like it to play what is in the play list and exit.
What is the command to close Kodi after it finishes?
Any tips on how I can learn the API? I have found the wiki but because I am new it is not clear to me yet.