summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Häggqvist <rasher@rasher.dk>2008-01-19 18:05:06 +0000
committerJonas Häggqvist <rasher@rasher.dk>2008-01-19 18:05:06 +0000
commit2cffb1bf3df30d312944cc283a48c081def2fec8 (patch)
tree27c4d83cee3301578973398c6e5a05e088376d11
parent608c547aa1812de4d9e41ad34eb686c45d404e9d (diff)
downloadrockbox-2cffb1bf3df30d312944cc283a48c081def2fec8.tar.gz
rockbox-2cffb1bf3df30d312944cc283a48c081def2fec8.zip
Look for albumart in .rockbox/albumart/<artist>-<album><size>.bmp in addition to the current locations.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16110 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/recorder/albumart.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/apps/recorder/albumart.c b/apps/recorder/albumart.c
index 0e45d9a935..13969d77e5 100644
--- a/apps/recorder/albumart.c
+++ b/apps/recorder/albumart.c
@@ -27,6 +27,7 @@
27#include "dircache.h" 27#include "dircache.h"
28#include "debug.h" 28#include "debug.h"
29#include "misc.h" 29#include "misc.h"
30#include "settings.h"
30 31
31 32
32/* Strip filename from a full path 33/* Strip filename from a full path
@@ -79,6 +80,8 @@ static void fix_path_part(char* path, int offset, int count)
79 80
80 for (i = 0; i <= count; i++, path++) 81 for (i = 0; i <= count; i++, path++)
81 { 82 {
83 if (*path == 0)
84 return;
82 if (*path == '"') 85 if (*path == '"')
83 *path = '\''; 86 *path = '\'';
84 else if (strchr(invalid_chars, *path)) 87 else if (strchr(invalid_chars, *path))
@@ -92,6 +95,7 @@ static void fix_path_part(char* path, int offset, int count)
92 * ./cover<size>.bmp 95 * ./cover<size>.bmp
93 * ../<albumname><size>.bmp 96 * ../<albumname><size>.bmp
94 * ../cover<size>.bmp 97 * ../cover<size>.bmp
98 * ROCKBOX_DIR/albumart/<artist>-<albumname><size>.bmp
95 * <size> is the value of the size_string parameter, <trackname> and 99 * <size> is the value of the size_string parameter, <trackname> and
96 * <albumname> are read from the ID3 metadata. 100 * <albumname> are read from the ID3 metadata.
97 * If a matching bitmap is found, its filename is stored in buf. 101 * If a matching bitmap is found, its filename is stored in buf.
@@ -140,6 +144,18 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
140 144
141 if (!found) 145 if (!found)
142 { 146 {
147 /* look in the albumart subdir of .rockbox */
148 snprintf(path, sizeof(path),
149 ROCKBOX_DIR "/albumart/%s-%s%s.bmp",
150 id3->artist,
151 id3->album,
152 size_string);
153 fix_path_part(path, strlen(ROCKBOX_DIR "/albumart/"), MAX_PATH);
154 found = file_exists(path);
155 }
156
157 if (!found)
158 {
143 /* if it still doesn't exist, 159 /* if it still doesn't exist,
144 * we continue to search in the parent directory */ 160 * we continue to search in the parent directory */
145 strcpy(path, dir); 161 strcpy(path, dir);