From cb61823ecceed1c2cc5bfe5b4ec3f3dd3daadc0d Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Mon, 11 May 2009 00:56:04 +0000 Subject: [PATCH] * Always store cached JPEG album art with a .jpg extension. --- albumart.c | 17 ++++++++++++++--- upnpsoap.c | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/albumart.c b/albumart.c index f69b545..9c7fee8 100644 --- a/albumart.c +++ b/albumart.c @@ -33,6 +33,17 @@ #include "image_utils.h" #include "log.h" +char * +art_cache_path(const char * orig_path) +{ + char * cache_file; + + asprintf(&cache_file, DB_PATH "/art_cache%s", orig_path); + strcpy(strchr(cache_file, '\0')-4, ".jpg"); + + return cache_file; +} + char * save_resized_album_art(image * imsrc, const char * path) { @@ -44,7 +55,7 @@ save_resized_album_art(image * imsrc, const char * path) if( !imsrc ) return NULL; - asprintf(&cache_file, DB_PATH "/art_cache%s", path); + cache_file = art_cache_path(path); if( access(cache_file, F_OK) == 0 ) return cache_file; @@ -116,7 +127,7 @@ check_embedded_art(const char * path, const char * image_data, int image_size) { if( !last_success ) return NULL; - asprintf(&art_path, DB_PATH "/art_cache%s", path); + art_path = art_cache_path(path); if( link(last_path, art_path) == 0 ) { return(art_path); @@ -153,7 +164,7 @@ check_embedded_art(const char * path, const char * image_data, int image_size) } else if( width > 0 && height > 0 ) { - asprintf(&art_path, DB_PATH "/art_cache%s", path); + art_path = art_cache_path(path); if( access(art_path, F_OK) == 0 ) goto end_art; cache_dir = strdup(art_path); diff --git a/upnpsoap.c b/upnpsoap.c index a529701..939ac08 100644 --- a/upnpsoap.c +++ b/upnpsoap.c @@ -119,6 +119,7 @@ GetProtocolInfo(struct upnphttp * h, const char * action) action, "urn:schemas-upnp-org:service:ConnectionManager:1", action); BuildSendAndCloseSoapResp(h, body, bodylen); + free(body); } static void