« get me outta code hell

General improvements - http-music - Command-line music player + utils (not a server!)
about summary refs log tree commit diff
path: root/src/play.js
diff options
context:
space:
mode:
authorliam4 <towerofnix@gmail.com>2017-05-31 19:32:36 -0300
committerliam4 <towerofnix@gmail.com>2017-05-31 19:32:36 -0300
commit4b1a544510f436fac951c8d161c4fbce44c42580 (patch)
treedf7fc1716a892821202b123c52167a7168ecddbb /src/play.js
parent26663377fd7ea15a6c3d23a399d1266c8639d42e (diff)
General improvements
Diffstat (limited to 'src/play.js')
-rw-r--r--src/play.js35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/play.js b/src/play.js
index 9b9a5cf..5e3e04b 100644
--- a/src/play.js
+++ b/src/play.js
@@ -8,7 +8,7 @@ const processArgv = require('./process-argv')
 const pickers = require('./pickers')
 
 const {
-  filterPlaylistByPathString, ignoreGroupByPathString, getPlaylistTreeString
+  filterPlaylistByPathString, removeGroupByPathString, getPlaylistTreeString
 } = require('./playlist-utils')
 
 const readFile = promisify(fs.readFile)
@@ -56,7 +56,7 @@ readFile('./playlist.json', 'utf-8')
         // Keeps a group by loading it from the source playlist into the
         // active playlist. This is usually useful after clearing the
         // active playlist; it can also be used to keep a subgroup when
-        // you've ignored an entire parent group, e.g. `-i foo -k foo/baz`.
+        // you've removed an entire parent group, e.g. `-r foo -k foo/baz`.
 
         const pathString = util.nextArg()
         const group = filterPlaylistByPathString(sourcePlaylist, pathString)
@@ -65,16 +65,17 @@ readFile('./playlist.json', 'utf-8')
 
       'k': util => util.alias('-keep'),
 
-      '-ignore': function(util) {
-        // --ignore <groupPath>  (alias: -i)
+      '-remove': function(util) {
+        // --remove <groupPath>  (alias: -r, -x)
         // Filters the playlist so that the given path is removed.
 
         const pathString = util.nextArg()
-        console.log('Ignoring path: ' + pathString)
-        ignoreGroupByPathString(curPlaylist, pathString)
+        console.log("Ignoring path: " + pathString)
+        removeGroupByPathString(curPlaylist, pathString)
       },
 
-      'i': util => util.alias('-ignore'),
+      'r': util => util.alias('-remove'),
+      'x': util => util.alias('-remove'),
 
       '-list-groups': function(util) {
         // --list-groups  (alias: -l, --list)
@@ -127,13 +128,6 @@ readFile('./playlist.json', 'utf-8')
 
       'np': util => util.alias('-no-play'),
 
-      '-debug-list': function(util) {
-        // --debug-list
-        // Prints out the JSON representation of the active playlist.
-
-        console.log(JSON.stringify(curPlaylist, null, 2))
-      },
-
       '-picker': function(util) {
         // --picker <shuffle|ordered>
         // Selects the mode that the song to play is picked.
@@ -141,19 +135,26 @@ readFile('./playlist.json', 'utf-8')
         // playlist.
 
         pickerType = util.nextArg()
+      },
+
+      '-debug-list': function(util) {
+        // --debug-list
+        // Prints out the JSON representation of the active playlist.
+
+        console.log(JSON.stringify(curPlaylist, null, 2))
       }
     })
 
     if (willPlay || (willPlay === null && shouldPlay)) {
       let picker
       if (pickerType === 'shuffle') {
-        console.log('Using shuffle picker')
+        console.log("Using shuffle picker.")
         picker = pickers.makeShufflePlaylistPicker(curPlaylist)
       } else if (pickerType === 'ordered') {
-        console.log('Using ordered picker')
+        console.log("Using ordered picker.")
         picker = pickers.makeOrderedPlaylistPicker(curPlaylist)
       } else {
-        console.error('Invalid picker type: ' + pickerType)
+        console.error("Invalid picker type: " + pickerType)
       }
 
       return loopPlay(picker)