« get me outta code hell

mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--client.js10
-rwxr-xr-xindex.js11
2 files changed, 11 insertions, 10 deletions
diff --git a/client.js b/client.js
index aa854ed..ec1ab60 100644
--- a/client.js
+++ b/client.js
@@ -4,7 +4,6 @@
 
 const AppElement = require('./ui')
 const processSmartPlaylist = require('./smart-playlist')
-const os = require('os')
 
 const {
   ui: {
@@ -63,15 +62,6 @@ const setupClient = async ({backend, writable, interfacer, appConfig}) => {
     cleanTerminal()
   })
 
-  let grouplike = {
-    name: 'My ~/Music Library',
-    comment: (
-      '(Add tracks and folders to ~/Music to make them show up here,' +
-      ' or pass mtui your own playlist.json file!)'),
-    source: ['crawl-local', os.homedir() + '/Music']
-  }
-  await appElement.loadPlaylistOrSource(grouplike, true)
-
   root.select(appElement)
 
   // Load up initial state
diff --git a/index.js b/index.js
index 444d579..b320812 100755
--- a/index.js
+++ b/index.js
@@ -29,6 +29,7 @@ const {
 
 const { promisify } = require('util')
 const fs = require('fs')
+const os = require('os')
 const readFile = promisify(fs.readFile)
 const writeFile = promisify(fs.writeFile)
 
@@ -123,6 +124,16 @@ async function main() {
     root.renderNow()
   })
 
+  if (playlistSources.length === 0) {
+    playlistSources.push({
+      name: 'My ~/Music Library',
+      comment: (
+        '(Add tracks and folders to ~/Music to make them show up here,' +
+        ' or pass mtui your own playlist.json file!)'),
+      source: ['crawl-local', os.homedir() + '/Music']
+    })
+  }
+
   const loadPlaylists = async () => {
     for (const source of playlistSources) {
       await appElement.loadPlaylistOrSource(source, true)