summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ccc1fff)
raw | patch | inline | side by side (parent: ccc1fff)
author | Patrick Hallen <patrick.hallen@rwth-aachen.de> | |
Fri, 4 Sep 2009 11:12:57 +0000 (13:12 +0200) | ||
committer | Patrick Hallen <patrick.hallen@rwth-aachen.de> | |
Fri, 4 Sep 2009 11:12:57 +0000 (13:12 +0200) |
src/screen_song.c | patch | blob | history |
diff --git a/src/screen_song.c b/src/screen_song.c
index 6f1c8b8a075455799a83cdd418b0462d8f1a741a..8328415bf413a48bd63ba06c977e7733e91db68d 100644 (file)
--- a/src/screen_song.c
+++ b/src/screen_song.c
{
unsigned i, max_label_width;
enum label {
- ARTIST, TITLE, ALBUM, COMPOSER, NAME, DISC, TRACK,
+ ARTIST, TITLE, ALBUM, LENGTH, COMPOSER, NAME, DISC, TRACK,
DATE, GENRE, COMMENT, PATH, BITRATE
};
const char *labels[] = { [ARTIST] = _("Artist"),
[TITLE] = _("Title"),
[ALBUM] = _("Album"),
+ [LENGTH] = _("Length"),
[COMPOSER] = _("Composer"),
[NAME] = _("Name"),
[DISC] = _("Disc"),
screen_song_append(labels[ARTIST], song->artist, max_label_width);
screen_song_append(labels[TITLE], song->title, max_label_width);
screen_song_append(labels[ALBUM], song->album, max_label_width);
+ /* create time string and add it */
+ if (song->time != MPD_SONG_NO_TIME) {
+ char length[16];
+ /*write out the time, using hours if time over 60 minutes*/
+ if (song->time > 3600) {
+ g_snprintf(length, sizeof(length),
+ "%i:%02i:%02i",
+ song->time/3600, (song->time%3600)/60, song->time%60);
+ } else {
+ g_snprintf(length, sizeof(length),
+ "%i:%02i", song->time/60, song->time%60);
+ }
+ screen_song_append(labels[LENGTH], length, max_label_width);
+ }
screen_song_append(labels[COMPOSER], song->composer, max_label_width);
screen_song_append(labels[NAME], song->name, max_label_width);
screen_song_append(labels[DISC], song->disc, max_label_width);