« get me outta code hell

skip .DS_Store, .git in crawl-local - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-05-13 18:09:51 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-05-13 18:10:14 -0300
commitc3425f516dfabe15c71b37faa9fa27ec55612900 (patch)
tree73c791489102967d5312e43d1555efde554f399e
parent43f1a1dd1b44065663a797603012394c52a9baea (diff)
skip .DS_Store, .git in crawl-local
-rw-r--r--crawlers.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/crawlers.js b/crawlers.js
index b2f13fd..8197095 100644
--- a/crawlers.js
+++ b/crawlers.js
@@ -16,6 +16,11 @@ export const musicExtensions = [
   'mod'
 ]
 
+export const skipNames = [
+  '.DS_Store',
+  '.git',
+]
+
 // Each value is a function with these additional properties:
 // * crawlerName: The name of the crawler, such as "crawl-http". Used by
 //   getCrawlerByName.
@@ -251,6 +256,12 @@ function crawlLocal(dirPath, extensions = musicExtensions, isTop = true) {
     items = orderBy(items)
 
     return Promise.all(items.map(item => {
+      // There are a few files which are just never what we're looking for.
+      // We skip including or searching under these altogether.
+      if (skipNames.includes(item)) {
+        return null
+      }
+
       const itemPath = path.join(dirPath, item)
       const itemURL = url.pathToFileURL(itemPath).href