Making Kodi autoplay a playlist when loaded, then repeat that playlist until stopped is not as straight forward as you might think, with some trial and error reading the issues various people encountered, this is how i ended up successfully making Kodi play and repeat my video play list when started / loaded up.

Firstly go to  Settings > Appearance > Skin

Ensure you are using the Confluence skin and select “Settings”:

Kodi Auto Repeat Playlist On Startup

Then under the General setting “Enable playlist at startup” and select where the playlist is saved as the path:

Kodi Auto Repeat Playlist On Startup

That’s the obvious part done, however if you do that and leave Kodi to it, you will find when you reach the end of the play list Kodi will not repeat it.

To have Kodi repeat this play list we need to place a little script in the Kodi userdata folder, the location of this will vary depending on the operating system you are using, see the table below for help:

Operative systemFile path
AndroidAndroid/data/org.xbmc.kodi/files/.kodi/userdata/
iOS/private/var/mobile/Library/Preferences/Kodi/userdata/
Linux~/.kodi/userdata/
Mac/Users/<your_user_name>/Library/Application Support/Kodi/userdata/
LibreELEC/OpenELEC/storage/.kodi/userdata/
WindowsStart – type %APPDATA%\kodi\userdata – press <Enter>

Once you are in the Kodi userdata folder you want to create a file called autoexec.py, you can do this in any text editor. For example Notepad on Windows or Nano on Linux based operating systems.

Simply paste the following in your autoexec.py file and save it:

import xbmc
xbmc.executebuiltin( “PlayerControl(repeat)” )

Kodi Auto Repeat Playlist On Startup

If for some reason you are having trouble here is a zipped copy of my autoexec.py you can simply unzip to your Kodi userdata folder.

The end result should be when Kodi boots your playlist will start playing and the autoexec.py script will ensure the play list repeats in-defiantly.

I have done the above on a Raspberry Pi 3 running Kodi via OpenELEC 6.0.3 with no issue, my videos happily repeat all day long in our showroom.

Final Note:

It’s worth mentioning you can also make Kodi start playing a playlist with the autoexec.py script:

import xbmc
xbmc.executebuiltin( “PlayMedia(/storage/.kodi/userdata/playlists/video/showroom.m3u)” )
xbmc.executebuiltin( “PlayerControl(repeatall)” )

However i found if the TV was not on when Kodi was loaded  it would only play the first item on the playlist, then keep repeating the first item on the playlist only. This for me was not ideal as i needed everything to just work with no user interaction, which is what the solution detailed in this blog post allows for.

I hope this is of help to someone anyway!

Author

Matt has always had a passion for computers, gadgets and technology. He will never be found too far away from a good cuppa tea.

26 Comments

  1. Ey Matt, Thanks for this, that’s awesome! I was hoping you also have a solution for my next little problem: How could I remotely change the files in that playlist (over the internet). By FTP, perhaps? Can you point me in the right direction? Thanks! Ron

    • That’s really going to depend on the OS you are running Kodi on, if its Open ELEC or Linux you should have SSH access by default, so can just connect via SFTP and download the playlist, modify it in Notepad for example, then re-upload the playlist and any new media to the location you specified on the playlist.

      After doing so you could reboot and Kodi should startup and be playing the new playlist.

  2. Hi Matt
    It’s what I needed.
    But maybe you know how to do playing only 30 second for every item on playlist ?
    Then next and next in loop forever 🙂

    • I can’t think how you would do that in Kodi. You might well need to write a custom plugin to do something like that.

      You might have more luck asking on the Kodi forums, how come you only want to play 30 seconds out of curiosity?

  3. runner2004 Reply

    I set up my osmc for with the partymode(music) command. Works very well in cooperation with updating the library on startup. As I added the ‘music’folder of my USB flash to the library, I just need to copy the desired files to the flash drive and plug it to the pi, actually installed in my car.

  4. Hi

    I am stuck on the part where you write

    Then under the General setting “Enable playlist at startup” and select where the playlist is saved as the path:

    However I navigate around the file system I cannot find the playlist .m3u file. I have created the playlist, then saved it, but got no option nor indication of where it was going to be saved.

    Am I meant to create the playlist then save it to the usb drive containing the media file on my windows pc?
    I feel like I am missing something very obvious here.

    Any help is much appreciated, thanks.

    • Do you see it in your userdata/playlists folder?

      The location of the userdata folder will vary depending on your OS, however i included where to find them on various OS’s in the above blog.

  5. hI abcniktaylor, not sure but i think its neceary to check the option of show hidden files to be able to select m3u playlist files

    Great job Matt Hill !!!

    Now i’m working to get a simply way to replace remotely the MP4 file of the playlist. I would like to offer it to my customers to do it themselve. Do you know any “simply” tool to do it in the way of a DropBox or similar? Samba maybe? THANKS AGAIN !

  6. Hi Matt. Thanks for the reply. I have sorted that problem, I had to check the option tom show hidden files/folders. Then I could find it. However I have now run into another problem. Since proving to myself that it could be done (autoplay and repeat of a playlist on startup) I then bought 2 new rpi3’s for my work (an art gallery) to use for playing video art on loop. Very frustrated to find that the menu option to enable playlist on startup has been completely removed. OS is Libreelec, skin is confluence. I tried making another sd card using osmc, then changing the skin to confluence, but same thing. Any advice? My personal one is an rpi 2 model B, running openelec with confluence skin, and your method worked perfectly. Do I have to image a card with openelec to get that option back? Or am I missing something obvious…

    I am very new to this. I appreciate any advice you can give.

    • As TW mentioned in the comment below use OpenElec and everything should work as described. I have a couple of Pi 3’s in our showroom running Kodi via OpenElec, playing video all day long.

      Slightly off topic, however MP4 Museum is a really simple solution too: http://mp4museum.org/ providing you only want to play MP4 video.

  7. Hi. Thanks TW and Matt Hill for your replies. Fortunately I managed to work out the code to do the same thing with OSMC, working perfectly. But I found the mp4museum thing very interesting. Besides the mp4 only limitation (not that big a deal) it looks perfect.Especially for those less geekily inclined who will remain here after I leave…

    Now for my next challenge. Playing 2 different videos on 2 different raspberry pi’s in sync. Wish me luck.

  8. Matt, cheers for the info. Do you know if it’s possible to run a multi-media playlist at start-up AND when the screen-saver kicks in? So when no-one is using the presentation screen it defaults to the playlist. I’ve looked at various Kodi add-ons but none seem to be suitable.

  9. Michel Alvarez Reply

    Dear Matt, many thanks for this tutorial. I think that your problem with the autolaunch with the TV off may be solved if you replace the Repeat command for RepeatAll in your autoexec.py

    • Thank you for the tip Michel, I will try that next week and see!

      Edit – I tried this and you were correct, sometimes, however not always this seemed to be an issue.

      Making that little changed seemed to stop it from happening anyway, thanks for letting me know!

  10. Chris Newton Reply

    If you want to shuffle the playlist at startup, you can add an extra line to your autoexec.py script:

    import xbmc
    xbmc.executebuiltin( “PlayerControl(repeat)” )
    xbmc.executebuiltin( “PlayerControl(RandomOn)” )

  11. Hi Matt,

    I’ve followed your guide (thank you for sharing) but I’m using the party mode add on as the “enable playlist at startup” option had now been moved out of the skin settings in Kodi. The file in the playlist will play on startup but will not repeat whichever set of code I use from your guide in the autoexec.py file.

    Any help will be much appreciated, I’m using a 1st Gen Fire Stick if that helps.

  12. Seems the option “enable playlist at startup” is not available anymore. Time to update this article ?

    • Try modifying your autoexec.py to:

      import xbmc
      xbmc.executebuiltin( “PlayMedia(/storage/.kodi/userdata/playlists/video/showroom.m3u)” )
      xbmc.executebuiltin( “PlayerControl(repeatall)” )

      Does that work for you on later versions?

  13. Hello Matt.
    I followed your guide with Kodi version 17.6 and skin confluence.

    There is no entry in the Skin Settings General, Windows startup.

    I created the autoexec.py file and placed it in the /storage/.kodi/userdata/ folder, because I use LibreELEC / OpenELEC.

    The file is written like this:

    import xbmc
    xbmc.executebuiltin(“PlayerControl(repeatall)”)
    xbmc.executebuiltin(“PlayerControl(RandomOn)”)
    xbmc.executebuiltin(“PlayMedia(/storage/.kodi/userdata/playlists/video/Vetrina.m3u)”)

    but nothing works, why?
    Thank you.

  14. Now works.
    I did more than one reboot and did what I wrote in the file I shot before.
    Thank you.

  15. Is it possible to start a movie directly from the android tv home (shield tv home) in the smart playlist section without entering the movie in the information tab?

    (the movies are in the kodi library, and organized through the smart playlists that are then seen on the android tv home)

    Many thanks in advance 🙏

Write A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.