Fix byte order of track_id published over MQTT

The 'mper' handler cast the raw big-endian persistent-id bytes directly
to a host-native uint64_t, which reverses the value on little-endian
hosts (e.g. Raspberry Pi). metadata_hub.c already reconstructs the same
field correctly by applying ntohl() to each 32-bit half; mqtt.c now does
the same, so the published track_id matches the real dmap.persistentid
and can be used directly with the queue_next command.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Scott Simon
2026-07-03 15:37:27 -05:00
co-authored by Claude Sonnet 5
parent b6a5a07df5
commit 1fbb6312f6
+3 -1
View File
@@ -347,7 +347,9 @@ void mqtt_process_metadata(uint32_t type, uint32_t code, char *data, uint32_t le
mqtt_publish("title", data, length);
break;
case 'mper':
trackid = *(uint64_t *)(data);
trackid = ntohl(*(uint32_t *)data);
trackid = trackid << 32;
trackid += ntohl(*(uint32_t *)(data + sizeof(uint32_t)));
r = snprintf(trackidstring, sizeof(trackidstring), "%" PRIX64 "", trackid);
mqtt_publish("track_id", trackidstring, r);
}