Skip to content

Commit

Permalink
Major: Update for Companion v3 (#12)
Browse files Browse the repository at this point in the history
* Rewrite for Companion v3

* wip: upgrades

* Fix: Upgrades now functional

* Fix: proper operation mode handling

* Update README.md
  • Loading branch information
bryce-seifert committed Feb 22, 2023
1 parent 8c9db4d commit 14071ad
Show file tree
Hide file tree
Showing 15 changed files with 2,938 additions and 322 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules/
package-lock.json
.DS_Store
/pkg
/pkg.tgz
19 changes: 0 additions & 19 deletions HELP.md

This file was deleted.

15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# companion-module-birddog-studio
# companion-module-birddog-converters

Module to control BirdDog Studio and Mini.
This module allows you to control BirdDog NDI encoders and decoders.

For more info take a look at the file: "Help.MD" and LICENSE
For more info take a look at the file: [HELP.md](./companion/HELP.md) and LICENSE

## Changes
## Changelog

### v2.0.0

- Major
- Updated for Companion v3 compatibility
- Updated to the new BirDog API 2.0.
- _Note: this is a substantially different API, so there may be breaking changes with your previous setup. This also requires your converter updated to the latest LTS firmware or newer._

### v1.0.1

Expand Down
121 changes: 58 additions & 63 deletions actions.js
Original file line number Diff line number Diff line change
@@ -1,80 +1,75 @@
exports.getActions = function () {
export function getActions() {
return {
changeNDISource: {
label: 'Change Decode Source',
changeDecodeSource: {
name: 'Change Decode Source',
options: [
{
type: 'dropdown',
label: 'Source',
id: 'source',
choices:
this.api.sourceList?.length > 1
? this.api.sourceList
: [{ id: 'No sources found', label: 'No sources found' }],
default: this.api.sourceList?.length > 1 ? this.api.sourceList[0].id : 'No sources found',
choices: this.device.list,
default: 'None',
allowCustom: true,
},
],
callback: (action) => {
this.sendCommand('connectTo', 'POST', { sourceName: action.options.source })
},
},
changeNDISourceIP: {
label: 'Change Decode Source by IP',
cycleSource: {
name: 'Jump to Next/Previous Decode Source',
description: 'Moves between available NDI decode sources',
options: [
{
type: 'textinput',
label: 'NDI Source Name',
id: 'ndiSource',
width: 12,
regex: this.REGEX_TEXT,
},
{
type: 'textinput',
label: 'NDI Source IP',
id: 'ndiSourceIp',
width: 8,
default: '127.0.0.1',
regex: this.REGEX_IP,
},
{
type: 'number',
label: 'NDI Source Port',
id: 'ndiSourcePort',
width: 3,
regex: this.REGEX_PORT,
min: 1,
max: 65535,
default: 5961,
type: 'dropdown',
label: 'Action',
id: 'jump',
choices: [
{ id: 'next', label: 'Next' },
{ id: 'previous', label: 'Previous' },
],
default: 'next',
},
],
callback: async (action) => {
let modifier = action.options.jump === 'next' ? 1 : -1
let current = this.device.decodeSource
let newIndex = 0
if (current) {
let currentIndex = await this.device.list.findIndex((x) => x.id === current)
if (currentIndex > -1) {
newIndex = currentIndex + modifier
if (newIndex > -1) {
let source = this.device.list[newIndex]
if (source) {
this.sendCommand('connectTo', 'POST', { sourceName: this.device.list[newIndex].id })
}
}
}
}
},
},
refreshNDISourceList: {
label: 'Refresh NDI Source List',
refreshSourceList: {
name: 'Refresh NDI Source List',
options: [],
callback: () => {
this.sendCommand('refresh', 'GET')
this.sendCommand('List', 'GET')
},
},
reboot: {
name: 'Reboot Device',
options: [],
callback: () => {
this.sendCommand('reboot', 'GET')
},
},
restart: {
name: 'Restart Video',
options: [],
callback: () => {
this.sendCommand('restart', 'GET')
},
},
}
}

exports.executeAction = function (action) {
if (action.action === 'changeNDISource') {
if (action.options.source != undefined && action.options.source != 'No sources found') {
let urlSplit = this.api.sourceList[action.options.source].split(':')
let ip = urlSplit[0]
let port = urlSplit[1]
let name = action.options.source
this.api.setNDIDecodeSource(ip, port, name)
} else {
this.log(
'error',
'Unable to find the configured NDI source. Please check the NDI source info in the action configuration'
)
}
} else if (action.action === 'changeNDISourceIP') {
if (action.options.ndiSource && action.options.ndiSourceIp && action.options.ndiSourcePort) {
this.api.setNDIDecodeSource(action.options.ndiSourceIp, action.options.ndiSourcePort, action.options.ndiSource)
} else {
this.log(
'error',
'Unable to find the configured NDI source. Please check the NDI source info in the action configuration'
)
}
} else if (action.action === 'refreshNDISourceList') {
this.api.getSourceList()
}
}
145 changes: 0 additions & 145 deletions birddogapi.js

This file was deleted.

29 changes: 29 additions & 0 deletions companion/HELP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## BirdDog Converters

This module allows you to control BirdDog NDI encoders and decoders.

### Requirements

- BirdDog converter running the latest NDI 5 firmware version

### Configuration

- Enter the IP address or hostname of the BirdDog device in the module settings

### Available actions

- Change Decode Source
- _Note: when using custom sources, you must include the full name (ex. `PTZ-1 (CAM)` instead of `PTZ-1`)_
- Refresh NDI Source List
- Jump to Next/Previous Decode Source
- Reboot Device
- Restart Video System

### Available variables

- decode_source
- current_mode
- video_format
- video_resolution
- video_framerate
- source_status
26 changes: 26 additions & 0 deletions companion/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"id": "birddog-converters",
"name": "birddog-converters",
"shortname": "BirdDog NDI",
"description": "BirdDog Converters module for Companion",
"version": "2.0.0",
"license": "MIT",
"repository": "git+https://github.com/bitfocus/companion-module-birddog-studio.git",
"bugs": "https://github.com/bitfocus/companion-module-birddog-studio/issues",
"maintainers": [
{
"name": "Bryce Seifert",
"email": "bryceapps@icloud.com"
}
],
"legacyIds": ["birddog-studio"],
"runtime": {
"type": "node18",
"api": "nodejs-ipc",
"apiVersion": "0.0.0",
"entrypoint": "../index.js"
},
"manufacturer": "BirdDog",
"products": ["Converters"],
"keywords": ["NDI", "Video"]
}
Loading

0 comments on commit 14071ad

Please sign in to comment.