# HG changeset patch # User William Pitcock # Date 1183952399 18000 # Node ID 31c44eb25a4a4a2e3b765961537b20ec40b60913 # Parent cc4e03df48a3676e4598e79bcc34ae81dc2c88e1 Fix more crashes and metadata. diff -r cc4e03df48a3 -r 31c44eb25a4a src/lastfm/lastfm.c --- a/src/lastfm/lastfm.c Sun Jul 08 22:25:12 2007 -0500 +++ b/src/lastfm/lastfm.c Sun Jul 08 22:39:59 2007 -0500 @@ -45,6 +45,7 @@ #include #include #include +#include #include "lastfm.h" #define DEBUG 1 @@ -155,7 +156,7 @@ if (!g_str_has_prefix(input_string, token)) return NULL; - return g_strdup(g_utf8_strchr(input_string, -1, '=') + 1); + return g_strdup(strchr(input_string, '=') + 1); } gint lastfm_adjust(const gchar * uri) /*tunes into a channel*/ @@ -226,11 +227,21 @@ for (i = 0; split && split[i]; i++) { - handle->lastfm_artist = parse(split[i],"artist="); - handle->lastfm_title = parse(split[i],"track=" ); - handle->lastfm_album = parse(split[i],"album=" ); - handle->lastfm_cover = parse(split[i],"albumcover_medium="); - handle->lastfm_station_name = parse(split[i],"station="); + if (g_str_has_prefix(split[i], "artist=")) + handle->lastfm_artist = parse(split[i],"artist="); + + if (g_str_has_prefix(split[i], "track=")) + handle->lastfm_title = parse(split[i],"track="); + + if (g_str_has_prefix(split[i], "album=")) + handle->lastfm_album = parse(split[i],"album=" ); + + if (g_str_has_prefix(split[i], "albumcover_medium=")) + handle->lastfm_cover = parse(split[i],"albumcover_medium="); + + if (g_str_has_prefix(split[i], "station=")) + handle->lastfm_station_name = parse(split[i],"station="); + if (g_str_has_prefix(split[i], "trackduration=")) handle->lastfm_duration = g_ascii_strtoull(g_strdup(split[i] + 14), NULL, 10); if (g_str_has_prefix(split[i], "trackprogress=")) @@ -441,6 +452,9 @@ { LastFM *handle = file->handle; + g_print("artist: %s track: %s station: %s\n", + handle->lastfm_artist, handle->lastfm_title, handle->lastfm_station_name); + if (!g_ascii_strncasecmp(field, "stream-name", 11) && (handle->lastfm_station_name != NULL)) return g_strdup(handle->lastfm_station_name); if (!g_ascii_strncasecmp(field, "track-name", 10) && (handle->lastfm_title != NULL) && (handle->lastfm_artist != NULL))