03-14-2021, 07:32 PM
Hi
I'm confused about the "curentsong" and "playlistid x" commands
Indeed, Moode Audio MPC telnet first send a "OK MPD 0.22.0" response.
I have to wait for the next data packet that contains the song info.
Moode Audio MPC telnet interface is very fast and responsive with commands that sends no data or just "OK"
...but there is a delay between the 2nd data
Thus, to get 11 songs names, it takes 3 to 5 seconds...
There is a way to avoid this and force MPD to send all data in the first packet (in config files or elsewhere) ?
This is the code to received data after sending a command :
Regards
I'm confused about the "curentsong" and "playlistid x" commands
Indeed, Moode Audio MPC telnet first send a "OK MPD 0.22.0" response.
I have to wait for the next data packet that contains the song info.
Moode Audio MPC telnet interface is very fast and responsive with commands that sends no data or just "OK"

...but there is a delay between the 2nd data

Thus, to get 11 songs names, it takes 3 to 5 seconds...
There is a way to avoid this and force MPD to send all data in the first packet (in config files or elsewhere) ?
This is the code to received data after sending a command :
Code:
int len;
int i;
byte k;
char c;
Buffer_TMP_Stop = 0;
unsigned long t = millis();
for (k=0;k<2;k++) {
len=0;
t = millis();
while(len==0){
len = client2.available();
if (millis()-t > 1000) break;
}
if (len>0) {
if (k==0) {
for (i=0;i<len;i++) {
client2.read(); // We don't need the first packet data
}
} else {
if (len>Buffer_TMP_Len) len = Buffer_TMP_Len;
for (i=0;i<len;i++) {
Buffer_TMP[i]=client2.read(); // The data we expect is sending in a second time
}
Buffer_TMP_Stop = len;
}
} else {
break;
}
}
client2.stop();
Regards