« get me outta code hell

mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
-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