hvmpd.sh: replace toggle with play/stop
authorHugo Villeneuve <hugo@hugovil.com>
Thu, 31 Oct 2024 20:52:57 +0000 (16:52 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Tue, 12 Nov 2024 03:40:44 +0000 (22:40 -0500)
"mpc toggle" will pause the stream if playing, but resuming doesn't always work
if the server closes the connection.

Replace by play/stop commands.

recipes-multimedia/hvmpd-manager/files/hvmpd.sh

index 32bf889..a83bbcd 100644 (file)
@@ -40,7 +40,12 @@ keys_manager() {
 
         if [ "${play_prev}" != "${play}" -a ${play} -eq 0 ]; then
             log_info "mpc toggle"
-            mpc toggle 1> /dev/null
+
+            if is_mpc_playing ; then
+                mpc stop 1> /dev/null
+            else
+                mpc play 1> /dev/null
+            fi
         fi
 
         play_prev=${play}