From 65310799a7d27e246bd625e4abf80634410d0463 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 1 Oct 2009 19:40:39 +0200 Subject: [PATCH] screen_lyrics: don't use strfsong() to obtain tags Use mpd_song_get_tag(). This guarantees that the tags are encoded in UTF-8. --- src/screen_lyrics.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c index 62d5b13..054ac62 100644 --- a/src/screen_lyrics.c +++ b/src/screen_lyrics.c @@ -24,7 +24,6 @@ #include "mpdclient.h" #include "command.h" #include "screen.h" -#include "strfsong.h" #include "lyrics.h" #include "screen_text.h" @@ -162,20 +161,19 @@ screen_lyrics_callback(const GString *result, G_GNUC_UNUSED void *data) static void screen_lyrics_load(const struct mpd_song *song) { - char buffer[MAX_SONGNAME_LENGTH]; + const char *artist, *title; assert(song != NULL); screen_lyrics_abort(); screen_text_clear(&text); - current.song = mpd_song_dup(song); - - strfsong(buffer, sizeof(buffer), "%artist%", song); - current.artist = g_strdup(buffer); + artist = mpd_song_get_tag(song, MPD_TAG_ARTIST, 0); + title = mpd_song_get_tag(song, MPD_TAG_TITLE, 0); - strfsong(buffer, sizeof(buffer), "%title%", song); - current.title = g_strdup(buffer); + current.song = mpd_song_dup(song); + current.artist = g_strdup(artist); + current.title = g_strdup(title); current.loader = lyrics_load(current.artist, current.title, screen_lyrics_callback, NULL); -- 2.30.2