summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-07-12 14:52:00 +0200
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-07-12 14:52:00 +0200
commit789171f53986c765e26e48f1c5bc95a1b4a0e878 (patch)
tree4013149191b687f666cad3f44a9fa2fa97bda1eb /plugins
parent27a180167057004a82f2d78ff1d66bc7cdef1423 (diff)
artwork: if album and filename are unknown -- use artist name, if known, as last resort for generating cache path
Diffstat (limited to 'plugins')
-rw-r--r--plugins/artwork/artwork.c12
-rw-r--r--plugins/artwork/artwork.h1
2 files changed, 9 insertions, 4 deletions
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