summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ad64a9b)
raw | patch | inline | side by side (parent: ad64a9b)
author | Max Kellermann <max@duempel.org> | |
Sat, 14 Nov 2009 01:47:28 +0000 (02:47 +0100) | ||
committer | Max Kellermann <max@duempel.org> | |
Sat, 14 Nov 2009 01:47:28 +0000 (02:47 +0100) |
This is useful for streams: how long have we been playing this stream?
NEWS | patch | blob | history | |
src/status_bar.c | patch | blob | history |
index c48e9dfe360fedebfdc2c4322139c05e7960aace..f5ff89273899f03de142d8db311525793e83ba66 100644 (file)
--- a/NEWS
+++ b/NEWS
* screen_browser: display song duration
* screen_queue: move ranges with one single "move" command
* status_bar: fix display_remaining_time while seeking
+* status_bar: display elapsed time event when total time is unknown
ncmpc 0.15 - 2009-09-24
diff --git a/src/status_bar.c b/src/status_bar.c
index 2bb3057479d312b66532937fafc5f2259851e166..8f80fca4380f256df3c8371226a173c6c2915d9d 100644 (file)
--- a/src/status_bar.c
+++ b/src/status_bar.c
{
WINDOW *w = p->window.w;
enum mpd_state state;
- int elapsedTime = 0;
const char *str = NULL;
int x = 0;
char buffer[p->window.cols * 4 + 1];
/* create time string */
if (state == MPD_STATE_PLAY || state == MPD_STATE_PAUSE) {
+ int elapsedTime = seek_id >= 0 &&
+ seek_id == mpd_status_get_song_id(status)
+ ? (unsigned)seek_target_time
+ : mpd_status_get_elapsed_time(status);
int total_time = mpd_status_get_total_time(status);
- if (total_time > 0) {
+ if (elapsedTime > 0 || total_time > 0) {
#ifdef NCMPC_MINI
static const char bitrate[1];
#else
char elapsed_string[32], duration_string[32];
/*checks the conf to see whether to display elapsed or remaining time */
- if (seek_id >= 0 &&
- seek_id == mpd_status_get_song_id(status))
- elapsedTime = seek_target_time;
- else
- elapsedTime = mpd_status_get_elapsed_time(status);
-
if (options.display_remaining_time)
elapsedTime = elapsedTime < total_time
? total_time - elapsedTime