Skip to content

Commit 71ad5fa

Browse files
balloobclaude
andauthored
Bump aiosendspin 3 (#83)
aiosendspin 3.0 https://github.com/Sendspin/aiosendspin/releases/tag/3.0.0 Fixes #74 Fixes #75 --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent bf26012 commit 71ad5fa

4 files changed

Lines changed: 15 additions & 9 deletions

File tree

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ classifiers = [
1414
"Programming Language :: Python :: 3.13",
1515
]
1616
dependencies = [
17-
"aiosendspin~=2.1",
17+
"aiosendspin~=3.0",
1818
"aiosendspin-mpris~=2.1",
1919
"av>=14.0.0",
2020
"numpy>=1.24.0",

‎sendspin/audio.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from sounddevice import CallbackFlags
2525

2626
if TYPE_CHECKING:
27-
from aiosendspin.client import PCMFormat
27+
from aiosendspin.client import AudioFormat, PCMFormat
2828

2929
logger = logging.getLogger(__name__)
3030

@@ -264,13 +264,14 @@ def __init__(
264264
# Thread-safe flag for deferred operations (audio thread → main thread)
265265
self._clear_requested: bool = False
266266

267-
def set_format(self, pcm_format: PCMFormat, device: AudioDevice) -> None:
267+
def set_format(self, audio_format: AudioFormat, device: AudioDevice) -> None:
268268
"""Configure the audio output format.
269269
270270
Args:
271271
pcm_format: PCM audio format specification.
272272
device: Audio device to use.
273273
"""
274+
pcm_format = audio_format.pcm_format
274275
self._format = pcm_format
275276
self._close_stream()
276277

‎sendspin/audio_connector.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from sendspin.audio import AudioDevice, AudioPlayer
1414

1515
if TYPE_CHECKING:
16-
from aiosendspin.client import PCMFormat, SendspinClient
16+
from aiosendspin.client import AudioFormat, SendspinClient
1717

1818
logger = logging.getLogger(__name__)
1919

@@ -45,7 +45,7 @@ def __init__(
4545
self._muted = muted
4646
self._client: SendspinClient | None = None
4747
self.audio_player: AudioPlayer | None = None
48-
self._current_format: PCMFormat | None = None
48+
self._current_format: AudioFormat | None = None
4949

5050
def set_volume(self, volume: int, *, muted: bool) -> None:
5151
"""Set the volume and muted state.
@@ -80,7 +80,9 @@ def attach_client(self, client: SendspinClient) -> list[Callable[[], None]]:
8080
client.add_stream_clear_listener(self._on_stream_clear),
8181
]
8282

83-
def _on_audio_chunk(self, server_timestamp_us: int, audio_data: bytes, fmt: PCMFormat) -> None:
83+
def _on_audio_chunk(
84+
self, server_timestamp_us: int, audio_data: bytes, fmt: AudioFormat
85+
) -> None:
8486
"""Handle incoming audio chunks."""
8587
assert self._client is not None, "Received audio chunk but client is not attached"
8688

‎sendspin/serve/__init__.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def handle_sigint() -> None:
110110
with suppress(NotImplementedError):
111111
event_loop.add_signal_handler(signal.SIGINT, handle_sigint)
112112

113-
async def on_server_event(server: SendspinServer, event: SendspinEvent) -> None:
113+
def on_server_event(server: SendspinServer, event: SendspinEvent) -> None:
114114
nonlocal active_group
115115

116116
if isinstance(event, ClientAddedEvent):
@@ -124,7 +124,7 @@ async def on_server_event(server: SendspinServer, event: SendspinEvent) -> None:
124124
client_connected.set()
125125
return
126126

127-
await active_group.add_client(client)
127+
create_task(active_group.add_client(client))
128128

129129
if isinstance(event, ClientRemovedEvent):
130130
if active_group is None:
@@ -163,7 +163,7 @@ async def on_server_event(server: SendspinServer, event: SendspinEvent) -> None:
163163
for client_url in config.clients:
164164
try:
165165
print(f"Connecting to client: {client_url}")
166-
server.connect_to_client(client_url)
166+
await server.connect_to_client(client_url)
167167
except Exception as e:
168168
logger.warning("Failed to connect to client %s: %s", client_url, e)
169169
print(f"Warning: Failed to connect to client {client_url}: {e}")
@@ -205,6 +205,9 @@ async def on_server_event(server: SendspinServer, event: SendspinEvent) -> None:
205205
await play_media_task
206206
except asyncio.CancelledError:
207207
pass
208+
except FileNotFoundError as e:
209+
print(f"Error: {e}")
210+
return 1
208211
except Exception as e:
209212
print(f"Playback error: {e}")
210213
logger.debug("Playback error", exc_info=True)

0 commit comments

Comments
 (0)