v0.9.511
This commit is contained in:
@@ -39,7 +39,11 @@ void mqttPublishStatus() {
|
||||
memset(topic, 0, 140);
|
||||
memset(status, 0, BUFLEN*3);
|
||||
sprintf(topic, "%s%s", MQTT_ROOT_TOPIC, "status");
|
||||
sprintf(status, "{\"status\": %d, \"station\": %d, \"name\": \"%s\", \"title\": \"%s\", \"on\": %d}", player.status()==PLAYING?1:0, config.lastStation(), config.station.name, config.station.title, config.store.dspon);
|
||||
char name[BUFLEN*2];
|
||||
char title[BUFLEN*2];
|
||||
config.escapeQuotes(config.station.name, name, sizeof(name));
|
||||
config.escapeQuotes(config.station.title, title, sizeof(name));
|
||||
sprintf(status, "{\"status\": %d, \"station\": %d, \"name\": \"%s\", \"title\": \"%s\", \"on\": %d}", player.status()==PLAYING?1:0, config.lastStation(), name, title, config.store.dspon);
|
||||
mqttClient.publish(topic, 0, true, status);
|
||||
}
|
||||
}
|
||||
@@ -131,7 +135,8 @@ void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties
|
||||
int sb;
|
||||
if (sscanf(buf, "play %d", &sb) == 1 ) {
|
||||
if (sb < 1) sb = 1;
|
||||
if (sb >= config.store.countStation) sb = config.store.countStation;
|
||||
uint16_t cs = config.playlistLength();
|
||||
if (sb >= cs) sb = cs;
|
||||
player.sendCommand({PR_PLAY, (uint16_t)sb});
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user