Skip to content

Commit

Permalink
Add a command for listing the configured caspar servers
Browse files Browse the repository at this point in the history
Signed-off-by: Axel Boberg <[email protected]>
  • Loading branch information
axelboberg committed Jan 12, 2024
1 parent c721084 commit 5954aee
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
13 changes: 13 additions & 0 deletions plugins/caspar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ Enables communication with Caspar CG and provides caspar-specific type options t
## API
This plugin exposes a number of commands that can be invoked using the commands api.

### `caspar.listServers()`
Add a new server to the workspace and returns
its id for further reference

**Example**
```javascript
/*
Variable 'servers' gets defined as
an array of server descriptor objects
*/
const servers = await bridge.commands.executeCommand('caspar.listServers')
```

### `caspar.addServer(serverDescription)`
Add a new server to the workspace and returns
its id for further reference
Expand Down
10 changes: 10 additions & 0 deletions plugins/caspar/lib/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,16 @@ async function editServer (serverId, description) {
exports.editServer = editServer
bridge.commands.registerCommand('caspar.editServer', editServer)

/**
* Get a list of all configured servers
* @returns { Promise.<ServerDescription[]> }
*/
async function listServers () {
return (await bridge.state.get(`${paths.STATE_SETTINGS_PATH}.servers`)) || []
}
exports.listServers = listServers
bridge.commands.registerCommand('caspar.listServers', listServers)

/**
* Reconnect a server using
* a new connection init
Expand Down

0 comments on commit 5954aee

Please sign in to comment.