Code

screen_play: fix duration "0:-1"
authorMax Kellermann <max@duempel.org>
Wed, 8 Jul 2009 21:09:30 +0000 (23:09 +0200)
committerMax Kellermann <max@duempel.org>
Wed, 8 Jul 2009 21:09:30 +0000 (23:09 +0200)
If the song duration is not known (MPD_SONG_NO_TIME), don't attempt to
print -1 in the second column.

src/screen_play.c

index f41f32a597e0228a08b8c325df5c057f85948532..e1944663068da3d46aa6f40e5718786c9c1bd39d 100644 (file)
@@ -99,6 +99,9 @@ playlist_changed_callback(mpdclient_t *c, int event, gpointer data)
 static char *
 format_duration(int duration)
 {
+       if (duration == MPD_SONG_NO_TIME)
+               return NULL;
+
        return g_strdup_printf("%d:%02d", duration / 60, duration % 60);
 }