Commands module#

High-level commands used by the pyTermite CLI.

Convenience helpers that operate on sets of connected WiredConnection objects to retrieve camera information, status and control (start/stop recording).

async pytermite.commands.camera_shutter(connected_gopros: set[WiredConnection], mode: str = 'start') None[source]#

Start or stop recording on all connected GoPro cameras.

This issues HTTP requests to the camera REST endpoint to trigger shutter actions. It performs the requests concurrently using an aiohttp session.

Parameters:
  • connected_gopros (set[WiredConnection]) – A set of active WiredConnection objects representing connected cameras.

  • mode ({"start", "stop"}, optional) – Whether to start or stop recording. Default is “start”.

Raises:

RuntimeError – If no connected GoPro cameras are passed in.

async pytermite.commands.get_camera_info(connected_gopros: set[WiredConnection]) dict[str, dict][source]#

Fetch camera information from connected GoPro devices.

Parameters:

connected_gopros (set[WiredConnection]) – Set of active WiredConnection objects representing connected cameras.

Returns:

Mapping from camera name to a serializable dictionary of camera info.

Return type:

dict[str, dict]

async pytermite.commands.get_camera_status(connected_gopros: set[WiredConnection]) dict[str, dict][source]#

Fetch the runtime state for each connected GoPro.

Parameters:

connected_gopros (set[WiredConnection]) – A set of active WiredConnection objects representing connected cameras.

Returns:

Mapping from camera name to a serializable dictionary containing camera state.

Return type:

dict[str, dict]

async pytermite.commands.get_preset_status(connected_gopros: set[WiredConnection]) dict[str, dict][source]#

Retrieve preset configuration for each connected GoPro.

Parameters:

connected_gopros (set[WiredConnection]) – A set of active WiredConnection objects representing connected cameras.

Returns:

Mapping from camera name to a serializable dictionary describing presets.

Return type:

dict[str, dict]

Notes

The OpenGoPro library’s preset status retrieval is currently not working as expected; this function performs a manual HTTP GET request against the camera’s REST endpoint as a workaround.