-
-
Notifications
You must be signed in to change notification settings - Fork 309
-
Hi @pschatzmann.
In occasions if it's avoided to deep search (all directories from parent directory set on player) for applications as audio player with browser (as my project) when one directory includes a lot of files and subdirectories with more files, the AudioKit works agilest.
The modification that I'm suggesting is below (or similar up to you).
I tested this one and works very fine, now AudioKit for example in that critical case it is not freezed and takes a short time to discover all files (only in the directory that user sees)
/// Writes the index file
void listDir(Print &idxfile, const char *dirname) {
LOGD("listDir: %s", dirname);
FileT root = open(dirname);
if (!root) {
LOGE("Open failed: %s", dirname);
popPath();
return;
}
if (!isDirectory(root)) {
LOGD("Is not directory: %s", dirname);
popPath();
return;
}
if (StrView(dirname).startsWith(".")) {
LOGD("Invalid file: %s", dirname);
popPath();
return;
}
rewind(root);
FileT file = openNext(root);
while (file) {
if (isDirectory(file)) {
<---------------------------- Here is the suggestion
if( !disableDeepSearching ) {
String name = String(fileNamePath(file));
LOGD("name: %s", name.c_str());
pushPath(fileName(file));
listDir(idxfile, name.c_str());
}
----------------------------->
} else {
const char *fn = fileNamePath(file);
if (isValidAudioFile(file)) {
LOGD("Adding file to index: %s", fn);
idxfile.println(fn);
} else {
LOGD("Ignoring %s", fn);
}
}
file = openNext(root);
}
popPath();
}
On the other hand.
About reindex forced, I have tested it but at the end I have to remove index files to achieve that these one will be regenerated.
Any idea?
Thanks in advance.
AudioSourceIdxSDMMC source(..);
...
source.setCreateIndex(true);
source.begin();
Beta Was this translation helpful? Give feedback.