diff options
author | Kalle Wallin <kaw@linux.se> | 2004-06-05 12:56:56 +0000 |
---|---|---|
committer | Kalle Wallin <kaw@linux.se> | 2004-06-05 12:56:56 +0000 |
commit | 225e70a38b68cba219aeb7cb239f426ca739ed7d (patch) | |
tree | 884f76dcd05909c0ce7217d7b7d3155df413348a /src | |
parent | f55a67b3f882641abe5a9b14b045d7ce71964af7 (diff) | |
download | mpd-225e70a38b68cba219aeb7cb239f426ca739ed7d.tar.gz mpd-225e70a38b68cba219aeb7cb239f426ca739ed7d.tar.xz mpd-225e70a38b68cba219aeb7cb239f426ca739ed7d.zip |
Addded support for the mpd update command (CMD_DB_UPDATE)
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1343 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src')
-rw-r--r-- | src/command.c | 3 | ||||
-rw-r--r-- | src/command.h | 1 | ||||
-rw-r--r-- | src/screen.c | 14 | ||||
-rw-r--r-- | src/screen_help.c | 1 |
4 files changed, 18 insertions, 1 deletions
diff --git a/src/command.c b/src/command.c index 1e9edcd0d..bb7dd7bc2 100644 --- a/src/command.c +++ b/src/command.c @@ -99,6 +99,9 @@ static command_definition_t cmds[] = "Toggle random mode" }, { { 'x', 0, 0 }, CMD_CROSSFADE, "crossfade", "Toggle crossfade mode" }, + { { 21, 0, 0 }, CMD_DB_UPDATE, "db-update", + "Start a music database update" }, + { { 'S', 0, 0 }, CMD_SAVE_PLAYLIST, "save", "Save playlist" }, diff --git a/src/command.h b/src/command.h index 1ce67e894..f880998dc 100644 --- a/src/command.h +++ b/src/command.h @@ -20,6 +20,7 @@ typedef enum CMD_DELETE, CMD_REPEAT, CMD_CROSSFADE, + CMD_DB_UPDATE, CMD_VOLUME_UP, CMD_VOLUME_DOWN, CMD_SAVE_PLAYLIST, diff --git a/src/screen.c b/src/screen.c index d846f3df5..4059ac24f 100644 --- a/src/screen.c +++ b/src/screen.c @@ -708,7 +708,7 @@ screen_idle(mpd_client_t *c) void screen_cmd(mpd_client_t *c, command_t cmd) { - int n; + int n = 0; screen_mode_t new_mode = screen->mode; screen->input_timestamp = time(NULL); @@ -801,6 +801,18 @@ screen_cmd(mpd_client_t *c, command_t cmd) mpd_sendCrossfadeCommand(c->connection, n); mpd_finishCommand(c->connection); break; + case CMD_DB_UPDATE: + if( !c->status->updatingDb ) + { + mpd_sendUpdateCommand(c->connection); + n = mpd_getUpdateId(c->connection); + mpd_finishCommand(c->connection); + if( !mpc_error(c) ) + screen_status_printf("Database update started [%d]", n); + } + else + screen_status_printf("Database update running..."); + break; case CMD_VOLUME_UP: if( c->status->volume!=MPD_STATUS_NO_VOLUME && c->status->volume<100 ) { diff --git a/src/screen_help.c b/src/screen_help.c index c55c96380..960638d65 100644 --- a/src/screen_help.c +++ b/src/screen_help.c @@ -73,6 +73,7 @@ static help_text_row_t help_text[] = { 0, CMD_REPEAT, NULL }, { 0, CMD_RANDOM, NULL }, { 0, CMD_CROSSFADE, NULL }, + { 0, CMD_DB_UPDATE, NULL }, { 0, CMD_NONE, NULL }, { 0, CMD_QUIT, NULL }, |