aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/conf.c21
-rw-r--r--src/options.c5
-rw-r--r--src/options.h1
-rw-r--r--src/screen.c22
-rw-r--r--src/screen_file.c6
5 files changed, 47 insertions, 8 deletions
diff --git a/src/conf.c b/src/conf.c
index 4b5e49230..f2c21ea05 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -64,6 +64,7 @@
#define CONF_HIDE_CURSOR "hide-cursor"
#define CONF_SEEK_TIME "seek-time"
#define CONF_SCREEN_LIST "screen-list"
+#define CONF_TIMEDISPLAY_TYPE "timedisplay-type"
typedef enum {
KEY_PARSER_UNKNOWN,
@@ -217,6 +218,17 @@ parse_key_definition(char *str)
return assign_keys(cmd, keys);
}
+static char *
+parse_timedisplay_type(char *str)
+{
+ if((!strcmp(str,"elapsed")) || (!strcmp(str,"remaining"))){
+ return str;
+ } else {
+ fprintf(stderr,_("Error: Bad time display type - %s\n"), str);
+ return DEFAULT_TIMEDISPLAY_TYPE;
+ }
+}
+
static int
parse_color(char *str)
{
@@ -243,7 +255,6 @@ parse_color(char *str)
return colors_assign(name, value);
}
-
static int
parse_color_definition(char *str)
{
@@ -460,6 +471,14 @@ read_rc_file(char *filename, options_t *options)
{
options->wide_cursor = str2bool(value);
}
+ /* timer display type */
+ else if( !strcasecmp(CONF_TIMEDISPLAY_TYPE, name) )
+ {
+ g_free(options->timedisplay_type);
+ options->timedisplay_type=g_strdup(parse_timedisplay_type(value));
+ D("deb");
+ D(options->timedisplay_type);
+ }
/* color definition */
else if( !strcasecmp(CONF_COLOR_DEFINITION, name) )
{
diff --git a/src/options.c b/src/options.c
index dd31203b6..0f281bc16 100644
--- a/src/options.c
+++ b/src/options.c
@@ -183,7 +183,7 @@ handle_option(int c, char *arg)
case 'C': /* --no-colors */
options.enable_colors = FALSE;
break;
- case 'm': /* --mouse */
+ case 'm': /* --mouse */
options.enable_mouse = TRUE;
break;
case 'M': /* --no-mouse */
@@ -368,7 +368,8 @@ options_init( void )
options.crossfade_time = DEFAULT_CROSSFADE_TIME;
options.seek_time = 1;
options.screen_list = g_strsplit_set(DEFAULT_SCREEN_LIST, " ", 0);
-
+ options.timedisplay_type = DEFAULT_TIMEDISPLAY_TYPE;
+
return &options;
}
diff --git a/src/options.h b/src/options.h
index 10aba1441..df6ac6146 100644
--- a/src/options.h
+++ b/src/options.h
@@ -13,6 +13,7 @@ typedef struct
char *status_format;
char *xterm_title_format;
char **screen_list;
+ char *timedisplay_type;
int port;
int crossfade_time;
int search_mode;
diff --git a/src/screen.c b/src/screen.c
index b94719001..72bdaff36 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -306,8 +306,9 @@ paint_status_window(mpdclient_t *c)
WINDOW *w = screen->status_window.w;
mpd_Status *status = c->status;
mpd_Song *song = c->song;
- int elapsedTime = c->status->elapsedTime;
+ int elapsedTime = 0;
char *str = NULL;
+ char *timestr = NULL;
int x = 0;
if( time(NULL) - screen->status_timestamp <= SCREEN_STATUS_MESSAGE_TIME )
@@ -341,11 +342,24 @@ paint_status_window(mpdclient_t *c)
if( IS_PLAYING(status->state) || IS_PAUSED(status->state) )
{
if( status->totalTime > 0 )
- {
- if( c->song && seek_id == c->song->id )
+ {
+
+ /*checks the conf to see whether to display elapsed or remaining time */
+ if(!strcmp(options.timedisplay_type,"elapsed"))
+ {
+ timestr= " [%i:%02i/%i:%02i]";
+ elapsedTime = c->status->elapsedTime;
+ }
+ else if(!strcmp(options.timedisplay_type,"remaining"))
+ {
+ timestr= " [-%i:%02i/%i:%02i]";
+ elapsedTime = (c->status->totalTime - c->status->elapsedTime);
+ }
+ if( c->song && seek_id == c->song->id )
elapsedTime = seek_target_time;
+ /*write out the time*/
g_snprintf(screen->buf, screen->buf_size,
- " [%i:%02i/%i:%02i]",
+ timestr,
elapsedTime/60, elapsedTime%60,
status->totalTime/60, status->totalTime%60 );
}
diff --git a/src/screen_file.c b/src/screen_file.c
index b2ca1b6cd..f868e2167 100644
--- a/src/screen_file.c
+++ b/src/screen_file.c
@@ -648,8 +648,12 @@ browse_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
{
if( mpdclient_cmd_db_update_utf8(c,filelist->path)==0 )
{
- screen_status_printf(_("Database update of %s started!"),
+ if(strcmp(filelist->path,"")) {
+ screen_status_printf(_("Database update of %s started!"),
filelist->path);
+ } else {
+ screen_status_printf(_("Database update started!"));
+ }
/* set updatingDb to make shure the browse callback gets called
* even if the updated has finished before status is updated */
c->status->updatingDb = 1;