1
0
mirror of https://github.com/natekspencer/hacs-oasis_mini.git synced 2025-12-06 18:44:14 -05:00

Address PR comments

This commit is contained in:
Nathan Spencer
2025-11-26 21:36:23 +00:00
parent fb360be616
commit 7d7675dcb1

View File

@@ -654,7 +654,7 @@ class OasisDevice:
Accepts a single track ID or an iterable of track IDs, stops the device, Accepts a single track ID or an iterable of track IDs, stops the device,
replaces the playlist, and resumes playback based on the `start_playing` replaces the playlist, and resumes playback based on the `start_playing`
parameter or, if unspecified, the devices prior playing state. parameter or, if unspecified, the device's prior playing state.
Parameters: Parameters:
playlist (int | Iterable[int]): playlist (int | Iterable[int]):
@@ -666,12 +666,12 @@ class OasisDevice:
""" """
playlist = [playlist] if isinstance(playlist, int) else list(playlist) playlist = [playlist] if isinstance(playlist, int) else list(playlist)
if start_playing is None: if start_playing is None:
start_playing = self.status_code == STATUS_PLAYING and len(playlist) > 0 start_playing = self.status_code == STATUS_PLAYING
client = self._require_client() client = self._require_client()
await client.async_send_stop_command(self) # needed before replacing playlist await client.async_send_stop_command(self) # needed before replacing playlist
await client.async_send_set_playlist_command(self, playlist) await client.async_send_set_playlist_command(self, playlist)
if start_playing: if start_playing and len(playlist) > 0:
await client.async_send_play_command(self) await client.async_send_play_command(self)
async def async_set_repeat_playlist(self, repeat: bool) -> None: async def async_set_repeat_playlist(self, repeat: bool) -> None: