« get me outta code hell

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:
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.