« 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--telnet-server.js1
-rw-r--r--ui.js11
2 files changed, 9 insertions, 3 deletions
diff --git a/telnet-server.js b/telnet-server.js
index 93b4a5b..cda3323 100644
--- a/telnet-server.js
+++ b/telnet-server.js
@@ -29,6 +29,7 @@ class TelnetServer {
       appConfig: {
         canControlPlayback: false,
         canControlQueue: false,
+        canProcessMetadata: false,
         canSuspend: false,
         showLeftPane: true,
         stopPlayingUponQuit: false,
diff --git a/ui.js b/ui.js
index 766b4eb..0a1cbca 100644
--- a/ui.js
+++ b/ui.js
@@ -145,6 +145,7 @@ class AppElement extends FocusElement {
     this.config = Object.assign({
       canControlPlayback: true,
       canControlQueue: true,
+      canProcessMetadata: true,
       canSuspend: true,
       menubarColor: 4, // blue
       showLeftPane: true,
@@ -532,7 +533,7 @@ class AppElement extends FocusElement {
 
     const { item, isGroup, isMarked } = el
     const { editMode } = this
-    const { canControlQueue } = this.config
+    const { canControlQueue, canProcessMetadata } = this.config
     const anyMarked = editMode && this.markGrouplike.items.length > 0
 
     let items;
@@ -577,8 +578,8 @@ class AppElement extends FocusElement {
         canControlQueue && {label: 'Queue!', action: emitControls(false)},
         {divider: true},
 
-        {label: 'Process metadata (new entries)', action: () => this.processMetadata(item, false)},
-        {label: 'Process metadata (reprocess)', action: () => this.processMetadata(item, true)},
+        canProcessMetadata && {label: 'Process metadata (new entries)', action: () => this.processMetadata(item, false)},
+        canProcessMetadata && {label: 'Process metadata (reprocess)', action: () => this.processMetadata(item, true)},
         canControlQueue && {label: 'Remove from queue', action: () => this.unqueue(item)}
       ]
     }
@@ -868,6 +869,10 @@ class AppElement extends FocusElement {
   }
 
   async processMetadata(item) {
+    if (!this.config.canProcessMetadata) {
+      return
+    }
+
     if (this.clearMetadataStatusTimeout) {
       clearTimeout(this.clearMetadataStatusTimeout)
     }