Mpv lua script to create and manage playlists
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, parsing filenames according to patterns and creating/saving/shuffling/sorting playlists.
Default visual cues:
○ 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!
You can modify behaviour of the script in the settings variable in the lua file or a
playlistmanager.conflua-setting file in
script-optsdirectory. 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. 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 want playlistmanager to fetch and display titles of all playlist urls(mpv defaults to current file only) you will need to use
resolve_titles = yes(default is no) setting. Title resolving requires
youtube-dlto be in PATH to work.
KEY script-message 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.
--idle=yes or --idle=once.
If you want to use the above controls from a "gui" rather than keybinds, then you can check out mpv-menu and use the
menu.jsonfound in this repository.
Dynamic keybinds will only work when playlist is visible. There is a setting toggle to change them to static ones. You can override keybindings by their names above by adding the following in your input.conf
SPACE script-binding showplaylist. However, Dynamic keybindings should be rebound in the settings to avoid overriding other conflicting keybinds and to support multiple keys per bind.
There is also a few script messages you can send to control the script:
KEY script-message playlistmanager command value value2
List of commands, values and their effects:
|show||playlist||- / duration / toggle||show for default duration, show for given seconds, toggle playlist visibility|
|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||-||-||Saves the playlist|
RIGHT playlist-next ; script-message playlistmanager show playlistShows the playlist after playlist-next
KEY show-text "Shuffled playlist" ; script-message playlistmanager shuffleText message on shuffle