Sfoglia il codice sorgente

handle double play

tuanchris 1 mese fa
parent
commit
a43585be78
2 ha cambiato i file con 4 aggiunte e 4 eliminazioni
  1. 2 2
      main.py
  2. 2 2
      modules/core/playlist_manager.py

+ 2 - 2
main.py

@@ -1173,8 +1173,8 @@ async def run_theta_rho(request: ThetaRhoRequest, background_tasks: BackgroundTa
             raise HTTPException(status_code=400, detail="Connection not established")
         
         if pattern_manager.pattern_lock.locked():
-            logger.warning("Attempted to run a pattern while another is already running")
-            raise HTTPException(status_code=409, detail="Another pattern is already running")
+            logger.info("Another pattern is running, stopping it first...")
+            await pattern_manager.stop_actions()
             
         files_to_run = [file_path]
         logger.info(f'Running theta-rho file: {request.file_name} with pre_execution={request.pre_execution}')

+ 2 - 2
modules/core/playlist_manager.py

@@ -116,8 +116,8 @@ def rename_playlist(old_name, new_name):
 async def run_playlist(playlist_name, pause_time=0, clear_pattern=None, run_mode="single", shuffle=False):
     """Run a playlist with the given options."""
     if pattern_manager.pattern_lock.locked():
-        logger.warning("Cannot start playlist: Another pattern is already running")
-        return False, "Cannot start playlist: Another pattern is already running"
+        logger.info("Another pattern is running, stopping it first...")
+        await pattern_manager.stop_actions()
 
     playlists = load_playlists()
     if playlist_name not in playlists: