From f1aff9ccc8ce6df3c54d69fa92f432145a1754a5 Mon Sep 17 00:00:00 2001 From: Qball Cow Date: Thu, 25 Sep 2008 17:34:37 +0200 Subject: [PATCH] Move to use new gmpc function --- configure.ac | 2 +- src/plugin.c | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index 4ca3e7f..dda9e75 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ PKG_CHECK_MODULES([gmpccaa],[ libxml-2.0 gthread-2.0 libmpd >= 0.15.98 - gmpc >= 0.15.98 + gmpc >= 0.16.2 ]) AC_SUBST(gmpccaa_LIBS) diff --git a/src/plugin.c b/src/plugin.c index 19790a9..b592c70 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -153,7 +153,7 @@ static amazon_song_info *__cover_art_xml_get_image(char *data,int size) } -static int __fetch_metadata_amazon(char *sfield, char *nartist, char *stype,char *nalbum,int type, char **url) +static int __fetch_metadata_amazon(mpd_Song *song, char *sfield, char *nartist, char *stype,char *nalbum,int type, char **url) { gmpc_easy_download_struct data= {NULL, 0,-1, NULL, NULL}; @@ -189,9 +189,7 @@ static int __fetch_metadata_amazon(char *sfield, char *nartist, char *stype,char if(data.size){ FILE *fp = NULL; gchar *imgpath = NULL; - gchar *filename = g_strdup_printf("%s-%s.jpg",nartist,nalbum); - imgpath = gmpc_get_covers_path(filename); - g_free(filename); + imgpath = gmpc_get_metadata_filename(META_ALBUM_ART, song,"jpg"); fp = fopen(imgpath, "wb"); if(fp) { @@ -212,11 +210,10 @@ static int __fetch_metadata_amazon(char *sfield, char *nartist, char *stype,char if(asi->album_info) { FILE *fp; - gchar *filename, *imgpath; - filename = g_strdup_printf("%s-%s.albuminfo",nartist,nalbum); - imgpath = gmpc_get_covers_path(filename); - g_free(filename); - fp = fopen(imgpath, "w"); + gchar *imgpath; + + imgpath = gmpc_get_metadata_filename(META_ALBUM_TXT, song,"jpg"); + fp = fopen(imgpath, "w"); if(fp) { int j=0,depth=0;; @@ -252,7 +249,7 @@ static int fetch_cover_art(mpd_Song *song,int type, char **url) gchar *artist = g_uri_escape_string(song->artist,NULL, TRUE); gchar *album = g_uri_escape_string(song->album,NULL, TRUE); - retval = __fetch_metadata_amazon( + retval = __fetch_metadata_amazon(song, "Title",album, "Artist", artist, type,url); @@ -260,9 +257,10 @@ static int fetch_cover_art(mpd_Song *song,int type, char **url) { gchar *performer = g_uri_escape_string(song->performer, NULL, TRUE); retval = __fetch_metadata_amazon( + song, "Title",album, - "Performer", performer, - type,url); + "Performer", performer, + type,url); g_free(performer); } -- 2.11.4.GIT