Manage next/previous track

This commit is contained in:
gardouille 2023-02-26 20:06:12 +01:00
parent 330399edfd
commit 4dcd3f6d3a
Signed by: gardouille
GPG Key ID: E759BAA22501AF32

View File

@ -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' "---"