Hi!

This patch for ncmpc makes it possible to adjust the seek time, in steps
of 5 seconds, in runtime with 'F' and 'B'. The current seek time is
displayed top right, next to the volume.

---
 src/command.c     |    4 ++++
 src/command.h     |    2 ++
 src/screen.c      |   11 ++++++++++-
 src/screen_help.c |    2 ++
 4 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/src/command.c b/src/command.c
index 3fe825c..e311254 100644
--- a/src/command.c
+++ b/src/command.c
@@ -130,6 +130,10 @@ static command_definition_t cmds[] = {
          N_("Seek forward") },
        { { 'b', 0, 0 }, 0, CMD_SEEK_BACKWARD, "seek-backward",
          N_("Seek backward") },
+       { { 'F', 0, 0 }, 0, CMD_SEEK_TIME_INC, "seek-time-increase",
+         N_("Increase seek time") },
+       { { 'B', 0, 0 }, 0, CMD_SEEK_TIME_DEC, "seek-time-decrease",
+         N_("Decrease seek time") },
        { { '+', RGHT, 0 }, 0, CMD_VOLUME_UP, "volume-up",
          N_("Increase volume") },
        { { '-', LEFT, 0 }, 0, CMD_VOLUME_DOWN, "volume-down",
diff --git a/src/command.h b/src/command.h
index b3222c5..94ba37e 100644
--- a/src/command.h
+++ b/src/command.h
@@ -43,6 +43,8 @@ typedef enum {
        CMD_TRACK_PREVIOUS,
        CMD_SEEK_FORWARD,
        CMD_SEEK_BACKWARD,
+       CMD_SEEK_TIME_INC,
+       CMD_SEEK_TIME_DEC,
        CMD_SHUFFLE,
        CMD_RANDOM,
        CMD_CLEAR,
diff --git a/src/screen.c b/src/screen.c
index e540fec..358a705 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -174,6 +174,7 @@ paint_top_window2(const char *header, mpdclient_t *c)
        char flags[5];
        WINDOW *w = screen.top_window.w;
        char buf[32];
+       char seek[32];
 
        if (header[0]) {
                colors_use(w, COLOR_TITLE_BOLD);
@@ -206,8 +207,11 @@ paint_top_window2(const char *header, mpdclient_t *c)
        else
                g_snprintf(buf, 32, _("Volume %d%%"), volume);
 
+       g_snprintf(seek, 32, _(" Seek %ds "), options.seek_time);
+
        colors_use(w, COLOR_TITLE);
        mvwaddstr(w, 0, screen.top_window.cols - utf8_width(buf), buf);
+       mvwaddstr(w, 0, screen.top_window.cols - utf8_width(buf) - 
utf8_width(seek), seek);
 
        flags[0] = 0;
        if (c->status != NULL) {
@@ -796,7 +800,12 @@ screen_client_cmd(mpdclient_t *c, command_t cmd)
                        /* seek_target_time=0; */
                }
                break;
-               /* fall through... */
+        case CMD_SEEK_TIME_INC:
+                options.seek_time += (options.seek_time == 1) ? 4 : 5;
+               break;
+        case CMD_SEEK_TIME_DEC:
+               options.seek_time = (options.seek_time < 6) ? 1 : 
options.seek_time - 5;
+               break;
        case CMD_TRACK_NEXT:
                if (!IS_STOPPED(c->status->state))
                        mpdclient_cmd_next(c);
diff --git a/src/screen_help.c b/src/screen_help.c
index 81b479f..567e396 100644
--- a/src/screen_help.c
+++ b/src/screen_help.c
@@ -86,6 +86,8 @@ static help_text_row_t help_text[] = {
        { 0, CMD_TRACK_PREVIOUS, NULL },
        { 0, CMD_SEEK_FORWARD, NULL },
        { 0, CMD_SEEK_BACKWARD, NULL },
+       { 0, CMD_SEEK_TIME_INC, NULL },
+       { 0, CMD_SEEK_TIME_DEC, NULL },
        { 0, CMD_VOLUME_DOWN, NULL },
        { 0, CMD_VOLUME_UP, NULL },
        { 0, CMD_NONE, NULL },
-- 
1.6.0.4


Fredrik Lanker

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to