donotturnoff

mpvctl

Introduction

mpvctl is a shell script for controlling mpv via its socket interface. I wrote this to have more advanced control over mpv using my keybindings in dwm.

Files

Dependencies

Documentation

In the following documentation, MR refers to the most-recently-opened instance of mpv.

Program arguments

Usage: mpvctl command [PATTERN]

Positional arguments
command
The command for mpvctl to run. One of:
toggle
Toggle play/pause for MR. If no instance of mpv is running, run the command defined in $MPVCMD
toggle_all
Toggle play/pause for all instances of mpv
prev
Play the previous item in the playlist of MR
next
Play the next item in the playlist of MR
get_file
Echo the filename of the file currently being played by MR
is_paused
Echo true if MR is paused and false otherwise
play
Unpause MR if pattern is not specified, otherwise pause MR then play files in $MUSICPATH matching pattern
pause
Pause MR
stop
Kill MR and delete its socket
Optional arguments
pattern
A search string for finding files to play when using the play command. Can be several words, but no glob or regex matching is performed

Configuration

Variables
MPVCMD
The command to run if no instance of mpv is running when the toggle command is executed
MUSICPATH
The path to search for files to play when the play command is executed

To do