* Always store cached JPEG album art with a .jpg extension.
This commit is contained in:
		
							
								
								
									
										17
									
								
								albumart.c
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								albumart.c
									
									
									
									
									
								
							@@ -33,6 +33,17 @@
 | 
				
			|||||||
#include "image_utils.h"
 | 
					#include "image_utils.h"
 | 
				
			||||||
#include "log.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 *
 | 
					char *
 | 
				
			||||||
save_resized_album_art(image * imsrc, const char * path)
 | 
					save_resized_album_art(image * imsrc, const char * path)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -44,7 +55,7 @@ save_resized_album_art(image * imsrc, const char * path)
 | 
				
			|||||||
	if( !imsrc )
 | 
						if( !imsrc )
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	asprintf(&cache_file, DB_PATH "/art_cache%s", path);
 | 
						cache_file = art_cache_path(path);
 | 
				
			||||||
	if( access(cache_file, F_OK) == 0 )
 | 
						if( access(cache_file, F_OK) == 0 )
 | 
				
			||||||
		return cache_file;
 | 
							return cache_file;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -116,7 +127,7 @@ check_embedded_art(const char * path, const char * image_data, int image_size)
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
		if( !last_success )
 | 
							if( !last_success )
 | 
				
			||||||
			return NULL;
 | 
								return NULL;
 | 
				
			||||||
		asprintf(&art_path, DB_PATH "/art_cache%s", path);
 | 
							art_path = art_cache_path(path);
 | 
				
			||||||
		if( link(last_path, art_path) == 0 )
 | 
							if( link(last_path, art_path) == 0 )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return(art_path);
 | 
								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 )
 | 
						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 )
 | 
							if( access(art_path, F_OK) == 0 )
 | 
				
			||||||
			goto end_art;
 | 
								goto end_art;
 | 
				
			||||||
		cache_dir = strdup(art_path);
 | 
							cache_dir = strdup(art_path);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -119,6 +119,7 @@ GetProtocolInfo(struct upnphttp * h, const char * action)
 | 
				
			|||||||
		action, "urn:schemas-upnp-org:service:ConnectionManager:1",
 | 
							action, "urn:schemas-upnp-org:service:ConnectionManager:1",
 | 
				
			||||||
		action);	
 | 
							action);	
 | 
				
			||||||
	BuildSendAndCloseSoapResp(h, body, bodylen);
 | 
						BuildSendAndCloseSoapResp(h, body, bodylen);
 | 
				
			||||||
 | 
						free(body);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user