ensure that named pipes are created
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Fri, 31 Oct 2025 14:31:40 +0000 (15:31 +0100)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Fri, 31 Oct 2025 14:31:40 +0000 (15:31 +0100)
music_assistant/providers/airplay/protocols/_protocol.py

index d2e470c1d953d75b328c9fc77ce35ad72622921c..1cfc95ff4340a9f0810ce511da6a6c631319925c 100644 (file)
@@ -106,6 +106,10 @@ class AirPlayProtocol(ABC):
 
     async def _open_pipes(self) -> None:
         """Open both named pipes in non-blocking mode for async I/O."""
+        # Create named pipes first if they don't exist
+        await asyncio.to_thread(self._create_named_pipe, self.audio_named_pipe)
+        await asyncio.to_thread(self._create_named_pipe, self.commands_named_pipe)
+
         # Open audio pipe with buffer size optimization
         self._audio_pipe = AsyncNamedPipeWriter(self.audio_named_pipe, logger=self.player.logger)
         await self._audio_pipe.open(increase_buffer=True)
@@ -118,6 +122,11 @@ class AirPlayProtocol(ABC):
 
         self.player.logger.debug("Named pipes opened in non-blocking mode for streaming session")
 
+    def _create_named_pipe(self, pipe_path: str) -> None:
+        """Create a named pipe (FIFO) if it doesn't exist."""
+        if not os.path.exists(pipe_path):
+            os.mkfifo(pipe_path)
+
     async def stop(self) -> None:
         """Stop playback and cleanup."""
         # Send stop command before setting _stopped flag