From: Kalle Wallin Date: Wed, 16 Jun 2004 11:13:27 +0000 (+0000) Subject: libmpdclient updated (r1507) - added path to mpdclient_cmd_db_update() X-Git-Tag: v0.12_alpha1~521 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4fce016e7a873d941899c509bd0a5be3f46ea1b8;p=ncmpc.git libmpdclient updated (r1507) - added path to mpdclient_cmd_db_update() git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1508 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- diff --git a/src/libmpdclient.c b/src/libmpdclient.c index 089e720..01386ac 100644 --- 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; @@ -1265,8 +1265,13 @@ void mpd_sendSeekIdCommand(mpd_Connection * connection, int id, int time) { 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 0cce020..2208faf 100644 --- a/src/libmpdclient.h +++ b/src/libmpdclient.h @@ -435,7 +435,7 @@ void mpd_sendVolumeCommand(mpd_Connection * connection, int volumeChange); 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 c4a88ff..c47dc3d 100644 --- a/src/mpdclient.c +++ b/src/mpdclient.c @@ -316,9 +316,9 @@ mpdclient_cmd_crossfade(mpdclient_t *c, gint value) } 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 50b8e9a..7debd80 100644 --- a/src/mpdclient.h +++ b/src/mpdclient.h @@ -81,7 +81,7 @@ gint mpdclient_cmd_clear(mpdclient_t *c); 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 8beab97..43383d9 100644 --- a/src/screen.c +++ b/src/screen.c @@ -782,7 +782,7 @@ screen_cmd(mpdclient_t *c, command_t cmd) 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 f26333a..2caf251 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -563,6 +563,21 @@ browse_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) 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 9d3cef8..8c38c5b 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -154,6 +154,7 @@ handle_save_playlist(screen_t *screen, mpdclient_t *c, char *name) g_free(filename); return error; } + screen_status_printf(_("Aborted!")); } g_free(filename); return -1;