Code

configure.ac: enable automake silent-rules
[ncmpc.git] / src / screen_song.c
index bed952fc11cf19901948ce91d0345cfa82cc9b54..156486aa36128828313528e7e29415ad11d1dbf8 100644 (file)
@@ -1,21 +1,21 @@
 /* ncmpc (Ncurses MPD Client)
  * (c) 2004-2010 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
  * (at your option) any later version.
-
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
-
+ *
  * You should have received a copy of the GNU General Public License along
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
+ */
 
 #include "screen_song.h"
 #include "screen_interface.h"
@@ -38,6 +38,7 @@ enum {
        LABEL_LENGTH = MPD_TAG_COUNT,
        LABEL_PATH,
        LABEL_BITRATE,
+       LABEL_POSITION,
 };
 
 static const char *const tag_labels[] = {
@@ -45,6 +46,7 @@ static const char *const tag_labels[] = {
        [MPD_TAG_TITLE] = N_("Title"),
        [MPD_TAG_ALBUM] = N_("Album"),
        [LABEL_LENGTH] = N_("Length"),
+       [LABEL_POSITION] = N_("Position"),
        [MPD_TAG_COMPOSER] = N_("Composer"),
        [MPD_TAG_NAME] = N_("Name"),
        [MPD_TAG_DISC] = N_("Disc"),
@@ -262,6 +264,11 @@ screen_song_add_song(const struct mpd_song *song, const struct mpdclient *c)
 {
        assert(song != NULL);
 
+       char songpos[16];
+       g_snprintf(songpos, sizeof(songpos), "%d", mpd_song_get_pos(song) + 1);
+       screen_song_append(_(tag_labels[LABEL_POSITION]), songpos,
+                          max_tag_label_width);
+
        screen_song_append_tag(song, MPD_TAG_ARTIST);
        screen_song_append_tag(song, MPD_TAG_TITLE);
        screen_song_append_tag(song, MPD_TAG_ALBUM);