DrolleryMedieval drollery of a knight on a horse
flowery border with man falling
flowery border with man falling

mpv

mpv is a multimedia player that runs on the command line predominently. A unique feature of mpv is that it can be controlled via a socket using JSON commands. To start an mpv instance that is ready to accept socket commands run the following:

mpv --input-ipc-server=/tmp/mpv.sock -v --keep-open=yes --idle=yes --force-window=immediate

Once mpv has been started in this way you can then append to the playlist with the following JSON:

{ "command": ["loadfile", "somefile.mp3", "append"] }

The loadfile directive “append-play” can be used instead. This directive will append the video to the playlist and start playing the playlist if it is not already being played.

From the command line you can echo the above string into socat and direct it to the appropriate socket, ie /tmp/mpv.sock.