diff options
author | waker <wakeroid@gmail.com> | 2010-12-30 22:46:08 +0100 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2010-12-30 22:46:08 +0100 |
commit | 2a58af927c9b5a646d1f8a2b22ffe9ef9fea4f95 (patch) | |
tree | 776b1078a87d076509cd8c8008268021a16f8406 /plugins/artwork | |
parent | d1348d42cf8e7502c227637f49e14cc4be46a2dd (diff) |
artwork plugin now uses $XDG_CACHE_HOME/deadbeef or ~/.cache/deadbeef
Diffstat (limited to 'plugins/artwork')
-rw-r--r-- | plugins/artwork/artwork.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/plugins/artwork/artwork.c b/plugins/artwork/artwork.c index 34bac6dd..e8d175da 100644 --- a/plugins/artwork/artwork.c +++ b/plugins/artwork/artwork.c @@ -53,9 +53,10 @@ static const char *get_default_cover (void) { return default_cover; } -void -make_cache_dir_path (char *path, int size, const char *album, const char *artist) { - int sz = snprintf (path, size, "%s/artcache/", deadbeef->get_config_dir ()); +int +make_cache_dir_path (char *path, int size, const char *artist) { + const char *cache = getenv ("XDG_CACHE_HOME"); + int sz = snprintf (path, size, "%s/deadbeef/", cache ? cache : getenv ("HOME")); size -= sz; path += sz; @@ -65,20 +66,12 @@ make_cache_dir_path (char *path, int size, const char *album, const char *artist *p = '_'; } } + return sz; } void make_cache_path (char *path, int size, const char *album, const char *artist) { - int sz = snprintf (path, size, "%s/artcache/", deadbeef->get_config_dir ()); - size -= sz; - path += sz; - - sz = snprintf (path, size, "%s", artist); - for (char *p = path; *p; p++) { - if (*p == '/') { - *p = '_'; - } - } + int sz = make_cache_dir_path (path, size, artist); size -= sz; path += sz; sz = snprintf (path, size, "/%s.jpg", album); @@ -296,7 +289,7 @@ fetcher_thread (void *none) struct dirent **files; int files_count; - make_cache_dir_path (path, sizeof (path), param->album, param->artist); + make_cache_dir_path (path, sizeof (path), param->artist); trace ("cache folder: %s\n", path); if (!check_dir (path, 0755)) { queue_pop (); |