From: Santiago Soto Date: Wed, 19 Jun 2024 22:57:33 +0000 (-0300) Subject: Snapcast fix sync and unsync many (#1385) X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=13c97b70fddccd0fff0f1f868fbc3dc347a19ebf;p=music-assistant-server.git Snapcast fix sync and unsync many (#1385) --- diff --git a/music_assistant/server/models/player_provider.py b/music_assistant/server/models/player_provider.py index 3d2fec59..6fc2dace 100644 --- a/music_assistant/server/models/player_provider.py +++ b/music_assistant/server/models/player_provider.py @@ -2,7 +2,6 @@ from __future__ import annotations -import asyncio from abc import abstractmethod from collections.abc import Iterable @@ -227,10 +226,9 @@ class PlayerProvider(Provider): async def cmd_sync_many(self, target_player: str, child_player_ids: list[str]) -> None: """Create temporary sync group by joining given players to target player.""" - # default implementation, simply call the cmd_sync for all child players - async with asyncio.TaskGroup() as tg: - for child_player_id in child_player_ids: - tg.create_task(self.cmd_sync(child_player_id, target_player)) + for child_id in child_player_ids: + # default implementation, simply call the cmd_sync for all child players + await self.cmd_sync(child_id, target_player) async def cmd_unsync_many(self, player_ids: str) -> None: """Handle UNSYNC command for all the given players. @@ -239,10 +237,9 @@ class PlayerProvider(Provider): - player_id: player_id of the player to handle the command. """ - # default implementation, simply call the cmd_sync for all player_ids - async with asyncio.TaskGroup() as tg: - for player_id in player_ids: - tg.create_task(self.cmd_unsync(player_id)) + for player_id in player_ids: + # default implementation, simply call the cmd_sync for all player_ids + await self.cmd_unsync(player_id) async def create_group(self, name: str, members: list[str]) -> Player: """Create new PlayerGroup on this provider.