diff --git a/src/screen_song.c b/src/screen_song.c
index 29c0f2df7a140d554241df6ddcb1b88f9cbb5b4b..a7d6f8ee4c087c4dbdae4b189c4c528465bd7985 100644 (file)
--- a/src/screen_song.c
+++ b/src/screen_song.c
/* ncmpc (Ncurses MPD Client)
* (c) 2004-2009 The Music Player Daemon Project
* Project homepage: http://musicpd.org
-
+
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
static list_window_t *lw;
-static const struct mpd_song *next_song;
+static struct mpd_song *next_song;
static struct {
struct mpd_song *selected_song;
static const char *
screen_song_list_callback(unsigned idx, G_GNUC_UNUSED bool *highlight,
- G_GNUC_UNUSED void *data)
+ G_GNUC_UNUSED char** sc, G_GNUC_UNUSED void *data)
{
static char buffer[256];
char *value;
{
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);
g_date_strftime(buf, sizeof(buf), "%x", date);
screen_song_append(labels[DBUPTIME], buf, max_label_width);
g_date_free(date);
+
+ mpd_freeStats(mpd_stats);
}
}
/* If a song was selected before the song screen was opened */
if (next_song != NULL) {
assert(current.selected_song == NULL);
- current.selected_song = mpd_songDup(next_song);
+ current.selected_song = next_song;
next_song = NULL;
}
#ifdef ENABLE_LYRICS_SCREEN
case CMD_SCREEN_LYRICS:
if (current.selected_song != NULL) {
- screen_lyrics_switch(c, current.selected_song);
+ screen_lyrics_switch(c, current.selected_song, false);
return true;
}
if (current.played_song != NULL) {
- screen_lyrics_switch(c, current.played_song);
+ screen_lyrics_switch(c, current.played_song, true);
return true;
}
return false;
assert(current.selected_song == NULL);
assert(current.played_song == NULL);
- next_song = song;
+ next_song = mpd_songDup(song);
screen_switch(&screen_song, c);
}