From 4dcd3f6d3a5e328057ed3d10f3220ff2432e307a Mon Sep 17 00:00:00 2001 From: Gardouille Date: Sun, 26 Feb 2023 20:06:12 +0100 Subject: [PATCH] Manage next/previous track --- mpv.controller.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mpv.controller.sh b/mpv.controller.sh index 908c0cd..3d35424 100755 --- a/mpv.controller.sh +++ b/mpv.controller.sh @@ -48,12 +48,17 @@ EXAMPLES : - Send default command (${USER_MULTIMEDIA_COMMAND_DEFAULT}) to MPV ${PROGNAME} + - Try to play next track (if playing a playlist) + ${PROGNAME} --command next + OPTIONS : -c,--command Send a command to running MPV. Available commands : * toggle play, pause * play * pause + * next + * prev, previous -d,--debug Enable debug messages. @@ -117,6 +122,16 @@ Use ${RED}MPV socket${COLOR_DEBUG} to send ${USER_MULTIMEDIA_COMMAND} command." Use ${RED}MPV socket${COLOR_DEBUG} to send ${USER_MULTIMEDIA_COMMAND} command." MPV_COMMAND=$(echo '{ "command": ["set_property", "pause", true] }' | socat - "${MPV_SOCKET_PATH}") ;; + next ) ## Try to play next track (if available) + debug_message "define_vars − \ +Use ${RED}MPV socket${COLOR_DEBUG} to send ${USER_MULTIMEDIA_COMMAND} command." + MPV_COMMAND=$(echo 'playlist-next' | socat - "${MPV_SOCKET_PATH}") + ;; + prev|previous ) ## Try to play previous track (if available) + debug_message "define_vars − \ +Use ${RED}MPV socket${COLOR_DEBUG} to send ${USER_MULTIMEDIA_COMMAND} command." + MPV_COMMAND=$(echo 'playlist-prev' | socat - "${MPV_SOCKET_PATH}") + ;; * ) ## unknow option printf '%b\n' "${RED}Invalid MPV command: ${USER_MULTIMEDIA_COMMAND}${RESET}" printf '%b\n' "---"