diff options
Diffstat (limited to 'crawlers.js')
-rw-r--r-- | crawlers.js | 16 |
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) |