Skip to content

Commit

Permalink
weird airplay hussle issue
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt committed Jul 19, 2024
1 parent 32a77a8 commit 4551add
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions music_assistant/server/providers/airplay/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,11 @@ async def stop(self):
"""Stop playback and cleanup."""
if self._stopped:
return
if self.audio_source_task and not self.audio_source_task.done():
self.audio_source_task.cancel()
if self._cliraop_proc.proc and not self._cliraop_proc.closed:
await self.send_cli_command("ACTION=STOP")
self._stopped = True # set after send_cli command!
if self.audio_source_task and not self.audio_source_task.done():
self.audio_source_task.cancel()
if self._cliraop_proc.proc:
try:
await asyncio.wait_for(self._cliraop_proc.wait(), 5)
Expand Down Expand Up @@ -642,8 +642,8 @@ async def play_media(
# always stop existing stream first
async with TaskManager(self.mass) as tg:
for airplay_player in self._get_sync_clients(player_id):
if airplay_player.active_stream and airplay_player.active_stream:
tg.create_task(airplay_player.active_stream.stop())
if active_stream := airplay_player.active_stream:
tg.create_task(active_stream.stop())
# select audio source
if media.media_type == MediaType.ANNOUNCEMENT:
# special case: stream announcement
Expand Down

0 comments on commit 4551add

Please sign in to comment.