aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmpdclient.c
diff options
context:
space:
mode:
authorKalle Wallin <kaw@linux.se>2004-06-05 11:21:43 +0000
committerKalle Wallin <kaw@linux.se>2004-06-05 11:21:43 +0000
commitf55a67b3f882641abe5a9b14b045d7ce71964af7 (patch)
tree181c15b1c59df30b2e28058f2648e5e701e57c4f /src/libmpdclient.c
parent677eb1ad30321d83f6196672ea1798c0e1712870 (diff)
downloadmpd-f55a67b3f882641abe5a9b14b045d7ce71964af7.tar.gz
mpd-f55a67b3f882641abe5a9b14b045d7ce71964af7.tar.xz
mpd-f55a67b3f882641abe5a9b14b045d7ce71964af7.zip
Changed directory layout (for future use of gettext)
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1342 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/libmpdclient.c (renamed from libmpdclient.c)41
1 files changed, 36 insertions, 5 deletions
diff --git a/libmpdclient.c b/src/libmpdclient.c
index aa7b75725..2e8b579da 100644
--- a/libmpdclient.c
+++ b/src/libmpdclient.c
@@ -38,6 +38,7 @@ typedef SOCKLEN_T socklen_t;
#endif
#endif
+
#ifndef MPD_NO_IPV6
#ifdef AF_INET6
#define MPD_HAVE_IPV6
@@ -515,6 +516,7 @@ mpd_Status * mpd_getStatus(mpd_Connection * connection) {
status->channels = 0;
status->crossfade = -1;
status->error = NULL;
+ status->updatingDb = 0;
mpd_getNextReturnElement(connection);
if(connection->error) {
@@ -561,9 +563,14 @@ mpd_Status * mpd_getStatus(mpd_Connection * connection) {
else if(strcmp(re->name,"time")==0) {
char * tok;
char * copy;
+ char * temp;
copy = strdup(re->value);
- status->elapsedTime = atoi(strtok_r(copy,":",&tok));
- status->totalTime = atoi(strtok_r(NULL,"",&tok));
+ temp = strtok_r(copy,":",&tok);
+ if(temp) {
+ status->elapsedTime = atoi(temp);
+ temp = strtok_r(NULL,"",&tok);
+ if(temp) status->totalTime = atoi(temp);
+ }
free(copy);
}
else if(strcmp(re->name,"error")==0) {
@@ -572,13 +579,24 @@ mpd_Status * mpd_getStatus(mpd_Connection * connection) {
else if(strcmp(re->name,"xfade")==0) {
status->crossfade = atoi(re->value);
}
+ else if(strcmp(re->name,"updating_db")==0) {
+ status->updatingDb = atoi(re->value);
+ }
else if(strcmp(re->name,"audio")==0) {
char * tok;
char * copy;
+ char * temp;
copy = strdup(re->value);
- status->sampleRate = atoi(strtok_r(copy,":",&tok));
- status->bits = atoi(strtok_r(NULL,":",&tok));
- status->channels = atoi(strtok_r(NULL,"",&tok));
+ temp = strtok_r(copy,":",&tok);
+ if(temp) {
+ status->sampleRate = atoi(temp);
+ temp = strtok_r(NULL,":",&tok);
+ if(temp) {
+ status->bits = atoi(temp);
+ temp = strtok_r(NULL,"",&tok);
+ if(temp) status->channels = atoi(temp);
+ }
+ }
free(copy);
}
@@ -1111,6 +1129,19 @@ void mpd_sendUpdateCommand(mpd_Connection * connection) {
mpd_executeCommand(connection,"update\n");
}
+int mpd_getUpdateId(mpd_Connection * connection) {
+ char * jobid;
+ int ret = 0;
+
+ jobid = mpd_getNextReturnElementNamed(connection,"updating_db");
+ if(jobid) {
+ ret = atoi(jobid);
+ free(jobid);
+ }
+
+ return ret;
+}
+
void mpd_sendPrevCommand(mpd_Connection * connection) {
mpd_executeCommand(connection,"previous\n");
}