From 789171f53986c765e26e48f1c5bc95a1b4a0e878 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Sat, 12 Jul 2014 14:52:00 +0200 Subject: artwork: if album and filename are unknown -- use artist name, if known, as last resort for generating cache path --- plugins/artwork/artwork.c | 12 ++++++++---- plugins/artwork/artwork.h | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/artwork/artwork.c b/plugins/artwork/artwork.c index 27c3267d..12ceb15c 100644 --- a/plugins/artwork/artwork.c +++ b/plugins/artwork/artwork.c @@ -176,7 +176,10 @@ make_cache_dir_path (char *path, int size, const char *artist, int img_size) { static int make_cache_path2 (char *path, int size, const char *fname, const char *album, const char *artist, int img_size) { + *path = 0; + int unk = 0; + int unk_artist = 0; if (!album || !(*album)) { album = "Unknown album"; @@ -184,18 +187,19 @@ make_cache_path2 (char *path, int size, const char *fname, const char *album, co } if (!artist || !(*artist)) { artist = "Unknown artist"; - unk = 1; + unk_artist = 1; } if (unk) { if (fname) { - // album=escape(path) album = fname; } + else if (!unk_artist) { + album = artist; + } else { - trace ("artist or album is empty, give up\n"); - *path = 0; + trace ("not possible to get any unique album name\n"); return -1; } } diff --git a/plugins/artwork/artwork.h b/plugins/artwork/artwork.h index 850937e1..f4b278e3 100644 --- a/plugins/artwork/artwork.h +++ b/plugins/artwork/artwork.h @@ -46,6 +46,7 @@ typedef struct { char* (*get_album_art_sync) (const char *fname, const char *artist, const char *album, int size); // creates full path string for cache storage + // NOTE: this function is deprecated, please use make_cache_path2 void (*make_cache_path) (char *path, int size, const char *album, const char *artist, int img_size); // creates full path string for cache storage -- cgit v1.2.3