Kodi AutoPlay & Repeat Playlist At Startup

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 system File path
Android Android/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/
Windows Start – 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!

Matt Hill

Matt Hill is in his mid 20′s and has a passion for technology. Matt studied Computer and Network Administration at University and currently works as an IT Administrator for a company based in his home town.

15 Comments

  1. Ron   •  

    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

    • Matt Hill   •     Author

      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. xury   •  

    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 🙂

    • Matt Hill   •     Author

      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   •  

    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. abcniktaylor   •  

    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.

    • Matt Hill   •     Author

      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. TW   •  

    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. abcniktaylor   •  

    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.

    • Matt Hill   •     Author

      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. abcniktaylor   •  

    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. Matthew Carroll   •  

    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   •  

    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

    • Matt Hill   •     Author

      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!

Leave a Reply