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)
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 @@
#include "misc.h"
#include "settings.h"
+#if defined(HAVE_JPEG) || defined(PLUGIN)
+#define USE_JPEG_COVER
+#endif
/* Strip filename from a full path
*
@@ -91,7 +94,7 @@ static void fix_path_part(char* path, int offset, int count)
}
}
-#if defined(HAVE_JPEG) || defined(PLUGIN)
+#ifdef USE_JPEG_COVER
static const char * extensions[] = { "jpeg", "jpg", "bmp" };
static int extension_lens[] = { 4, 3, 3 };
/* 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,
const char *artist;
int dirlen;
int albumlen;
-#if defined(HAVE_JPEG) || defined(PLUGIN)
+#ifdef USE_JPEG_COVER
int pathlen;
#endif
@@ -153,7 +156,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
/* the first file we look for is one specific to the track playing */
strip_extension(path, sizeof(path) - strlen(size_string) - 4, trackname);
strcat(path, size_string);
-#if defined(HAVE_JPEG) || defined(PLUGIN)
+#ifdef USE_JPEG_COVER
strcat(path, ".");
pathlen = strlen(path);
found = try_exts(path, pathlen);
@@ -165,7 +168,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
{
/* if it doesn't exist,
* we look for a file specific to the track's album name */
-#if defined(HAVE_JPEG) || defined(PLUGIN)
+#ifdef USE_JPEG_COVER
pathlen = snprintf(path, sizeof(path),
"%s%s%s.", dir, id3->album, size_string);
fix_path_part(path, dirlen, albumlen);
@@ -181,7 +184,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
if (!found)
{
/* if it still doesn't exist, we look for a generic file */
-#if defined(HAVE_JPEG) || defined(PLUGIN)
+#ifdef USE_JPEG_COVER
pathlen = snprintf(path, sizeof(path),
"%scover%s.", dir, size_string);
found = try_exts(path, pathlen);
@@ -192,7 +195,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
#endif
}
-#if defined(HAVE_JPEG) || defined(PLUGIN)
+#ifdef USE_JPEG_COVER
if (!found && !*size_string)
{
snprintf (path, sizeof(path), "%sfolder.jpg", dir);
@@ -205,7 +208,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
if (!found && artist && id3->album)
{
/* look in the albumart subdir of .rockbox */
-#if defined(HAVE_JPEG) || defined(PLUGIN)
+#ifdef USE_JPEG_COVER
pathlen = snprintf(path, sizeof(path),
ROCKBOX_DIR "/albumart/%s-%s%s.",
artist,
@@ -241,7 +244,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
{
/* we look in the parent directory
* for a file specific to the track's album name */
-#if defined(HAVE_JPEG) || defined(PLUGIN)
+#ifdef USE_JPEG_COVER
pathlen = snprintf(path, sizeof(path),
"%s%s%s.", dir, id3->album, size_string);
fix_path_part(path, dirlen, albumlen);
@@ -258,7 +261,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
{
/* if it still doesn't exist, we look in the parent directory
* for a generic file */
-#if defined(HAVE_JPEG) || defined(PLUGIN)
+#ifdef USE_JPEG_COVER
pathlen = snprintf(path, sizeof(path),
"%scover%s.", dir, size_string);
found = try_exts(path, pathlen);