shuffle and unshuffle of playlist

This commit is contained in:
2025-09-08 13:06:50 +02:00
parent 88ec2f8bf5
commit f35461cc50
4 changed files with 21 additions and 3 deletions

View File

@@ -563,6 +563,8 @@ while true; do
--bind="$KEYS_PLAYLIST_CLEAR:execute-silent($0 --playlist $PLAYLIST_CMD_CLEAR)+$FZF_RELOAD_PLAYLIST" \ --bind="$KEYS_PLAYLIST_CLEAR:execute-silent($0 --playlist $PLAYLIST_CMD_CLEAR)+$FZF_RELOAD_PLAYLIST" \
--bind="$KEYS_PLAYLIST_CLEAR_ABOVE:execute-silent($0 --playlist $PLAYLIST_CMD_CLEAR_ABOVE)+$FZF_RELOAD_PLAYLIST" \ --bind="$KEYS_PLAYLIST_CLEAR_ABOVE:execute-silent($0 --playlist $PLAYLIST_CMD_CLEAR_ABOVE)+$FZF_RELOAD_PLAYLIST" \
--bind="$KEYS_PLAYLIST_CLEAR_BELOW:execute-silent($0 --playlist $PLAYLIST_CMD_CLEAR_BELOW)+$FZF_RELOAD_PLAYLIST" \ --bind="$KEYS_PLAYLIST_CLEAR_BELOW:execute-silent($0 --playlist $PLAYLIST_CMD_CLEAR_BELOW)+$FZF_RELOAD_PLAYLIST" \
--bind="$KEYS_PLAYLIST_SHUFFLE:execute-silent($0 --playlist $PLAYLIST_CMD_SHUFFLE)+$FZF_RELOAD_PLAYLIST" \
--bind="$KEYS_PLAYLIST_UNSHUFFLE:execute-silent($0 --playlist $PLAYLIST_CMD_UNSHUFFLE)+$FZF_RELOAD_PLAYLIST" \
--bind="$KEYS_PLAYLIST_GOTO_RELEASE:print($VIEW_RELEASE)+accept" \ --bind="$KEYS_PLAYLIST_GOTO_RELEASE:print($VIEW_RELEASE)+accept" \
--delimiter="\t" \ --delimiter="\t" \
--with-nth="{1}" \ --with-nth="{1}" \

View File

@@ -72,7 +72,9 @@
# - KEYS_PLAYLIST_CLEAR: Clear playlist # - KEYS_PLAYLIST_CLEAR: Clear playlist
# - KEYS_PLAYLIST_CLEAR_ABOVE: Remove all items above incl. the selected one # - 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_CLEAR_BELOW: Remove all items below incl. the selected one
# - KEYS_PLAYLIST_GOTO_RELEASE: Jump to release or seleted enry # - KEYS_PLAYLIST_SHUFFLE: Shuffle playlist
# - KEYS_PLAYLIST_UNSHUFFLE: Unshuffle previously shuffled playlist
# - KEYS_PLAYLIST_GOTO_RELEASE: Jump to release or selected entry
# - KEYS_PLAYLIST_STORE: Store current playlist as file # - KEYS_PLAYLIST_STORE: Store current playlist as file
# - KEYS_PLAYLIST_LOAD: Load playlist from file # - KEYS_PLAYLIST_LOAD: Load playlist from file
# - KEYS_PLAYLIST_QUIT: Quit playlist view # - KEYS_PLAYLIST_QUIT: Quit playlist view
@@ -169,10 +171,12 @@ KEYS_PLAYLIST_DOWN="${KEYS_PLAYLIST_DOWN:-"d"}"
KEYS_PLAYLIST_CLEAR="${KEYS_PLAYLIST_CLEAR:-"C"}" KEYS_PLAYLIST_CLEAR="${KEYS_PLAYLIST_CLEAR:-"C"}"
KEYS_PLAYLIST_CLEAR_ABOVE="${KEYS_PLAYLIST_CLEAR_ABOVE:-"U"}" KEYS_PLAYLIST_CLEAR_ABOVE="${KEYS_PLAYLIST_CLEAR_ABOVE:-"U"}"
KEYS_PLAYLIST_CLEAR_BELOW="${KEYS_PLAYLIST_CLEAR_BELOW:-"D"}" KEYS_PLAYLIST_CLEAR_BELOW="${KEYS_PLAYLIST_CLEAR_BELOW:-"D"}"
KEYS_PLAYLIST_SHUFFLE="${KEYS_PLAYLIST_SHUFFLE:-"s"}"
KEYS_PLAYLIST_UNSHUFFLE="${KEYS_PLAYLIST_UNSHUFFLE:-"S"}"
KEYS_PLAYLIST_GOTO_RELEASE="${KEYS_PLAYLIST_GOTO_RELEASE:-"ctrl-g"}" KEYS_PLAYLIST_GOTO_RELEASE="${KEYS_PLAYLIST_GOTO_RELEASE:-"ctrl-g"}"
KEYS_PLAYLIST_STORE="${KEYS_PLAYLIST_STORE:-"ctrl-s"}" KEYS_PLAYLIST_STORE="${KEYS_PLAYLIST_STORE:-"ctrl-s"}"
KEYS_PLAYLIST_LOAD="${KEYS_PLAYLIST_LOAD:-"ctrl-o"}" KEYS_PLAYLIST_LOAD="${KEYS_PLAYLIST_LOAD:-"ctrl-o"}"
export KEYS_PLAYLIST_RELOAD KEYS_PLAYLIST_REMOVE KEYS_PLAYLIST_UP \ export KEYS_PLAYLIST_RELOAD KEYS_PLAYLIST_REMOVE KEYS_PLAYLIST_UP \
KEYS_PLAYLIST_DOWN KEYS_PLAYLIST_CLEAR KEYS_PLAYLIST_CLEAR_ABOVE \ KEYS_PLAYLIST_DOWN KEYS_PLAYLIST_CLEAR KEYS_PLAYLIST_CLEAR_ABOVE \
KEYS_PLAYLIST_CLEAR_BELOW KEYS_PLAYLIST_GOTO_RELEASE KEYS_PLAYLIST_STORE \ KEYS_PLAYLIST_CLEAR_BELOW KEYS_PLAYLIST_SHUFFLE KEYS_PLAYLIST_UNSHUFFLE \
KEYS_PLAYLIST_LOAD KEYS_PLAYLIST_GOTO_RELEASE KEYS_PLAYLIST_STORE KEYS_PLAYLIST_LOAD

View File

@@ -30,6 +30,14 @@ mpv_playlist_clear() {
__mpv_command "playlist-clear" __mpv_command "playlist-clear"
} }
mpv_playlist_shuffle() {
__mpv_command "playlist-shuffle"
}
mpv_playlist_unshuffle() {
__mpv_command "playlist-unshuffle"
}
mpv_quit() { mpv_quit() {
__mpv_command "quit" __mpv_command "quit"
} }

View File

@@ -4,6 +4,8 @@ PLAYLIST_CMD_DOWN="down"
PLAYLIST_CMD_CLEAR="clear" PLAYLIST_CMD_CLEAR="clear"
PLAYLIST_CMD_CLEAR_ABOVE="clear-above" PLAYLIST_CMD_CLEAR_ABOVE="clear-above"
PLAYLIST_CMD_CLEAR_BELOW="clear-below" PLAYLIST_CMD_CLEAR_BELOW="clear-below"
PLAYLIST_CMD_SHUFFLE="shuffle"
PLAYLIST_CMD_UNSHUFFLE="unshuffle"
# Run playback commands # Run playback commands
# #
@@ -28,5 +30,7 @@ playlist() {
mpv_rm_index $((FZF_POS - 1)) mpv_rm_index $((FZF_POS - 1))
done done
;; ;;
"$PLAYLIST_CMD_SHUFFLE") mpv_playlist_shuffle ;;
"$PLAYLIST_CMD_UNSHUFFLE") mpv_playlist_unshuffle ;;
esac esac
} }