Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

listDir of SDIndex.h improvement #2194

hash6iron started this conversation in Ideas
Discussion options

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();
You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /