From: Jordan Zucker Date: Mon, 31 Mar 2025 00:23:40 +0000 (-0700) Subject: Trying again X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=refs%2Fpull%2F2001%2Fhead;p=thirdparty%2Fshairport-sync.git Trying again --- diff --git a/.gitignore b/.gitignore index cca6a005..e330542f 100644 --- a/.gitignore +++ b/.gitignore @@ -54,3 +54,6 @@ classic # vscode .vscode + +# IntelliJ/JetBrains +.idea/ diff --git a/mqtt.c b/mqtt.c index 07a2abb6..fcfb8666 100644 --- a/mqtt.c +++ b/mqtt.c @@ -56,7 +56,8 @@ void on_message(__attribute__((unused)) struct mosquitto *mosq, // All recognized commands char *commands[] = {"command", "beginff", "beginrew", "mutetoggle", "nextitem", "previtem", "pause", "playpause", "play", "stop", - "playresume", "shuffle_songs", "volumedown", "volumeup", NULL}; + "playresume", "shuffle_songs", "volumedown", "volumeup", "disconnect", + NULL}; int it = 0; @@ -64,8 +65,14 @@ void on_message(__attribute__((unused)) struct mosquitto *mosq, while (commands[it] != NULL) { if ((size_t)msg->payloadlen >= strlen(commands[it]) && strncmp(msg->payload, commands[it], strlen(commands[it])) == 0) { - debug(2, "[MQTT]: DACP Command: %s\n", commands[it]); - send_simple_dacp_command(commands[it]); + debug(2, "[MQTT]: Received Recognized Command: %s\n", commands[it]); + if (strcmp(commands[it], "disconnect") == 0) { + debug(2, "[MQTT]: Disconnect Command: %s\n", commands[it]); + get_play_lock(NULL, 1); // stop any current session and don't replace it + } else { + debug(2, "[MQTT]: DACP Command: %s\n", commands[it]); + send_simple_dacp_command(commands[it]); + } break; } it++;