summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ad98c33)
raw | patch | inline | side by side (parent: ad98c33)
author | J. Alexander Treuman <jat@spatialrift.net> | |
Sun, 21 Sep 2008 17:37:43 +0000 (19:37 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Sun, 21 Sep 2008 19:51:00 +0000 (21:51 +0200) |
If visible-bitrate is enabled, then the current bitrate will be drawn next
to the song time in the status bar. By default it will not be displayed.
to the song time in the status bar. By default it will not be displayed.
src/conf.c | patch | blob | history | |
src/options.h | patch | blob | history | |
src/screen.c | patch | blob | history |
diff --git a/src/conf.c b/src/conf.c
index 970bc0889d1650ed8fbcab6646091cfa0240d30b..ac48e9cdb5cde94f644fdbc19bb22c9585c76dcf 100644 (file)
--- a/src/conf.c
+++ b/src/conf.c
#define CONF_SHOW_SPLASH "show-splash"
#define CONF_SCROLL "scroll"
#define CONF_SCROLL_SEP "scroll-sep"
+#define CONF_VISIBLE_BITRATE "visible-bitrate"
typedef enum {
KEY_PARSER_UNKNOWN,
{
options->wide_cursor = str2bool(value);
}
+ /* visible bitrate */
+ else if (!strcasecmp(CONF_VISIBLE_BITRATE, name)) {
+ options->visible_bitrate = str2bool(value);
+ }
/* timer display type */
else if( !strcasecmp(CONF_TIMEDISPLAY_TYPE, name) )
{
diff --git a/src/options.h b/src/options.h
index d0a068f846e98d430f60d5b850933f2c435d5742..58eaff13073cf52455171c86668890ae3d32e0b6 100644 (file)
--- a/src/options.h
+++ b/src/options.h
gboolean enable_xterm_title;
gboolean enable_mouse;
gboolean scroll;
+ gboolean visible_bitrate;
} options_t;
#ifndef NO_GLOBAL_OPTIONS
diff --git a/src/screen.c b/src/screen.c
index 2a5d6416f4d04adca020188dffb2488afc377545..c526e66cc57d93cbd39c15f0a3db8d9ec19ce602 100644 (file)
--- a/src/screen.c
+++ b/src/screen.c
mpd_Status *status = c->status;
mpd_Song *song = c->song;
int elapsedTime = 0;
+ char bitrate[16];
const char *str = NULL;
int x = 0;
if( c->song && seek_id == c->song->id )
elapsedTime = seek_target_time;
+
+ /* display bitrate if visible-bitrate is true */
+ if (options.visible_bitrate) {
+ g_snprintf(bitrate, 16,
+ " [%d kbps]", status->bitRate);
+ } else {
+ bitrate[0] = '\0';
+ }
+
/*write out the time, using hours if time over 60 minutes*/
if (c->status->totalTime > 3600) {
g_snprintf(screen.buf, screen.buf_size,
- " [%i:%02i:%02i/%i:%02i:%02i]",
- elapsedTime/3600, (elapsedTime%3600)/60, elapsedTime%60,
+ "%s [%i:%02i:%02i/%i:%02i:%02i]",
+ bitrate, elapsedTime/3600, (elapsedTime%3600)/60, elapsedTime%60,
status->totalTime/3600, (status->totalTime%3600)/60, status->totalTime%60);
} else {
g_snprintf(screen.buf, screen.buf_size,
- " [%i:%02i/%i:%02i]",
- elapsedTime/60, elapsedTime%60,
+ "%s [%i:%02i/%i:%02i]",
+ bitrate, elapsedTime/60, elapsedTime%60,
status->totalTime/60, status->totalTime%60 );
}
} else {