« get me outta code hell

Tweak how youtube-dl downloads are stored - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-11-12 13:47:02 -0400
committerFlorrie <towerofnix@gmail.com>2018-11-12 13:47:02 -0400
commite0e8e85105de083a66e47f4d125cc621b95fbc02 (patch)
tree5226a172a86b26c66b5ffc94fbb0c3da9b41d675
parent2954284abee1b2e5754c0569288108a659c5cee2 (diff)
Tweak how youtube-dl downloads are stored
-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 => {