« get me outta code hell

make locally opened playlists have a group name! - 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>2020-07-03 21:29:39 -0300
committerFlorrie <towerofnix@gmail.com>2020-07-03 21:29:39 -0300
commit3d73a0da45cc8e13b5ac0f58f57683ab2d772838 (patch)
treea03a62cc792c127a83592a48d040d65aeab0b21b
parenta58f06407291824be882d896df58bace5e663196 (diff)
make locally opened playlists have a group name!
-rw-r--r--client.js1
-rw-r--r--crawlers.js5
-rw-r--r--smart-playlist.js6
-rw-r--r--todo.txt18
4 files changed, 28 insertions, 2 deletions
diff --git a/client.js b/client.js
index 0f7dde3..33cc62a 100644
--- a/client.js
+++ b/client.js
@@ -63,7 +63,6 @@ const setupClient = async ({backend, writable, interfacer, appConfig}) => {
     cleanTerminal()
   })
 
-  // TODO: Don't load a default playlist?
   let grouplike = {
     name: 'My ~/Music Library',
     comment: (
diff --git a/crawlers.js b/crawlers.js
index 92243c9..1cbb036 100644
--- a/crawlers.js
+++ b/crawlers.js
@@ -298,7 +298,10 @@ function crawlLocal(dirPath, extensions = [
       throw err
     }
   }).then(items => items.filter(Boolean))
-    .then(filteredItems => ({items: filteredItems}))
+    .then(filteredItems => ({
+      name: path.basename(dirPath),
+      items: filteredItems
+    }))
 }
 
 crawlLocal.crawlerName = 'crawl-local'
diff --git a/smart-playlist.js b/smart-playlist.js
index 09badd9..19294db 100644
--- a/smart-playlist.js
+++ b/smart-playlist.js
@@ -18,6 +18,12 @@ async function processSmartPlaylist(item, topItem = true) {
 
     if (crawl) {
       Object.assign(newItem, await crawl(...args))
+
+      // If the passed smart playlist had a name, retain that instead of using
+      // the name resulting from the crawler.
+      if (item.name) {
+        newItem.name = item.name
+      }
     } else {
       console.error(`No crawler by name ${name} - skipped item:`, item)
       newItem.failed = true
diff --git a/todo.txt b/todo.txt
index 8bfc682..98a57a8 100644
--- a/todo.txt
+++ b/todo.txt
@@ -521,3 +521,21 @@ TODO: In that regard, also change the queue length label (just above the time
       label) to indicate which track is selected --- RELATIVE to the current
       track, ala "40 (+5) / 1032" or "5 (-1) / 10".
       (Done!)
+
+TODO: Deselecting a grouplike listing (e.g. by clicking elsewhere) should hide
+      its "jump to" element.
+
+TODO: A "before selected item" option for in the queue menu!
+
+TODO: The sorting for library3/C418 seems to be weird???? Could be pointing to
+      some bug!
+
+TODO: Selecting a group from the path listing at the bottom of listings should
+      make it so the child of that group matching with the path is selected.
+      For example: selecting X in W/X/Y/Z would open the directory X and
+      select item Y; selecting Z would open the directory Z and select the
+      track (or group) which the path element is active on in the first place.
+
+TODO: UI to change the directory from which mtui reads music by default!
+
+TODO: file/folder browse-select UI 0_0