Update http_streamer.py
authormarcelveldt <marcelvanderveldt@MacBook-Silvia.local>
Sun, 20 Oct 2019 13:22:24 +0000 (15:22 +0200)
committermarcelveldt <marcelvanderveldt@MacBook-Silvia.local>
Sun, 20 Oct 2019 13:22:24 +0000 (15:22 +0200)
music_assistant/http_streamer.py

index 2300a327ab29f0c485a6ab601d08a6441de3eeb9..f25325e0a189c2e8bde7cc2621c03e9e6bf685d6 100755 (executable)
@@ -70,12 +70,18 @@ class HTTPStreamer():
         try:
             while not cancelled.is_set():
                 await asyncio.sleep(0.1)
-        except (asyncio.CancelledError, asyncio.TimeoutError):
-            LOGGER.warning("stream interrupted")
+        except (asyncio.CancelledError):
+            LOGGER.warning("stream cancelled")
             cancelled.set()
             # wait for bg_task to finish
             await asyncio.gather(bg_task)
             raise asyncio.CancelledError()
+        except (asyncio.TimeoutError):
+            LOGGER.warning("stream time-out")
+            cancelled.set()
+            # wait for bg_task to finish
+            await asyncio.gather(bg_task)
+            raise asyncio.TimeoutError()
         return resp
     
     async def __stream_single(self, player, queue_item, buffer, cancelled):