Kodi features a special action called PartyMode, which instantly starts playback of random music. The feature accepts a parameter, which works with music but not for videos.

You can find a working solution here - for starting playback of random videos from a remote client, local shell or within Kodi itself. Kodi has a feature called Smart Playlists, which allows to create a solution that is superior to a simple PartyMode for videos.

The option for music can be invoked by the action PartyMode(music). In Kodi docs the same is listed for videos too, but apparently it doesn’t work as expected (tested on Kodi 17.6 and Kodi 18 Alpha). Kodi just starts the PartyMode sidebar, but doesn’t load any videos in the list or starts playback.

Possibilities with Smart Playlists

The table below lists all available options for smart playlists:

  • Type: Needs to be placed in the playlist xml file
  • Queue filled with: Queued items when random order is specified
  • Example playlist: Examples with reuse where possible
TypeQueue filled withExample playlist
moviesAny movie in libraryKung Fury, Forrest Gump
episodesEpisodes of any seriesSimpsons S0304, Community S0203
tvshowsComplete series with episodes in correct orderSmallville S0101, Smallville S0102, ... Simpsons S0101
Songs from whole libraryWalking Disaster, Feeling This
albumsComplete albums with songs in correct orderWalking Disaster, Dear Father, With Me, ... Feeling This
musicvideosMusic videos21 Guns, Astronaut
mixedAll songs and music videos21 Guns, Feeling This

Creating Smart Playlists

Below is the content for a smart playlist with random playback (replace movies with one value out of Type column). More examples, filter and limit options are available in the Kodi Wiki.

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="movies">
    <order direction="ascending">random</order>

Place the contents in a xml file inside Kodi userdata folder. Below is the needed structure, place those files that are needed.

$ pwd
$ tree
├── mixed
│   └── PartyModeMusicAndMusicVideo.xsp
├── music
│   └── PartyModeMusicAlbums.xsp
└── video
    ├── PartyModeMovie.xsp
    └── PartyModeSeries.xsp

Starting playback

Replace host and relative playlist path with own values.

  • JSON RPC API – POST request with curl
    curl -g --data-binary '{ "jsonrpc": "2.0", "method": "Player.Open", "params": { "item": {"file": "special://profile/playlists/video/PartyModeSeries.xsp"} } }' --header 'content-type: application/json;'
  • kodi-send (only supports Music)
    $ kodi-send --action="PlayerControl(Partymode(Music))"
  • Kodi itself
    Navigate to Playlists -> Smart Playlists, start playback of an item

  • OpenHab 2
    Create a binding which executes shell script (either using Exec2 binding or a rule). Paste the curl command into the script, this way it is also useable without OpenHab. Another way is to make a request using HTTP bindings, but it requires proper encoding. Kodi bindings are quite limited.