summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8cbeacb)
raw | patch | inline | side by side (parent: 8cbeacb)
author | Max Kellermann <max@duempel.org> | |
Sun, 25 Jul 2010 12:48:31 +0000 (14:48 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Sun, 25 Jul 2010 12:48:31 +0000 (14:48 +0200) |
NEWS | patch | blob | history | |
src/screen_song.c | patch | blob | history |
index b3269edda2098287d162138cda83237d9af40056..775a6453afae570294aa174ed76c9bfeeb5c2c10 100644 (file)
--- a/NEWS
+++ b/NEWS
ncmpc 0.18 - not yet released
+* screen_song: show song range
* po: added Italian translation
diff --git a/src/screen_song.c b/src/screen_song.c
index 2c451c1599c38d2043fafa9ee97d3289c8daf24c..e738fc2914f9eb4f57faec1220ea54e38ff9d82b 100644 (file)
--- a/src/screen_song.c
+++ b/src/screen_song.c
char length[16];
format_duration_short(length, sizeof(length),
mpd_song_get_duration(song));
- screen_song_append(_(tag_labels[LABEL_LENGTH]), length,
+
+ const char *value = length;
+
+#if LIBMPDCLIENT_CHECK_VERSION(2,3,0)
+ char buffer[64];
+
+ if (mpd_song_get_end(song) > 0) {
+ char start[16], end[16];
+ format_duration_short(start, sizeof(start),
+ mpd_song_get_start(song));
+ format_duration_short(end, sizeof(end),
+ mpd_song_get_end(song));
+
+ snprintf(buffer, sizeof(buffer), "%s [%s-%s]\n",
+ length, start, end);
+ value = buffer;
+ } else if (mpd_song_get_start(song) > 0) {
+ char start[16];
+ format_duration_short(start, sizeof(start),
+ mpd_song_get_start(song));
+
+ snprintf(buffer, sizeof(buffer), "%s [%s-]\n",
+ length, start);
+ value = buffer;
+ }
+#endif
+
+ screen_song_append(_(tag_labels[LABEL_LENGTH]), value,
max_tag_label_width);
}