1
0
Fork 0
forked from len0rd/rockbox

Change the search_albumart_files "ignore track art" option to check track art last.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21126 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Andrew Mahone 2009-05-29 10:31:56 +00:00
parent b714ace163
commit 84106fd917

View file

@ -133,7 +133,7 @@ static bool try_exts(char *path, int len)
* *
* If the first symbol in size_string is a colon (e.g. ":100x100") * If the first symbol in size_string is a colon (e.g. ":100x100")
* then the colon is skipped ("100x100" will be used) and the track * then the colon is skipped ("100x100" will be used) and the track
* specific image (./<trackname><size>.bmp) is not tried. * specific image (./<trackname><size>.bmp) is tried last instead of first.
*/ */
bool search_albumart_files(const struct mp3entry *id3, const char *size_string, bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
char *buf, int buflen) char *buf, int buflen)
@ -141,6 +141,8 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
char path[MAX_PATH + 1]; char path[MAX_PATH + 1];
char dir[MAX_PATH + 1]; char dir[MAX_PATH + 1];
bool found = false; bool found = false;
int track_first = 1;
int pass;
const char *trackname; const char *trackname;
const char *artist; const char *artist;
int dirlen; int dirlen;
@ -155,15 +157,24 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
if (strcmp(trackname, "No file!") == 0) if (strcmp(trackname, "No file!") == 0)
return false; return false;
if (*size_string == ':')
{
size_string++;
track_first = 0;
}
strip_filename(dir, sizeof(dir), trackname); strip_filename(dir, sizeof(dir), trackname);
dirlen = strlen(dir); dirlen = strlen(dir);
albumlen = id3->album ? strlen(id3->album) : 0; albumlen = id3->album ? strlen(id3->album) : 0;
/* the first file we look for is one specific to the track playing */ for(pass = 0; pass < 2; pass++)
if (*size_string == ':') {
size_string++; if (track_first || pass)
else { {
strip_extension(path, sizeof(path) - strlen(size_string) - 4, trackname); /* the first file we look for is one specific to the
current track */
strip_extension(path, sizeof(path) - strlen(size_string) - 4,
trackname);
strcat(path, size_string); strcat(path, size_string);
strcat(path, "." EXT); strcat(path, "." EXT);
#ifdef USE_JPEG_COVER #ifdef USE_JPEG_COVER
@ -171,6 +182,8 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
#endif #endif
found = try_exts(path, pathlen); found = try_exts(path, pathlen);
} }
if (pass)
break;
if (!found && albumlen > 0) if (!found && albumlen > 0)
{ {
/* if it doesn't exist, /* if it doesn't exist,
@ -243,6 +256,9 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
found = try_exts(path, pathlen); found = try_exts(path, pathlen);
} }
} }
if (found)
break;
}
if (!found) if (!found)
return false; return false;