diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libmpdclient.c | 11 | ||||
-rw-r--r-- | src/libmpdclient.h | 2 | ||||
-rw-r--r-- | src/mpdclient.c | 4 | ||||
-rw-r--r-- | src/mpdclient.h | 2 | ||||
-rw-r--r-- | src/screen.c | 2 | ||||
-rw-r--r-- | src/screen_file.c | 15 | ||||
-rw-r--r-- | src/screen_play.c | 1 |
7 files changed, 29 insertions, 8 deletions
diff --git a/src/libmpdclient.c b/src/libmpdclient.c index 089e7201f..01386ac5a 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 0cce02028..2208faf22 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 c4a88ffe0..c47dc3d19 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 50b8e9a92..7debd8050 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 8beab97f2..43383d93c 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 f26333a21..2caf25197 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 9d3cef8be..8c38c5b1a 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; |