Mercurial > audlegacy-plugins
changeset 1219:31c44eb25a4a
Fix more crashes and metadata.
author | William Pitcock <nenolod@atheme-project.org> |
---|---|
date | Sun, 08 Jul 2007 22:39:59 -0500 |
parents | cc4e03df48a3 |
children | 4730e246f536 |
files | src/lastfm/lastfm.c |
diffstat | 1 files changed, 20 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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 <libmowgli/mowgli_global_storage.h> #include <curl/curl.h> #include <glib.h> +#include <string.h> #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))