From 0c946ea040dfea389c6793549aa07375accf0813 Mon Sep 17 00:00:00 2001 From: zutroy97 Date: Sat, 4 Jul 2026 07:55:01 -0500 Subject: [PATCH] Publish and accept track_id as decimal instead of hex Changes the mper-derived track_id published over MQTT from hex to decimal, and updates queue_next to embed the value in the DACP persistentid query without a 0x prefix, matching the new format. Queueing behavior (command=add&mode=3) is unchanged. Co-Authored-By: Claude Sonnet 5 --- mqtt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mqtt.c b/mqtt.c index 3c1d097a..9c6c429d 100644 --- a/mqtt.c +++ b/mqtt.c @@ -85,9 +85,9 @@ void on_message(__attribute__((unused)) struct mosquitto *mosq, debug(2, "[MQTT]: Disconnect Command: %s\n", commands[it]); stop_play(); // stop any current session and don't replace it } else if (strcmp(commands[it], "queue_next") == 0) { - // payload is "queue_next ", where is the hex track_id + // payload is "queue_next ", where is the decimal track_id // string as published by shairport-sync itself (see the "mper"/"track_id" handling - // above), e.g. "queue_next 1A2B3C4D5E6F7" + // above), e.g. "queue_next 123456789012345" char *track_id = payload + strlen(commands[it]); while (*track_id == ' ' || *track_id == '\t') track_id++; @@ -99,7 +99,7 @@ void on_message(__attribute__((unused)) struct mosquitto *mosq, } else { char dacp_command[256]; snprintf(dacp_command, sizeof(dacp_command), - "cue?command=add&query='dmap.persistentid:0x%s'&mode=3", track_id); + "cue?command=add&query='dmap.persistentid:%s'&mode=3", track_id); debug(2, "[MQTT]: Queue Next Command: %s\n", dacp_command); send_simple_dacp_command(dacp_command); } @@ -345,7 +345,7 @@ void mqtt_process_metadata(uint32_t type, uint32_t code, char *data, uint32_t le trackid = ntohl(*(uint32_t *)data); trackid = trackid << 32; trackid += ntohl(*(uint32_t *)(data + sizeof(uint32_t))); - r = snprintf(trackidstring, sizeof(trackidstring), "%" PRIX64 "", trackid); + r = snprintf(trackidstring, sizeof(trackidstring), "%" PRIu64 "", trackid); mqtt_publish("track_id", trackidstring, r); } } else if (type == 'ssnc') {