summaryrefslogtreecommitdiff
path: root/apps/recorder
diff options
context:
space:
mode:
authorAlexander Levin <al.le@rockbox.org>2009-05-16 07:34:36 +0000
committerAlexander Levin <al.le@rockbox.org>2009-05-16 07:34:36 +0000
commit98bcb0a8a88c09e1db3ef0c2087cb8e9b6d45c6c (patch)
tree5491ff472083865df0d2747a7cee00b37c5b367c /apps/recorder
parente7ab26535aa7879f7e6f1930c5b3f509153a67bd (diff)
downloadrockbox-98bcb0a8a88c09e1db3ef0c2087cb8e9b6d45c6c.tar.gz
rockbox-98bcb0a8a88c09e1db3ef0c2087cb8e9b6d45c6c.zip
Define a symbol and use it instead of repeating the condition
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20956 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder')
-rw-r--r--apps/recorder/albumart.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/apps/recorder/albumart.c b/apps/recorder/albumart.c
index 23f25559db..ffc69b43d4 100644
--- a/apps/recorder/albumart.c
+++ b/apps/recorder/albumart.c
@@ -31,6 +31,9 @@
31#include "misc.h" 31#include "misc.h"
32#include "settings.h" 32#include "settings.h"
33 33
34#if defined(HAVE_JPEG) || defined(PLUGIN)
35#define USE_JPEG_COVER
36#endif
34 37
35/* Strip filename from a full path 38/* Strip filename from a full path
36 * 39 *
@@ -91,7 +94,7 @@ static void fix_path_part(char* path, int offset, int count)
91 } 94 }
92} 95}
93 96
94#if defined(HAVE_JPEG) || defined(PLUGIN) 97#ifdef USE_JPEG_COVER
95static const char * extensions[] = { "jpeg", "jpg", "bmp" }; 98static const char * extensions[] = { "jpeg", "jpg", "bmp" };
96static int extension_lens[] = { 4, 3, 3 }; 99static int extension_lens[] = { 4, 3, 3 };
97/* Try checking for several file extensions, return true if a file is found and 100/* Try checking for several file extensions, return true if a file is found and
@@ -134,7 +137,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
134 const char *artist; 137 const char *artist;
135 int dirlen; 138 int dirlen;
136 int albumlen; 139 int albumlen;
137#if defined(HAVE_JPEG) || defined(PLUGIN) 140#ifdef USE_JPEG_COVER
138 int pathlen; 141 int pathlen;
139#endif 142#endif
140 143
@@ -153,7 +156,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
153 /* the first file we look for is one specific to the track playing */ 156 /* the first file we look for is one specific to the track playing */
154 strip_extension(path, sizeof(path) - strlen(size_string) - 4, trackname); 157 strip_extension(path, sizeof(path) - strlen(size_string) - 4, trackname);
155 strcat(path, size_string); 158 strcat(path, size_string);
156#if defined(HAVE_JPEG) || defined(PLUGIN) 159#ifdef USE_JPEG_COVER
157 strcat(path, "."); 160 strcat(path, ".");
158 pathlen = strlen(path); 161 pathlen = strlen(path);
159 found = try_exts(path, pathlen); 162 found = try_exts(path, pathlen);
@@ -165,7 +168,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
165 { 168 {
166 /* if it doesn't exist, 169 /* if it doesn't exist,
167 * we look for a file specific to the track's album name */ 170 * we look for a file specific to the track's album name */
168#if defined(HAVE_JPEG) || defined(PLUGIN) 171#ifdef USE_JPEG_COVER
169 pathlen = snprintf(path, sizeof(path), 172 pathlen = snprintf(path, sizeof(path),
170 "%s%s%s.", dir, id3->album, size_string); 173 "%s%s%s.", dir, id3->album, size_string);
171 fix_path_part(path, dirlen, albumlen); 174 fix_path_part(path, dirlen, albumlen);
@@ -181,7 +184,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
181 if (!found) 184 if (!found)
182 { 185 {
183 /* if it still doesn't exist, we look for a generic file */ 186 /* if it still doesn't exist, we look for a generic file */
184#if defined(HAVE_JPEG) || defined(PLUGIN) 187#ifdef USE_JPEG_COVER
185 pathlen = snprintf(path, sizeof(path), 188 pathlen = snprintf(path, sizeof(path),
186 "%scover%s.", dir, size_string); 189 "%scover%s.", dir, size_string);
187 found = try_exts(path, pathlen); 190 found = try_exts(path, pathlen);
@@ -192,7 +195,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
192#endif 195#endif
193 } 196 }
194 197
195#if defined(HAVE_JPEG) || defined(PLUGIN) 198#ifdef USE_JPEG_COVER
196 if (!found && !*size_string) 199 if (!found && !*size_string)
197 { 200 {
198 snprintf (path, sizeof(path), "%sfolder.jpg", dir); 201 snprintf (path, sizeof(path), "%sfolder.jpg", dir);
@@ -205,7 +208,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
205 if (!found && artist && id3->album) 208 if (!found && artist && id3->album)
206 { 209 {
207 /* look in the albumart subdir of .rockbox */ 210 /* look in the albumart subdir of .rockbox */
208#if defined(HAVE_JPEG) || defined(PLUGIN) 211#ifdef USE_JPEG_COVER
209 pathlen = snprintf(path, sizeof(path), 212 pathlen = snprintf(path, sizeof(path),
210 ROCKBOX_DIR "/albumart/%s-%s%s.", 213 ROCKBOX_DIR "/albumart/%s-%s%s.",
211 artist, 214 artist,
@@ -241,7 +244,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
241 { 244 {
242 /* we look in the parent directory 245 /* we look in the parent directory
243 * for a file specific to the track's album name */ 246 * for a file specific to the track's album name */
244#if defined(HAVE_JPEG) || defined(PLUGIN) 247#ifdef USE_JPEG_COVER
245 pathlen = snprintf(path, sizeof(path), 248 pathlen = snprintf(path, sizeof(path),
246 "%s%s%s.", dir, id3->album, size_string); 249 "%s%s%s.", dir, id3->album, size_string);
247 fix_path_part(path, dirlen, albumlen); 250 fix_path_part(path, dirlen, albumlen);
@@ -258,7 +261,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
258 { 261 {
259 /* if it still doesn't exist, we look in the parent directory 262 /* if it still doesn't exist, we look in the parent directory
260 * for a generic file */ 263 * for a generic file */
261#if defined(HAVE_JPEG) || defined(PLUGIN) 264#ifdef USE_JPEG_COVER
262 pathlen = snprintf(path, sizeof(path), 265 pathlen = snprintf(path, sizeof(path),
263 "%scover%s.", dir, size_string); 266 "%scover%s.", dir, size_string);
264 found = try_exts(path, pathlen); 267 found = try_exts(path, pathlen);