* Check for hidden album art files.
This commit is contained in:
		
							
								
								
									
										33
									
								
								albumart.c
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								albumart.c
									
									
									
									
									
								
							| @@ -272,6 +272,7 @@ check_for_album_file(const char *path) | |||||||
| 	char *art_file; | 	char *art_file; | ||||||
| 	const char *dir; | 	const char *dir; | ||||||
| 	struct stat st; | 	struct stat st; | ||||||
|  | 	int ret; | ||||||
|  |  | ||||||
| 	if( stat(path, &st) != 0 ) | 	if( stat(path, &st) != 0 ) | ||||||
| 		return NULL; | 		return NULL; | ||||||
| @@ -286,20 +287,28 @@ check_for_album_file(const char *path) | |||||||
|  |  | ||||||
| 	/* First look for file-specific cover art */ | 	/* First look for file-specific cover art */ | ||||||
| 	snprintf(file, sizeof(file), "%s.cover.jpg", path); | 	snprintf(file, sizeof(file), "%s.cover.jpg", path); | ||||||
| 	if( access(file, R_OK) == 0 ) | 	ret = access(file, R_OK); | ||||||
|  | 	if( ret != 0 ) | ||||||
| 	{ | 	{ | ||||||
| 		if( art_cache_exists(file, &art_file) ) | 		strncpyt(file, path, sizeof(file)); | ||||||
| 			goto existing_file; | 		art_file = strrchr(file, '.'); | ||||||
| 		free(art_file); | 		if( art_file ) | ||||||
| 		imsrc = image_new_from_jpeg(file, 1, NULL, 0, 1, ROTATE_NONE); | 		{ | ||||||
| 		if( imsrc ) | 			strcpy(art_file, ".jpg"); | ||||||
| 			goto found_file; | 			ret = access(file, R_OK); | ||||||
|  | 		} | ||||||
|  | 		if( ret != 0 ) | ||||||
|  | 		{ | ||||||
|  | 			art_file = strrchr(file, '/'); | ||||||
|  | 			if( art_file ) | ||||||
|  | 			{ | ||||||
|  | 				memmove(art_file+2, art_file+1, file+MAXPATHLEN-art_file-2); | ||||||
|  | 				art_file[1] = '.'; | ||||||
|  | 				ret = access(file, R_OK); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 	snprintf(file, sizeof(file), "%s", path); | 	if( ret == 0 ) | ||||||
| 	art_file = strrchr(file, '.'); |  | ||||||
| 	if( art_file ) |  | ||||||
| 		strcpy(art_file, ".jpg"); |  | ||||||
| 	if( access(file, R_OK) == 0 ) |  | ||||||
| 	{ | 	{ | ||||||
| 		if( art_cache_exists(file, &art_file) ) | 		if( art_cache_exists(file, &art_file) ) | ||||||
| 			goto existing_file; | 			goto existing_file; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user