« get me outta code hell

http-music - Command-line music player + utils (not a server!)
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/crawl-local.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/crawl-local.js b/src/crawl-local.js
index 134a574..202c732 100755
--- a/src/crawl-local.js
+++ b/src/crawl-local.js
@@ -33,7 +33,12 @@ function crawl(dirPath, extensions = [
           const ext = path.extname(item).slice(1)
 
           if (extensions.includes(ext)) {
-            const track = {name: item, downloaderArg: itemPath}
+            // The name of the track doesn't include the file extension; a user
+            // probably wouldn't add the file extensions to a hand-written
+            // 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
           } else {
             return null