summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7857a69)
raw | patch | inline | side by side (parent: 7857a69)
author | Kalle Wallin <kaw@linux.se> | |
Wed, 16 Jun 2004 11:13:27 +0000 (11:13 +0000) | ||
committer | Kalle Wallin <kaw@linux.se> | |
Wed, 16 Jun 2004 11:13:27 +0000 (11:13 +0000) |
diff --git a/src/libmpdclient.c b/src/libmpdclient.c
index 089e7201faa70d62c305a2f3e95e0511d7fe437b..01386ac5ad4d21456ac89b04087d7a7b9658eb7f 100644 (file)
--- a/src/libmpdclient.c
+++ b/src/libmpdclient.c
@@ -101,7 +101,7 @@ mpd_Connection * mpd_newConnection(const char * host, int port, float timeout) {
int err;
struct hostent * he;
struct sockaddr * dest;
-#ifdef MPD_HAVE_SOCKLEN_T
+#ifdef HAVE_SOCKLEN_T
socklen_t destlen;
#else
int destlen;
free(string);
}
-void mpd_sendUpdateCommand(mpd_Connection * connection) {
- mpd_executeCommand(connection,"update\n");
+void mpd_sendUpdateCommand(mpd_Connection * connection, char * path) {
+ char * sPath = mpd_sanitizeArg(path);
+ char * string = malloc(strlen("update")+strlen(sPath)+5);
+ sprintf(string,"update \"%s\"\n",sPath);
+ mpd_sendInfoCommand(connection,string);
+ free(string);
+ free(sPath);
}
int mpd_getUpdateId(mpd_Connection * connection) {
diff --git a/src/libmpdclient.h b/src/libmpdclient.h
index 0cce020283332d9907bd148126dcda3bd7d52dbb..2208faf225f7149b9ac96b4f1d86a6d648305465 100644 (file)
--- a/src/libmpdclient.h
+++ b/src/libmpdclient.h
void mpd_sendCrossfadeCommand(mpd_Connection * connection, int seconds);
-void mpd_sendUpdateCommand(mpd_Connection * connection);
+void mpd_sendUpdateCommand(mpd_Connection * connection, char * path);
/* returns the update job id, call this after a update command*/
int mpd_getUpdateId(mpd_Connection * connection);
diff --git a/src/mpdclient.c b/src/mpdclient.c
index c4a88ffe0b548e5385dac792559f908a950a64c0..c47dc3d19af9da34f5c3acf39a1edf5bb0a5dd05 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
}
gint
-mpdclient_cmd_db_update(mpdclient_t *c)
+mpdclient_cmd_db_update(mpdclient_t *c, gchar *path)
{
- mpd_sendUpdateCommand(c->connection);
+ mpd_sendUpdateCommand(c->connection, path ? path : "");
return mpdclient_finish_command(c);
}
diff --git a/src/mpdclient.h b/src/mpdclient.h
index 50b8e9a92fe014d997a196042b1f66110715dd54..7debd80508810ecc9db7a164336630caf9c31b9a 100644 (file)
--- a/src/mpdclient.h
+++ b/src/mpdclient.h
gint mpdclient_cmd_repeat(mpdclient_t *c, gint value);
gint mpdclient_cmd_random(mpdclient_t *c, gint value);
gint mpdclient_cmd_crossfade(mpdclient_t *c, gint value);
-gint mpdclient_cmd_db_update(mpdclient_t *c);
+gint mpdclient_cmd_db_update(mpdclient_t *c, gchar *path);
gint mpdclient_cmd_volume(mpdclient_t *c, gint value);
gint mpdclient_cmd_add(mpdclient_t *c, mpd_Song *song);
diff --git a/src/screen.c b/src/screen.c
index 8beab97f2117c199f63b33d3662e2a0000f6c42a..43383d93c4e8b1460a651e938feeb75823190068 100644 (file)
--- a/src/screen.c
+++ b/src/screen.c
case CMD_DB_UPDATE:
if( !c->status->updatingDb )
{
- if( mpdclient_cmd_db_update(c)==0 )
+ if( mpdclient_cmd_db_update(c,NULL)==0 )
screen_status_printf(_("Database update started!"));
}
else
diff --git a/src/screen_file.c b/src/screen_file.c
index f26333a2125ca979f7a8cc9ec8e8ff1be36edf7d..2caf2519723a6953185a60810a5d553af2d17d60 100644 (file)
--- a/src/screen_file.c
+++ b/src/screen_file.c
list_window_check_selected(lw, filelist->length);
screen_status_printf(_("Screen updated!"));
return 1;
+ case CMD_DB_UPDATE:
+ if( !c->status->updatingDb )
+ {
+ if( mpdclient_cmd_db_update(c,filelist->path)==0 )
+ {
+ screen_status_printf(_("Database update of %s started!"),
+ filelist->path);
+ /* set updatingDb to make shure the browse callback gets called
+ * even if the updated has finished before status is updated */
+ c->status->updatingDb = 1;
+ }
+ }
+ else
+ screen_status_printf(_("Database update running..."));
+ return 1;
case CMD_LIST_FIND:
case CMD_LIST_RFIND:
case CMD_LIST_FIND_NEXT:
diff --git a/src/screen_play.c b/src/screen_play.c
index 9d3cef8bef41cf778a0e192bb69aa15e5241b727..8c38c5b1a6a86b0bd2d0ef0b7c56acbcf6a577ea 100644 (file)
--- a/src/screen_play.c
+++ b/src/screen_play.c
g_free(filename);
return error;
}
+ screen_status_printf(_("Aborted!"));
}
g_free(filename);
return -1;