« get me outta code hell

"Reverse all" / "Reverse order of groups" options - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
path: root/ui.js
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2019-07-22 14:58:40 -0300
committerFlorrie <towerofnix@gmail.com>2019-07-22 14:58:40 -0300
commit182514a1e8170d124907b982f5f87f1bffad147c (patch)
tree20c95e694791ea0a6a3b577b682d13e65cbb37d4 /ui.js
parent366da7740e4d07461572f1e56c51b3ecd8ad4bc9 (diff)
"Reverse all" / "Reverse order of groups" options
Diffstat (limited to 'ui.js')
-rw-r--r--ui.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/ui.js b/ui.js
index 2b88b3a..e73d8f5 100644
--- a/ui.js
+++ b/ui.js
@@ -20,6 +20,7 @@ const {
   isGroup,
   isTrack,
   parentSymbol,
+  reverseOrderOfGroups,
   searchForItem,
   shuffleOrderOfGroups
 } = require('./playlist-utils')
@@ -255,6 +256,8 @@ class AppElement extends FocusElement {
     this.orderControl = new InlineListPickerElement('Order?', [
       {value: 'shuffle', label: 'Shuffle all'},
       {value: 'shuffle-groups', label: 'Shuffle order of groups'},
+      {value: 'reverse', label: 'Reverse all'},
+      {value: 'reverse-groups', label: 'Reverse order of groups'},
       {value: 'normal', label: 'In order'}
     ])
 
@@ -934,6 +937,10 @@ class AppElement extends FocusElement {
         item = {items: shuffleArray(flattenGrouplike(item).items)}
       } else if (order === 'shuffle-groups') {
         item = shuffleOrderOfGroups(item)
+      } else if (order === 'reverse') {
+        item = {items: flattenGrouplike(item).items.reverse()}
+      } else if (order === 'reverse-groups') {
+        item = reverseOrderOfGroups(item)
       }
     } else {
       // Make it into a grouplike that just contains itself.