diff options
author | Alexey Yakovenko <waker@users.sourceforge.net> | 2014-06-27 21:10:20 +0200 |
---|---|---|
committer | Alexey Yakovenko <waker@users.sourceforge.net> | 2014-06-27 21:10:20 +0200 |
commit | 908b64c6eb608ae1266e1a168eb8e1f461a86ffb (patch) | |
tree | 3e99e278ff4189776e869d251fbfc06299f845fc /plugins | |
parent | 9f6762c3c9d4c6d60486e01b320e3b0aeb181499 (diff) |
artwork: fixed caching for untagged files
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/artwork/artwork.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/plugins/artwork/artwork.c b/plugins/artwork/artwork.c index f577f0f5..94717931 100644 --- a/plugins/artwork/artwork.c +++ b/plugins/artwork/artwork.c @@ -1167,7 +1167,7 @@ fetcher_thread (void *none) } if(! (is_ogg? FLAC__metadata_chain_read_ogg_with_callbacks(chain, (FLAC__IOHandle)file, iocb) : FLAC__metadata_chain_read_with_callbacks(chain, (FLAC__IOHandle)file, iocb)) ) { - trace ("%s: ERROR: reading metadata", filename); + trace ("artwork: failed to read metadata from flac: %s\n", filename); deadbeef->fclose (file); FLAC__metadata_chain_delete(chain); break; @@ -1263,17 +1263,24 @@ fetcher_thread (void *none) if (files_count > 0) { trace ("found cover for %s - %s in local folder\n", param->artist, param->album); - if (check_dir (path, 0755)) { - strcat (path, "/"); - strcat (path, files[0]->d_name); - char cache_path[1024]; - char tmp_path[1024]; - make_cache_path2 (cache_path, sizeof (cache_path), param->fname, param->album, param->artist, -1); + strcat (path, "/"); + strcat (path, files[0]->d_name); + char cache_path[PATH_MAX]; + char tmp_path[PATH_MAX]; + char cache_path_dir[PATH_MAX]; + make_cache_path2 (cache_path, sizeof (cache_path), param->fname, param->album, param->artist, -1); + strcpy (cache_path_dir, cache_path); + char *slash = strrchr (cache_path_dir, '/'); + if (slash) { + *slash = 0; + } + trace ("check_dir: %s\n", cache_path_dir); + if (check_dir (cache_path_dir, 0755)) { snprintf (tmp_path, sizeof (tmp_path), "%s.part", cache_path); copy_file (path, tmp_path, -1); int err = rename (tmp_path, cache_path); if (err != 0) { - trace ("Failed to move %s to %s: %s\n", tmp_path, cache_path, strerror (err)); + trace ("artwork: rename error %d: failed to move %s to %s: %s\n", err, tmp_path, cache_path, strerror (err)); unlink (tmp_path); } int i; |