Mpv lua script to create and manage playlists.
This script allows you to see and interact with your playlist in an intuitive way. The key features are removing, reordering and playing files. Additional features include resolving url titles, stripping filenames according to patterns and creating/saving/selecting/shuffling/sorting playlists.
Requires mpv version 0.39.0, for a more compatible playlistmanager version see this.

Default visual cues(might render differently on browsers):
○ default file
▷ playing file
● hovered file(for removing, playing and moving)
▶ playing and hovered file
➔ selected file(file is being moved)
➤ playing and selected file
It will make sense once you try the script!
Copy the playlistmanager.lua file to your mpv scripts directory which is usually ~/.config/mpv/scripts/ or %APPDATA%/mpv/scripts/. See https://mpv.io/manual/master/#files and https://mpv.io/manual/master/#script-location for more detailed information.
You can modify behaviour of the script in the settings variable in the lua file or a playlistmanager.conf lua-setting file in script-opts directory.
Note: the conf file will override any changed setting in the lua file. There is a playlistmanager.conf file in this repo with the default values of the script for reference.
You can pass settings from the command line on startup such as mpv --idle=once --script-opts=playlistmanager-loadfiles_on_start=yes.
You can also change settings during runtime with a keybind or command like KEY change-list script-opts append playlistmanager-showamount=10.
If you are using save-position-on-quit then the playlist will by default write watch later config when switching between files. There is a setting to disable this.
This script is able to resolve titles for local files with ffprobe and urls with youtube-dl. See the resolve_url_titles, resolve_local_titles, prefer_titles and youtube_dl_executable settings for details.

KEY script-message playlistmanager sortplaylist startover. Settings involving sort include alphanumeric sort(nonpadded numbers in order, case insensitivity), sort on mpv start and sort on file added to playlist. Sort algorithm credit zsugabubus--idle=yes or --idle=once.mpv/playlists/ by default. Prompts for filename by default.The above functions do not have default keybindings(except for showplaylist). There is a couple of ways to bind keys for them:
playlistmanager.lua settings
playlistmanager.conf settings
playlistmanager.lua file without losing your configurationsinput.conf with for example KEY script-binding playlistmanager/showplaylist
showplaylist or use --no-input-default-bindingsDynamic keybinds will only work when playlist is visible. Dynamic binds cannot be defined in input.conf, only in playlistmanager.lua or playlistmanager.conf. There is a setting to change the binds to static ones, which allows you to define keybindings in input.conf.
In order to control the playlistmanager from other script it registers some script messages.
The script messages can also be invoked by keybinds KEY script-message playlistmanager command value value2.
List of commands, values and their effects:
| Command | Value | Value2 | Effect |
|---|---|---|---|
| show | playlist | - / duration / toggle | show for default duration, show for given seconds, toggle playlist visibility |
| show | playlist-nokeys | - / duration / toggle | same as above but don't bind dynamic keys to navigate playlist |
| show | filename | - / seconds | shows stripped filename for default or set seconds |
| sort | startover | - | Sorts the playlist, any value will start playlist from start on sort |
| shuffle | - | - | Shuffles the playlist |
| reverse | - | - | Reverses the playlist |
| loadfiles | - / path | - | Loads files from playing files dir(default), or specified path |
| save | - / filename | - | Saves the playlist |
| save-interactive | - | - | Prompts for playlist name and saves on enter |
| open-menu | - | - | Opens the playlistmanager menu |
| select-playlist | - | - | Opens the saved playlist list |
| playlist-next | - | - | Plays next item in playlist (position of current file saved) |
| playlist-prev | - | - | Plays previous item in playlist (position of current file saved) |
| playlist-next-random | - | - | Jumps to a random file in the playlist |
| close | - | - | Hides the playlist if it's being rendered |
examples:
RIGHT playlist-next ; script-message playlistmanager show playlist Shows the playlist after playlist-next. Note that the playlist-next is native mpv command, not the playlistmanager one.
KEY show-text "Shuffled playlist" ; script-message playlistmanager shuffle Text message on shuffle
Lua
100.0%
Mpv lua script to create and manage playlists.
This script allows you to see and interact with your playlist in an intuitive way. The key features are removing, reordering and playing files. Additional features include resolving url titles, stripping filenames according to patterns and creating/saving/selecting/shuffling/sorting playlists.
Requires mpv version 0.39.0, for a more compatible playlistmanager version see this.

Default visual cues(might render differently on browsers):
○ default file
▷ playing file
● hovered file(for removing, playing and moving)
▶ playing and hovered file
➔ selected file(file is being moved)
➤ playing and selected file
It will make sense once you try the script!
Copy the playlistmanager.lua file to your mpv scripts directory which is usually ~/.config/mpv/scripts/ or %APPDATA%/mpv/scripts/. See https://mpv.io/manual/master/#files and https://mpv.io/manual/master/#script-location for more detailed information.
You can modify behaviour of the script in the settings variable in the lua file or a playlistmanager.conf lua-setting file in script-opts directory.
Note: the conf file will override any changed setting in the lua file. There is a playlistmanager.conf file in this repo with the default values of the script for reference.
You can pass settings from the command line on startup such as mpv --idle=once --script-opts=playlistmanager-loadfiles_on_start=yes.
You can also change settings during runtime with a keybind or command like KEY change-list script-opts append playlistmanager-showamount=10.
If you are using save-position-on-quit then the playlist will by default write watch later config when switching between files. There is a setting to disable this.
This script is able to resolve titles for local files with ffprobe and urls with youtube-dl. See the resolve_url_titles, resolve_local_titles, prefer_titles and youtube_dl_executable settings for details.

KEY script-message playlistmanager sortplaylist startover. Settings involving sort include alphanumeric sort(nonpadded numbers in order, case insensitivity), sort on mpv start and sort on file added to playlist. Sort algorithm credit zsugabubus--idle=yes or --idle=once.mpv/playlists/ by default. Prompts for filename by default.The above functions do not have default keybindings(except for showplaylist). There is a couple of ways to bind keys for them:
playlistmanager.lua settings
playlistmanager.conf settings
playlistmanager.lua file without losing your configurationsinput.conf with for example KEY script-binding playlistmanager/showplaylist
showplaylist or use --no-input-default-bindingsDynamic keybinds will only work when playlist is visible. Dynamic binds cannot be defined in input.conf, only in playlistmanager.lua or playlistmanager.conf. There is a setting to change the binds to static ones, which allows you to define keybindings in input.conf.
In order to control the playlistmanager from other script it registers some script messages.
The script messages can also be invoked by keybinds KEY script-message playlistmanager command value value2.
List of commands, values and their effects:
| Command | Value | Value2 | Effect |
|---|---|---|---|
| show | playlist | - / duration / toggle | show for default duration, show for given seconds, toggle playlist visibility |
| show | playlist-nokeys | - / duration / toggle | same as above but don't bind dynamic keys to navigate playlist |
| show | filename | - / seconds | shows stripped filename for default or set seconds |
| sort | startover | - | Sorts the playlist, any value will start playlist from start on sort |
| shuffle | - | - | Shuffles the playlist |
| reverse | - | - | Reverses the playlist |
| loadfiles | - / path | - | Loads files from playing files dir(default), or specified path |
| save | - / filename | - | Saves the playlist |
| save-interactive | - | - | Prompts for playlist name and saves on enter |
| open-menu | - | - | Opens the playlistmanager menu |
| select-playlist | - | - | Opens the saved playlist list |
| playlist-next | - | - | Plays next item in playlist (position of current file saved) |
| playlist-prev | - | - | Plays previous item in playlist (position of current file saved) |
| playlist-next-random | - | - | Jumps to a random file in the playlist |
| close | - | - | Hides the playlist if it's being rendered |
examples:
RIGHT playlist-next ; script-message playlistmanager show playlist Shows the playlist after playlist-next. Note that the playlist-next is native mpv command, not the playlistmanager one.
KEY show-text "Shuffled playlist" ; script-message playlistmanager shuffle Text message on shuffle
Lua
100.0%