Просмотр исходного кода

add requirement, display current speed

Tuan Nguyen 11 месяцев назад
Родитель
Сommit
2011e904b2

+ 2 - 1
dune_weaver_flask/modules/core/pattern_manager.py

@@ -344,5 +344,6 @@ def get_status():
         "execution_progress": state.execution_progress,
         "current_playing_index": state.current_playlist_index,
         "current_playlist": state.current_playlist,
-        "is_clearing": state.is_clearing
+        "is_clearing": state.is_clearing,
+        "current_speed": state.speed
     }

+ 7 - 0
dune_weaver_flask/static/js/main.js

@@ -1466,6 +1466,13 @@ async function updateCurrentlyPlaying() {
             return;
         }
 
+        const currentSpeedElem = document.getElementById('current_speed_display');
+        if (data.current_speed !== undefined) {
+            currentSpeedElem.textContent = `Current Speed: ${data.current_speed}`;
+        } else {
+            currentSpeedElem.textContent = 'Current Speed: N/A';
+        }
+
         if (data.current_playing_file && !data.stop_requested) {
             const { current_playing_file, execution_progress, pause_requested } = data;
 

+ 3 - 0
dune_weaver_flask/templates/index.html

@@ -288,6 +288,9 @@
             </div>
             <div class="control-group">
                 <h3>Speed</h3>
+                <div class="item">
+                    <span id="current_speed_display">Current Speed: 0</span>
+                </div>
                 <div class="item">
                     <input type="number" id="speed_input" placeholder="1-100" min="1" step="1" max="100">
                 </div>

+ 2 - 1
requirements.txt

@@ -3,4 +3,5 @@ pyserial
 esptool
 tqdm
 paho-mqtt
-python-dotenv
+python-dotenv
+websocket-client