some playlist controls

This commit is contained in:
2025-09-05 16:18:02 +02:00
parent e9fafe278f
commit 4cb9c8c46f
4 changed files with 104 additions and 15 deletions

View File

@@ -64,7 +64,18 @@
# - KEYS_N_SEEK_FORWARD: Seek forward
# - KEYS_N_SEEK_BACKWARD: Seek backward
#
# Playlist:
# Playlist (in the playlist, there is no `insert` mode):
# - KEYS_PLAYLIST_RELOAD: Manually reload playlist
# - KEYS_PLAYLIST_REMOVE: Remove item from playlist
# - KEYS_PLAYLIST_UP: Move item one position up
# - KEYS_PLAYLIST_DOWN: Move item one position down
# - KEYS_PLAYLIST_CLEAR: Clear playlist
# - KEYS_PLAYLIST_CLEAR_ABOVE: Remove all items above incl. the selected one
# - KEYS_PLAYLIST_CLEAR_BELOW: Remove all items below incl. the selected one
# - KEYS_PLAYLIST_GOTO_RELEASE: Jump to release or seleted enry
# - KEYS_PLAYLIST_STORE: Store current playlist as file
# - KEYS_PLAYLIST_LOAD: Load playlist from file
# - KEYS_PLAYLIST_QUIT: Quit playlist view
#
# Mode selection:
@@ -135,6 +146,19 @@ KEYS_N_SEEK_FORWARD="${KEYS_N_SEEK_FORWARD:-"N,f"}"
KEYS_N_SEEK_BACKWARD="${KEYS_N_SEEK_BACKWARD:-"P,b"}"
KEYS_N_PLAYBACK="$KEYS_N_PLAY,$KEYS_N_QUEUE,$KEYS_N_QUEUE_NEXT,$KEYS_N_TOGGLE_PLAYBACK,$KEYS_N_PLAY_NEXT,$KEYS_N_PLAY_PREV,$KEYS_N_SEEK_FORWARD,$KEYS_N_SEEK_BACKWARD"
# Playlist (in the playlist, there is no `insert` mode):
KEYS_PLAYLIST_RELOAD="${KEYS_PLAYLIST_RELOAD:-"r,ctrl-r"}"
KEYS_PLAYLIST_REMOVE="${KEYS_PLAYLIST_REMOVE:-"x,delete"}"
KEYS_PLAYLIST_UP="${KEYS_PLAYLIST_UP:-"u"}"
KEYS_PLAYLIST_DOWN="${KEYS_PLAYLIST_DOWN:-"d"}"
KEYS_PLAYLIST_CLEAR="${KEYS_PLAYLIST_CLEAR:-"C"}"
KEYS_PLAYLIST_CLEAR_ABOVE="${KEYS_PLAYLIST_CLEAR_ABOVE:-"U"}"
KEYS_PLAYLIST_CLEAR_BELOW="${KEYS_PLAYLIST_CLEAR_BELOW:-"D"}"
KEYS_PLAYLIST_GOTO_RELEASE="${KEYS_PLAYLIST_GOTO_RELEASE:-"ctrl-g"}"
KEYS_PLAYLIST_STORE="${KEYS_PLAYLIST_STORE:-"ctrl-s"}"
KEYS_PLAYLIST_LOAD="${KEYS_PLAYLIST_LOAD:-"ctrl-o"}"
KEYS_PLAYLIST_QUIT="${KEYS_PLAYLIST_QUIT:-"q,ctrl-c,esc"}"
## Not yet characterized
##########################

View File

@@ -23,8 +23,11 @@ mpv_playlist_position() {
}
mpv_playlist_move() {
debug "moving $1 -> $2"
__mpv_command_with_args2 "playlist-move" "$1" "$2" >>/tmp/foo 2>/dev/stdout
__mpv_command_with_args2 "playlist-move" "$1" "$2" >>/tmp/foo
}
mpv_playlist_clear() {
__mpv_command "playlist-clear"
}
mpv_quit() {
@@ -37,10 +40,17 @@ mpv_start() {
$MPV --no-config --no-terminal --input-ipc-server="$MPV_SOCKET" --idle --no-osc --no-input-default-bindings &
}
mpv_play_index() {
__mpv_command_with_arg "playlist-play-index" "$1"
}
mpv_rm_index() {
__mpv_command_with_arg "playlist-remove" "$1"
}
mpv_play_list() {
t=$(mktemp)
cat >"$t"
debug "Playing $(cat "$t")"
__mpv_command_with_arg "loadlist" "$t"
rm -f "$t"
}

6
src/sh/playlist.sh Normal file
View File

@@ -0,0 +1,6 @@
PLAYLIST_CMD_REMOVE="rm"
PLAYLIST_CMD_UP="up"
PLAYLIST_CMD_DOWN="down"
PLAYLIST_CMD_CLEAR="clear"
PLAYLIST_CMD_CLEAR_ABOVE="clear-above"
PLAYLIST_CMD_CLEAR_BELOW="clear-below"