Skip to content

Commit 4d90bab

Browse files
feat: guest in scene feedback / variable (#30)
* feat: add guest in scene feedback * feat: add variable for scenes guest is in * chore: version up * chore: update dependencies * change format to allow for named scenes * chore: format
1 parent 3aff4f2 commit 4d90bab

File tree

8 files changed

+577
-1396
lines changed

8 files changed

+577
-1396
lines changed

.github/workflows/companion-module-checks.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@ jobs:
1515
uses: bitfocus/actions/.github/workflows/module-checks.yaml@main
1616
# with:
1717
# upload-artifact: true # uncomment this to upload the built package as an artifact to this workflow that you can download and share with others
18-

actions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export function getActions() {
158158
this.sendRequest(
159159
'bitrate',
160160
null,
161-
action.options.value === 'custom' ? action.options.bitrate : action.options.value
161+
action.options.value === 'custom' ? action.options.bitrate : action.options.value,
162162
)
163163
},
164164
},

companion/HELP.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@ Control [VDO.Ninja](https://vdo.ninja) settings remotely.
6262
- Mic Status
6363
- Camera Status
6464
- Speaker Status
65+
- Guest in Scene
6566

6667
### Available Variables
6768

6869
- mic (Current mute status, either by stream ID or guest position)
6970
- camera (Current camera status, either by stream ID or guest position)
7071
- speaker (Available for the "Director" role only)
7172
- label (If specified, otherwise it will be the guest position number)
73+
- scenes (List of scenes a guest is currently active in)

companion/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "vdo-ninja",
44
"shortname": "VDO.Ninja",
55
"description": "vdo-ninja",
6-
"version": "2.2.2",
6+
"version": "0.0.0",
77
"license": "MIT",
88
"repository": "git+https://github.com/bitfocus/companion-module-vdo-ninja.git",
99
"bugs": "https://github.com/bitfocus/companion-module-vdo-ninja/issues",

feedbacks.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,40 @@ export function getFeedbacks() {
125125
return this.states[feedback.options.stream]?.speakerMuted === feedback.options.state
126126
},
127127
}
128+
feedbacks['guestScene'] = {
129+
type: 'boolean',
130+
name: 'Guest in Scene',
131+
description: 'If a stream is active the selected scene, change the style of the button',
132+
options: [
133+
{
134+
type: 'dropdown',
135+
label: 'Stream',
136+
id: 'stream',
137+
allowCustom: true,
138+
default: this.streams[0]?.id,
139+
choices: this.streams,
140+
},
141+
{
142+
type: 'textinput',
143+
label: 'Scene name or ID (0 to 8)',
144+
id: 'scene',
145+
default: '1',
146+
},
147+
],
148+
defaultStyle: {
149+
color: ColorWhite,
150+
bgcolor: ColorGreen,
151+
},
152+
callback: (feedback) => {
153+
let stream = this.states[feedback.options.stream]
154+
let scene = feedback.options.scene
155+
if (stream) {
156+
return stream?.scenes?.[scene] == true
157+
} else {
158+
return false
159+
}
160+
},
161+
}
128162

129163
return feedbacks
130164
}

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
{
22
"name": "vdo-ninja",
3-
"version": "2.2.2",
3+
"version": "2.3.0",
44
"main": "index.js",
55
"type": "module",
66
"scripts": {
77
"format": "prettier -w ."
88
},
99
"license": "MIT",
1010
"dependencies": {
11-
"@companion-module/base": "~1.8.0",
12-
"ws": "^8.17.1"
11+
"@companion-module/base": "~1.11.2",
12+
"ws": "^8.18.0"
1313
},
1414
"repository": {
1515
"type": "git",
1616
"url": "git+https://github.com/bitfocus/companion-module-vdo-ninja.git"
1717
},
1818
"devDependencies": {
19-
"@companion-module/tools": "^1.5.1"
19+
"@companion-module/tools": "^2.1.1",
20+
"prettier": "^3.4.2"
2021
},
2122
"prettier": "@companion-module/tools/.prettierrc.json"
2223
}

variables.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ export function getVariables() {
1414
variables.push({ variableId: `guest_${data.position}_mic`, name: `Guest ${data.position} ${name} - Mic` })
1515
variables.push({ variableId: `guest_${data.position}_camera`, name: `Guest ${data.position} ${name} - Camera` })
1616
variables.push({ variableId: `guest_${data.position}_label`, name: `Guest ${data.position} - Label` })
17+
variables.push({ variableId: `guest_${data.position}_scenes`, name: `Guest ${data.position} - Scenes` })
1718
}
1819
variables.push({ variableId: `${data.streamID}_mic`, name: `Stream ID: ${data.streamID} - Mic` })
1920
variables.push({ variableId: `${data.streamID}_camera`, name: `Stream ID: ${data.streamID} - Camera` })
2021
variables.push({ variableId: `${data.streamID}_label`, name: `Stream ID: ${data.streamID} - Label` })
22+
variables.push({ variableId: `${data.streamID}_scenes`, name: `Stream ID: ${data.streamID} - Scenes` })
2123
}
2224
}
2325
return variables
@@ -27,6 +29,15 @@ export function updateVariables() {
2729
for (let x in this.states) {
2830
let data = this.states[x]
2931
let label = data.label ? data.label : `Guest ${data.position}`
32+
let sceneList = []
33+
34+
if (data.scenes) {
35+
for (let scene in data.scenes) {
36+
if (data.scenes[scene] === true) {
37+
sceneList.push(scene)
38+
}
39+
}
40+
}
3041

3142
if (data.streamID) {
3243
if (data.director) {
@@ -41,12 +52,14 @@ export function updateVariables() {
4152
[`guest_${data.position}_mic`]: data.muted || data.others?.['mute-guest'] == 1 ? 'Muted' : 'Unmuted',
4253
[`guest_${data.position}_camera`]: data.videoMuted || data.others?.['hide-guest'] == 1 ? 'Muted' : 'Unmuted',
4354
[`guest_${data.position}_label`]: label,
55+
[`guest_${data.position}_scenes`]: sceneList?.length ? sceneList : 'None',
4456
})
4557
}
4658
this.setVariableValues({
4759
[`${data.streamID}_mic`]: data.muted || data.others?.['mute-guest'] == 1 ? 'Muted' : 'Unmuted',
4860
[`${data.streamID}_camera`]: data.videoMuted || data.others?.['hide-guest'] == 1 ? 'Muted' : 'Unmuted',
4961
[`${data.streamID}_label`]: label,
62+
[`${data.streamID}_scenes`]: sceneList?.length ? sceneList : 'None',
5063
})
5164
}
5265
}

0 commit comments

Comments
 (0)