Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


MPD command missing ?
#8
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"  Smile 
...but there is a delay between the 2nd data  Sad

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
Reply


Messages In This Thread
MPD command missing ? - by electroremy - 03-06-2021, 07:31 PM
RE: MPD command missing ? - by TheOldPresbyope - 03-06-2021, 07:53 PM
RE: MPD command missing ? - by electroremy - 03-07-2021, 02:13 PM
RE: MPD command missing ? - by TheOldPresbyope - 03-07-2021, 04:51 PM
RE: MPD command missing ? - by vinnn - 03-07-2021, 05:02 PM
RE: MPD command missing ? - by electroremy - 03-11-2021, 05:59 PM
RE: MPD command missing ? - by TheOldPresbyope - 03-11-2021, 07:20 PM
RE: MPD command missing ? - by electroremy - 03-14-2021, 07:32 PM

Forum Jump: