add special prioritized files to improve fs loader accuracy

This commit is contained in:
Mike Blumenkrantz 2016-05-02 19:17:54 -04:00
parent a83e832aeb
commit f39b7e1332
1 changed files with 30 additions and 3 deletions

View File

@ -101,9 +101,17 @@ fsrun(FSInfo *fsi, Ecore_Thread *eth)
Eina_Iterator *it;
struct stat st;
char buf[PATH_MAX] = {0};
char *file, buf[PATH_MAX] = {0};
Eina_Bool isdir;
Eina_List *files = NULL;
Eina_List *l, *ll, *final = NULL, *files = NULL;
unsigned int i;
const char *special[] =
{
"cover",
"folder",
"front"
};
Eina_List *s[EINA_C_ARRAY_LENGTH(special)] = {NULL};
if (stat(fsi->uri, &st)) return;
isdir = S_ISDIR(st.st_mode);
@ -133,7 +141,26 @@ fsrun(FSInfo *fsi, Ecore_Thread *eth)
}
}
}
ecore_thread_feedback(eth, files);
EINA_LIST_FOREACH_SAFE(files, l, ll, file)
{
char *p;
p = strrchr(file, '/');
if (p) p++;
else
p = file;
for (i = 0; i < EINA_C_ARRAY_LENGTH(special); i++)
if (!strncasecmp(p, special[i], strlen(special[i])))
{
s[i] = eina_list_append(s[i], file);
files = eina_list_remove_list(files, l);
}
}
for (i = 0; i < EINA_C_ARRAY_LENGTH(special); i++)
if (s[i]) final = eina_list_merge(final, s[i]);
if (files)
final = eina_list_merge(final, files);
ecore_thread_feedback(eth, final);
}
EAPI Eina_Bool