summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b47038e)
raw | patch | inline | side by side (parent: b47038e)
author | Max Kellermann <max@duempel.org> | |
Mon, 2 Nov 2009 20:11:57 +0000 (21:11 +0100) | ||
committer | Max Kellermann <max@duempel.org> | |
Mon, 14 Jul 2014 09:37:31 +0000 (11:37 +0200) |
Drawing the bit rate in screen_song_add_song() requires some redundant
checks.
checks.
src/screen_song.c | patch | blob | history |
diff --git a/src/screen_song.c b/src/screen_song.c
index 2a69860ae33e9466c96ec89e02cee843d0773fd7..973812b4e53d393db8d531e575ad044cf7b63ef6 100644 (file)
--- a/src/screen_song.c
+++ b/src/screen_song.c
}
static void
-screen_song_add_song(const struct mpd_song *song, const struct mpdclient *c)
+screen_song_add_song(const struct mpd_song *song)
{
assert(song != NULL);
screen_song_append(_(tag_labels[LABEL_PATH]), mpd_song_get_uri(song),
max_tag_label_width);
- if (mpdclient_is_playing(c) && c->song != NULL &&
- strcmp(mpd_song_get_uri(c->song), mpd_song_get_uri(song)) == 0 &&
- mpd_status_get_kbit_rate(c->status)) {
- char buf[16];
- g_snprintf(buf, sizeof(buf), _("%d kbps"),
- mpd_status_get_kbit_rate(c->status));
- screen_song_append(_(tag_labels[LABEL_BITRATE]), buf,
- max_tag_label_width);
-
- const struct mpd_audio_format *format =
- mpd_status_get_audio_format(c->status);
- if (format) {
- g_snprintf(buf, sizeof(buf), _("%u:%u:%u"),
- format->sample_rate, format->bits,
- format->channels);
- screen_song_append(_(tag_labels[LABEL_FORMAT]), buf,
- max_tag_label_width);
- }
- }
}
static void
mpd_song_get_uri(c->song)) != 0 ||
!mpdclient_is_playing(c))) {
g_ptr_array_add(current.lines, g_strdup(_("Selected song")) );
- screen_song_add_song(current.selected_song, c);
+ screen_song_add_song(current.selected_song);
g_ptr_array_add(current.lines, g_strdup("\0"));
}
}
current.played_song = mpd_song_dup(c->song);
g_ptr_array_add(current.lines, g_strdup(_("Currently playing song")));
- screen_song_add_song(current.played_song, c);
+ screen_song_add_song(current.played_song);
+
+ if (mpd_status_get_kbit_rate(c->status) > 0) {
+ char buf[16];
+ g_snprintf(buf, sizeof(buf), _("%d kbps"),
+ mpd_status_get_kbit_rate(c->status));
+ screen_song_append(_(tag_labels[LABEL_BITRATE]), buf,
+ max_tag_label_width);
+ }
+
+ const struct mpd_audio_format *format =
+ mpd_status_get_audio_format(c->status);
+ if (format) {
+ char buf[32];
+ g_snprintf(buf, sizeof(buf), _("%u:%u:%u"),
+ format->sample_rate, format->bits,
+ format->channels);
+ screen_song_append(_(tag_labels[LABEL_FORMAT]), buf,
+ max_tag_label_width);
+ }
+
g_ptr_array_add(current.lines, g_strdup("\0"));
}