« get me outta code hell

handy combine-album.js utility - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
path: root/crawlers.js
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2021-08-14 00:11:39 -0300
committer(quasar) nebula <towerofnix@gmail.com>2021-08-14 00:12:07 -0300
commitc047b8c57d4e5012578c072420d2b73dd5b59c4c (patch)
tree52270b0895d4bb61790aff43856ff4e3d2e78982 /crawlers.js
parent9c7e30f90f0e30535f87fbb28222c9a40940d9ec (diff)
handy combine-album.js utility
this isn't exposed via the mtui command so like, just run it directly
with node right now lol

(this commit also makes "." parse in timestamp positions)
Diffstat (limited to 'crawlers.js')
-rw-r--r--crawlers.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/crawlers.js b/crawlers.js
index 3f6e391..6af615d 100644
--- a/crawlers.js
+++ b/crawlers.js
@@ -11,6 +11,15 @@ const { promisify } = require('util')
 const readDir = promisify(fs.readdir)
 const stat = promisify(fs.stat)
 
+const musicExtensions = [
+  'ogg', 'oga',
+  'wav', 'mp3', 'm4a', 'aac', 'flac', 'opus',
+  'mp4', 'mov', 'mkv',
+  'mod'
+]
+
+module.exports.musicExtensions = musicExtensions
+
 // Each value is a function with these additional properties:
 // * crawlerName: The name of the crawler, such as "crawl-http". Used by
 //   getCrawlerByName.
@@ -229,12 +238,7 @@ function getHTMLLinks(text) {
 }
 */
 
-function crawlLocal(dirPath, extensions = [
-  'ogg', 'oga',
-  'wav', 'mp3', 'm4a', 'aac', 'flac', 'opus',
-  'mp4', 'mov', 'mkv',
-  'mod'
-], isTop = true) {
+function crawlLocal(dirPath, extensions = musicExtensions, isTop = true) {
   // If the passed path is a file:// URL, try to decode it:
   try {
     const url = new URL(dirPath)