tuanchris 1 месяц назад
Родитель
Сommit
04f1eb316f
3 измененных файлов с 22 добавлено и 0 удалено
  1. 12 0
      static/js/base.js
  2. 5 0
      static/js/index.js
  3. 5 0
      static/js/playlists.js

+ 12 - 0
static/js/base.js

@@ -155,6 +155,12 @@ function setModalVisibility(show, userAction = false) {
 }
 }
 let currentPreviewFile = null; // Track the current file for preview data
 let currentPreviewFile = null; // Track the current file for preview data
 
 
+// Global playback status for cross-file access
+window.currentPlaybackStatus = {
+    is_running: false,
+    current_file: null
+};
+
 function connectWebSocket() {
 function connectWebSocket() {
     if (ws) {
     if (ws) {
         ws.close();
         ws.close();
@@ -190,6 +196,12 @@ function connectWebSocket() {
                 }
                 }
                 lastUIUpdate = now;
                 lastUIUpdate = now;
 
 
+                // Update global playback status
+                window.currentPlaybackStatus = {
+                    is_running: data.data.is_running || false,
+                    current_file: data.data.current_file || null
+                };
+
                 // Update modal status with the full data
                 // Update modal status with the full data
                 syncModalControls(data.data);
                 syncModalControls(data.data);
                 
                 

+ 5 - 0
static/js/index.js

@@ -1054,6 +1054,11 @@ function setupPreviewPanelEvents(pattern) {
                 window.openPlayerPreviewModal();
                 window.openPlayerPreviewModal();
             }
             }
 
 
+            // Check if a pattern is currently running and show stopping message
+            if (window.currentPlaybackStatus?.is_running) {
+                showStatusMessage('Stopping current pattern...', 'info');
+            }
+
             // Get the selected pre-execution action
             // Get the selected pre-execution action
             const preExecutionInput = document.querySelector('input[name="preExecutionAction"]:checked');
             const preExecutionInput = document.querySelector('input[name="preExecutionAction"]:checked');
             const preExecution = preExecutionInput ? preExecutionInput.value : 'none';
             const preExecution = preExecutionInput ? preExecutionInput.value : 'none';

+ 5 - 0
static/js/playlists.js

@@ -1375,6 +1375,11 @@ async function runPlaylist() {
     const clearPattern = document.getElementById('clearPatternSelect').value;
     const clearPattern = document.getElementById('clearPatternSelect').value;
     const shuffle = document.getElementById('shuffleCheckbox')?.checked || false;
     const shuffle = document.getElementById('shuffleCheckbox')?.checked || false;
 
 
+    // Check if a pattern is currently running and show stopping message
+    if (window.currentPlaybackStatus?.is_running) {
+        showStatusMessage('Stopping current pattern...', 'info');
+    }
+
     try {
     try {
         const response = await fetch('/run_playlist', {
         const response = await fetch('/run_playlist', {
             method: 'POST',
             method: 'POST',