add support for consume mode

info about this feature can be found in mpd docs.
This commit is contained in:
Andrzej Rybczak
2009-04-01 14:51:09 +02:00
parent b33c006fe4
commit 00dcadcc8a
10 changed files with 54 additions and 2 deletions

View File

@@ -740,6 +740,7 @@ mpd_Status * mpd_getStatus(mpd_Connection * connection) {
status->repeat = 0;
status->random = 0;
status->single = 0;
status->consume = 0;
status->playlist = -1;
status->playlistLength = -1;
status->state = -1;
@@ -773,6 +774,9 @@ mpd_Status * mpd_getStatus(mpd_Connection * connection) {
else if(strcmp(re->name,"single")==0) {
status->single = atoi(re->value);
}
else if(strcmp(re->name,"consume")==0) {
status->consume = atoi(re->value);
}
else if(strcmp(re->name,"playlist")==0) {
status->playlist = strtol(re->value,NULL,10);
}
@@ -1704,6 +1708,14 @@ void mpd_sendSingleCommand(mpd_Connection * connection, int singleMode) {
free(string);
}
void mpd_sendConsumeCommand(mpd_Connection * connection, int consumeMode) {
int len = strlen("consume")+2+INTLEN+3;
char *string = malloc(len);
snprintf(string, len, "consume \"%i\"\n", consumeMode);
mpd_executeCommand(connection,string);
free(string);
}
void mpd_sendSetvolCommand(mpd_Connection * connection, int volumeChange) {
int len = strlen("setvol")+2+INTLEN+3;
char *string = malloc(len);