« get me outta code hell

Ctrl-O to open a prompt for loading a playlist - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
path: root/index.js
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-07-03 01:17:29 -0300
committerFlorrie <towerofnix@gmail.com>2018-07-03 01:17:29 -0300
commit2ec5450bcfb659daf3316d9a47825a64abf85431 (patch)
tree7735b846c6a23757d5bd1c2db0136aef7979a84a /index.js
parent8c31848f4bbe0957b4d7a2c0522df09d7f1c6bc5 (diff)
Ctrl-O to open a prompt for loading a playlist
Diffstat (limited to 'index.js')
-rwxr-xr-xindex.js23
1 files changed, 4 insertions, 19 deletions
diff --git a/index.js b/index.js
index 59c91ec..694a384 100755
--- a/index.js
+++ b/index.js
@@ -65,31 +65,16 @@ async function main() {
     source: ['crawl-local', process.env.HOME + '/Music']
   }
 
-  if (process.argv[2]) {
-    console.log('Opening playlist...')
-
-    const crawlers = getAllCrawlersForArg(process.argv[2])
-
-    if (crawlers.length === 0) {
-      console.error(`No suitable playlist crawler for "${process.argv[2]}".`)
-      process.exit(1)
-    }
-
-    const crawler = crawlers[0]
-
-    if (crawlers.length > 1) {
-      console.warn(`More than one suitable crawler for "${process.argv[2]}" - using ${crawler.name}.`)
-    }
-
-    grouplike = await crawler(process.argv[2])
-  }
-
   grouplike = await processSmartPlaylist(grouplike)
 
   appElement.grouplikeListingElement.loadGrouplike(grouplike)
 
   root.select(appElement.form)
 
+  if (process.argv[2]) {
+    appElement.handlePlaylistSource(process.argv[2])
+  }
+
   const flushable = new Flushable(process.stdout, true)
   flushable.resizeScreen(size)
   flushable.shouldShowCompressionStatistics = process.argv.includes('--show-ansi-stats')