From ab3b7219e5e8c189fd99cf669548906a7d632f6b Mon Sep 17 00:00:00 2001 From: marcelveldt Date: Fri, 25 Oct 2019 00:37:05 +0200 Subject: [PATCH] small fixes --- music_assistant/http_streamer.py | 8 ++++---- music_assistant/musicproviders/qobuz.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/music_assistant/http_streamer.py b/music_assistant/http_streamer.py index f32925f1..412bc6ec 100755 --- a/music_assistant/http_streamer.py +++ b/music_assistant/http_streamer.py @@ -80,7 +80,7 @@ class HTTPStreamer(): # put chunk in buffer self.mass.create_task( buffer.write(audio_chunk), wait_for_result=True, - ignore_exception=BrokenPipeError) + ignore_exception=(BrokenPipeError,ConnectionResetError)) # all chunks received: streaming finished if cancelled.is_set(): LOGGER.debug("stream single track interrupted for track %s on player %s" % (queue_item.name, player.name)) @@ -88,7 +88,7 @@ class HTTPStreamer(): # indicate EOF if no more data self.mass.create_task( buffer.write_eof(), wait_for_result=True, - ignore_exception=BrokenPipeError) + ignore_exception=(BrokenPipeError,ConnectionResetError)) LOGGER.debug("stream single track finished for track %s on player %s" % (queue_item.name, player.name)) def __get_queue_stream(self, player, buffer, cancelled): @@ -116,12 +116,12 @@ class HTTPStreamer(): break if chunk and not cancelled.is_set(): self.mass.create_task(buffer.write(chunk), - wait_for_result=True, ignore_exception=BrokenPipeError) + wait_for_result=True, ignore_exception=(BrokenPipeError,ConnectionResetError)) del chunk # indicate EOF if no more data if not cancelled.is_set(): self.mass.create_task(buffer.write_eof(), - wait_for_result=True, ignore_exception=BrokenPipeError) + wait_for_result=True, ignore_exception=(BrokenPipeError,ConnectionResetError)) # start fill buffer task in background fill_buffer_thread = threading.Thread(target=fill_buffer) fill_buffer_thread.start() diff --git a/music_assistant/musicproviders/qobuz.py b/music_assistant/musicproviders/qobuz.py index 25166cce..b1c850da 100644 --- a/music_assistant/musicproviders/qobuz.py +++ b/music_assistant/musicproviders/qobuz.py @@ -17,7 +17,7 @@ from ..app_vars import get_app_var from ..models import MusicProvider, MediaType, TrackQuality, \ AlbumType, Artist, Album, Track, Playlist from ..constants import CONF_USERNAME, CONF_PASSWORD, CONF_ENABLED, \ - CONF_TYPE_PASSWORD, EVENT_PLAYBACK_STARTED, EVENT_PLAYBACK_STOPPED + CONF_TYPE_PASSWORD, EVENT_STREAM_STARTED, EVENT_PLAYBACK_STOPPED PROV_ID = 'qobuz' PROV_NAME = 'Qobuz' @@ -50,7 +50,7 @@ class QobuzProvider(MusicProvider): self.http_session = aiohttp.ClientSession( loop=self.mass.event_loop, connector=aiohttp.TCPConnector()) self.throttler = Throttler(rate_limit=2, period=1) - await self.mass.add_event_listener(self.mass_event, EVENT_PLAYBACK_STARTED) + await self.mass.add_event_listener(self.mass_event, EVENT_STREAM_STARTED) await self.mass.add_event_listener(self.mass_event, EVENT_PLAYBACK_STOPPED) async def search(self, searchstring, media_types=List[MediaType], limit=5): @@ -283,7 +283,7 @@ class QobuzProvider(MusicProvider): if not self.__user_auth_info: return # TODO: need to figure out if the streamed track is purchased by user - if msg == EVENT_PLAYBACK_STARTED and msg_details["provider"] == self.prov_id: + if msg == EVENT_STREAM_STARTED and msg_details["provider"] == self.prov_id: # report streaming started to qobuz device_id = self.__user_auth_info["user"]["device"]["id"] credential_id = self.__user_auth_info["user"]["credential"]["id"] -- 2.34.1