« get me outta code hell

mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
path: root/downloaders.js
diff options
context:
space:
mode:
Diffstat (limited to 'downloaders.js')
-rw-r--r--downloaders.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/downloaders.js b/downloaders.js
index 4c93d0f..4b4750c 100644
--- a/downloaders.js
+++ b/downloaders.js
@@ -118,7 +118,7 @@ const downloaders = {
 
   youtubedl: cachify('youtubedl', arg => {
     const outDir = tempy.directory()
-    const outFile = outDir + '/%(id)s-%(uploader)s-%(title)s.' + downloaders.extension
+    const outFile = outDir + '/%(id)s-%(uploader)s-%(title)s.%(ext)s'
 
     const opts = [
       '--quiet',
@@ -130,7 +130,8 @@ const downloaders = {
     ]
 
     return promisifyProcess(spawn('youtube-dl', opts))
-      .then(() => outDir)
+      .then(() => readdir(outDir))
+      .then(files => outDir + '/' + files[0])
   }),
 
   local: cachify('local', arg => {