From c0d6ea0363473cbb43e4f1f50c92803ed14742cb Mon Sep 17 00:00:00 2001 From: Florrie Date: Tue, 15 Oct 2019 17:55:58 -0300 Subject: (o) to open through system; show non-music files --- crawlers.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crawlers.js') diff --git a/crawlers.js b/crawlers.js index f665c17..578a9f2 100644 --- a/crawlers.js +++ b/crawlers.js @@ -257,11 +257,12 @@ function crawlLocal(dirPath, extensions = [ return Promise.all(items.map(item => { const itemPath = path.join(dirPath, item) + const itemURL = url.pathToFileURL(itemPath).href return stat(itemPath).then(stats => { if (stats.isDirectory()) { return crawlLocal(itemPath, extensions, false) - .then(group => Object.assign({name: item}, group)) + .then(group => Object.assign({name: item, url: itemURL}, group)) } else if (stats.isFile()) { // Extname returns a string starting with a dot; we don't want the // dot, so we slice it off of the front. @@ -273,10 +274,9 @@ function crawlLocal(dirPath, extensions = [ // playlist, or want them in an auto-generated one. const basename = path.basename(item, path.extname(item)) - const track = {name: basename, downloaderArg: itemPath} - return track + return {name: basename, downloaderArg: itemPath, url: itemURL} } else { - return null + return {name: item, url: itemURL} } } }, statErr => null) -- cgit 1.3.0-6-gf8a5