Skip to content

Commit bf1b0ff

Browse files
committed
Improved documentation and made minor changes
1 parent 42bfdfe commit bf1b0ff

File tree

5 files changed

+61
-14
lines changed

5 files changed

+61
-14
lines changed

docs/api/commands.rst

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
11
Commands
22
========
33

4-
.. automodule:: goxlr.commands.general
5-
:members:
6-
:undoc-members:
4+
Daemon
5+
------
6+
7+
Used to control the daemon.
78

89
.. automodule:: goxlr.commands.daemon
910
:members:
1011
:undoc-members:
1112

13+
GoXLR
14+
-----
15+
16+
Used to set values on the GoXLR device.
17+
1218
.. automodule:: goxlr.commands.goxlr
19+
:members:
20+
:undoc-members:
21+
22+
Status
23+
------
24+
25+
Used to retrieve data from the daemon.
26+
27+
.. automodule:: goxlr.commands.status
1328
:members:
1429
:undoc-members:

docs/api/types.rst

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1-
Enumerators
2-
===========
1+
Models
2+
======
33

4-
.. automodule:: goxlr.types
4+
Enumerations
5+
------------
6+
7+
Used in the API to represent a set of possible values for a given field.
8+
9+
.. automodule:: goxlr.types.enums
10+
:members:
11+
:undoc-members:
12+
13+
Dataclasses
14+
-----------
15+
16+
Used in this library to represent the data returned by the API.
17+
18+
.. automodule:: goxlr.types.models
519
:members:
620
:undoc-members:

goxlr/commands/goxlr.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ async def __send_command(self, payload, serial=None):
99
payload = {"Command": [serial or self.serial, payload]}
1010
return await self.send(payload)
1111

12-
async def set_shutdown_commands(self, *methods):
12+
async def set_shutdown_commands(self, *methods) -> dict | str:
1313
"""
1414
Set the commands to be executed when the GoXLR is shutting down.
1515
Commands are accepted as a list of lists, where the first item is
@@ -19,12 +19,12 @@ async def set_shutdown_commands(self, *methods):
1919
:param methods: A list of methods to be executed when the GoXLR is shutting down.
2020
:type methods: list
2121
:return: The response from the GoXLR.
22-
:rtype: dict or str
2322
2423
:Example:
2524
2625
>>> await xlr.set_shutdown_commands(
27-
... ["SetFader", FaderName.A, ChannelName.Headphones]
26+
... ["SetFader", Fader.A, Channel.Headphones],
27+
... ["SetFader", Fader.B, Channel.Chat]
2828
... )
2929
"""
3030

goxlr/commands/status.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ def __init__(self):
1414

1515
async def get_status(self) -> Status:
1616
"""
17-
Returns the status of the GoXLR. `GoXLR.update()` should be used instead.
17+
Returns the status of the GoXLR.
1818
1919
:return: The status of the GoXLR.
2020
2121
:raises DaemonError: If the status could not be retrieved.
22+
23+
:note: You should use GoXLR.update() instead of this method.
2224
"""
2325
status = await self.send("GetStatus")
2426

goxlr/socket.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,14 @@ async def receive(self, id=None):
8585
If no ID is specified, it will wait for the first response and will
8686
not add it to the queue.
8787
88-
To specifically wait for a heartbeat response, specify an ID of 0.
89-
To specifically wait for a patch response, specify an ID of 2**64 - 1.
88+
To wait for a heartbeat response, specify an ID of 0.
89+
To wait for a patch response, specify an ID of 2**64 - 1.
9090
9191
:param id: The ID of the response to wait for.
9292
9393
:return: The response from the daemon.
94+
95+
:raises: `DaemonError` if the daemon returns an error.
9496
"""
9597
if not id:
9698
response = await self.socket.recv()
@@ -169,10 +171,17 @@ async def ping(self):
169171

170172
async def update(self):
171173
"""
172-
Gets the latest data from the GoXLR Utility daemon and
173-
updates the status and mixers attributes.
174+
Gets the latest data from the GoXLR Utility daemon and updates the status
175+
and mixers attributes.
174176
175177
:return: The status of the daemon.
178+
179+
:raises DaemonError: If the daemon is not running.
180+
:raises MixerNotFoundError: If the specified mixer is not found.
181+
182+
:note: This method is automatically called when the class is instantiated.
183+
You should manually call this method periodically to ensure that the data
184+
is up to date.
176185
"""
177186
self.status = await self.get_status()
178187

@@ -189,6 +198,9 @@ def select_mixer(self, serial: str = None):
189198
If not specified, it will default to the first mixer.
190199
191200
:return: The selected mixer.
201+
202+
:raises DaemonError: If no mixers are found.
203+
:raises MixerNotFoundError: If the specified mixer is not found.
192204
"""
193205

194206
# set self.serial to serial if specified. if None, default to first mixer
@@ -209,6 +221,10 @@ def select_mixer(self, serial: str = None):
209221
async def connect(self):
210222
"""
211223
Connects to the GoXLR Utility daemon and gets the latest data.
224+
225+
:return: True if the connection was successful, False otherwise.
226+
227+
:raises DaemonError: If no mixers are found.
212228
"""
213229
connected = await super().connect()
214230
if connected:

0 commit comments

Comments
 (0)