« get me outta code hell

Merge branch 'workspace' - http-music - Command-line music player + utils (not a server!)
about summary refs log tree commit diff
path: root/src/http-music.js
diff options
context:
space:
mode:
authorliam4 <towerofnix@gmail.com>2017-06-21 21:53:43 +0000
committerliam4 <towerofnix@gmail.com>2017-06-21 21:53:43 +0000
commit4074b66746ac87aa1a655dfaa914e5e02b8f8221 (patch)
tree7bb50dd4362feb9ce7ed8b3c131486114e1ffff5 /src/http-music.js
parentaf4749b962a7c5c488f52ae2b6f2ff0fe3d920a0 (diff)
parent5cbda3bc6c678a9b212fc1b47d94a3b234bbf818 (diff)
Merge branch 'workspace'
Diffstat (limited to 'src/http-music.js')
-rwxr-xr-xsrc/http-music.js13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/http-music.js b/src/http-music.js
index ed79878..68bfa77 100755
--- a/src/http-music.js
+++ b/src/http-music.js
@@ -224,17 +224,8 @@ setupDefaultPlaylist('./playlist.json')
         return
       }
 
-      let downloader
-      if (downloaderType === 'http') {
-        console.log("Using HTTP downloader.")
-        downloader = downloaders.makeHTTPDownloader()
-      } else if (downloaderType === 'youtube') {
-        console.log("Using YouTube downloader.")
-        downloader = downloaders.makeYouTubeDownloader()
-      } else if (downloaderType === 'local') {
-        console.log("Using local file downloader.")
-        downloader = downloaders.makeLocalDownloader()
-      } else {
+      let downloader = downloaders.getDownloader(downloaderType)
+      if (!downloader) {
         console.error("Invalid downloader type: " + downloaderType)
         return
       }