Skip to content

Commit 25e2077

Browse files
feat: add stream id variables, ability to use variables in actions (#37)
* chore: update dependencies * feat: add streamID variable for guest positions * chore: update contact info * feat: allow variables for all guest fields * move parenthesis info to description field * chore: version bump
1 parent f6fb4be commit 25e2077

File tree

6 files changed

+431
-527
lines changed

6 files changed

+431
-527
lines changed

actions.js

Lines changed: 98 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,12 @@ export function getActions() {
8585
label: 'Message',
8686
id: 'value',
8787
default: '',
88+
useVariables: true,
8889
},
8990
],
90-
callback: (action) => {
91-
this.sendRequest('sendChat', null, action.options.value)
91+
callback: async (action, context) => {
92+
const value = await context.parseVariablesInString(action.options.value)
93+
this.sendRequest('sendChat', null, value)
9294
},
9395
},
9496

@@ -450,19 +452,24 @@ export function getActions() {
450452
options: [
451453
{
452454
type: 'textinput',
453-
label: 'Guest (position or stream ID)',
455+
label: 'Guest',
456+
description: 'Position number or stream ID',
454457
id: 'target',
455458
default: '1',
459+
useVariables: true,
456460
},
457461
{
458462
type: 'textinput',
459463
label: 'Destination room',
460464
id: 'value',
461465
default: '',
466+
useVariables: true,
462467
},
463468
],
464-
callback: (action) => {
465-
this.sendRequest('forward', action.options.target, action.options.value)
469+
callback: async (action, context) => {
470+
const target = await context.parseVariablesInString(action.options.target)
471+
const value = await context.parseVariablesInString(action.options.value)
472+
this.sendRequest('forward', target, value)
466473
},
467474
},
468475

@@ -472,19 +479,24 @@ export function getActions() {
472479
options: [
473480
{
474481
type: 'textinput',
475-
label: 'Guest (position or stream ID)',
482+
label: 'Guest',
483+
description: 'Position number or stream ID',
476484
id: 'target',
477485
default: '1',
486+
useVariables: true,
478487
},
479488
{
480489
type: 'textinput',
481490
label: 'Scene name or ID (0 to 8)',
482491
id: 'value',
483492
default: '1',
493+
useVariables: true,
484494
},
485495
],
486-
callback: (action) => {
487-
this.sendRequest('addScene', action.options.target, action.options.value)
496+
callback: async (action, context) => {
497+
const target = await context.parseVariablesInString(action.options.target)
498+
const value = await context.parseVariablesInString(action.options.value)
499+
this.sendRequest('addScene', target, value)
488500
},
489501
},
490502

@@ -494,19 +506,24 @@ export function getActions() {
494506
options: [
495507
{
496508
type: 'textinput',
497-
label: 'Guest (position or stream ID)',
509+
label: 'Guest',
510+
description: 'Position number or stream ID',
498511
id: 'target',
499512
default: '1',
513+
useVariables: true,
500514
},
501515
{
502516
type: 'textinput',
503517
label: 'Scene name or ID (0 to 8)',
504518
id: 'value',
505519
default: '1',
520+
useVariables: true,
506521
},
507522
],
508-
callback: (action) => {
509-
this.sendRequest('muteScene', action.options.target, action.options.value)
523+
callback: async (action, context) => {
524+
const target = await context.parseVariablesInString(action.options.target)
525+
const value = await context.parseVariablesInString(action.options.value)
526+
this.sendRequest('muteScene', target, value)
510527
},
511528
},
512529

@@ -516,19 +533,24 @@ export function getActions() {
516533
options: [
517534
{
518535
type: 'textinput',
519-
label: 'Guest (position or stream ID)',
536+
label: 'Guest',
537+
description: 'Position number or stream ID',
520538
id: 'target',
521539
default: '1',
540+
useVariables: true,
522541
},
523542
{
524543
type: 'textinput',
525544
label: 'Group ID (1 to 8)',
526545
id: 'value',
527546
default: '1',
547+
useVariables: true,
528548
},
529549
],
530-
callback: (action) => {
531-
this.sendRequest('group', action.options.target, action.options.value)
550+
callback: async (action, context) => {
551+
const target = await context.parseVariablesInString(action.options.target)
552+
const value = await context.parseVariablesInString(action.options.value)
553+
this.sendRequest('group', target, value)
532554
},
533555
},
534556

@@ -538,13 +560,16 @@ export function getActions() {
538560
options: [
539561
{
540562
type: 'textinput',
541-
label: 'Guest (position or stream ID)',
563+
label: 'Guest',
564+
description: 'Position number or stream ID',
542565
id: 'target',
543566
default: '1',
567+
useVariables: true,
544568
},
545569
],
546-
callback: (action) => {
547-
this.sendRequest('mic', action.options.target)
570+
callback: async (action, context) => {
571+
const target = await context.parseVariablesInString(action.options.target)
572+
this.sendRequest('mic', target)
548573
},
549574
},
550575

@@ -554,13 +579,16 @@ export function getActions() {
554579
options: [
555580
{
556581
type: 'textinput',
557-
label: 'Guest (position or stream ID)',
582+
label: 'Guest',
583+
description: 'Position number or stream ID',
558584
id: 'target',
559585
default: '1',
586+
useVariables: true,
560587
},
561588
],
562-
callback: (action) => {
563-
this.sendRequest('hangup', action.options.target)
589+
callback: async (action, context) => {
590+
const target = await context.parseVariablesInString(action.options.target)
591+
this.sendRequest('hangup', target)
564592
},
565593
},
566594

@@ -570,13 +598,16 @@ export function getActions() {
570598
options: [
571599
{
572600
type: 'textinput',
573-
label: 'Guest (position or stream ID)',
601+
label: 'Guest',
602+
description: 'Position number or stream ID',
574603
id: 'target',
575604
default: '1',
605+
useVariables: true,
576606
},
577607
],
578-
callback: (action) => {
579-
this.sendRequest('soloChat', action.options.target, null)
608+
callback: async (action, context) => {
609+
const target = await context.parseVariablesInString(action.options.target)
610+
this.sendRequest('soloChat', target, null)
580611
},
581612
},
582613

@@ -586,13 +617,16 @@ export function getActions() {
586617
options: [
587618
{
588619
type: 'textinput',
589-
label: 'Guest (position or stream ID)',
620+
label: 'Guest',
621+
description: 'Position number or stream ID',
590622
id: 'target',
591623
default: '1',
624+
useVariables: true,
592625
},
593626
],
594-
callback: (action) => {
595-
this.sendRequest('soloChatBidirectional', action.options.target, null)
627+
callback: async (action, context) => {
628+
const target = await context.parseVariablesInString(action.options.target)
629+
this.sendRequest('soloChatBidirectional', target, null)
596630
},
597631
},
598632

@@ -602,13 +636,16 @@ export function getActions() {
602636
options: [
603637
{
604638
type: 'textinput',
605-
label: 'Guest (position or stream ID)',
639+
label: 'Guest',
640+
description: 'Position number or stream ID',
606641
id: 'target',
607642
default: '1',
643+
useVariables: true,
608644
},
609645
],
610-
callback: (action) => {
611-
this.sendRequest('speaker', action.options.target)
646+
callback: async (action, context) => {
647+
const target = await context.parseVariablesInString(action.options.target)
648+
this.sendRequest('speaker', target)
612649
},
613650
},
614651

@@ -618,13 +655,16 @@ export function getActions() {
618655
options: [
619656
{
620657
type: 'textinput',
621-
label: 'Guest (position or stream ID)',
658+
label: 'Guest',
659+
description: 'Position number or stream ID',
622660
id: 'target',
623661
default: '1',
662+
useVariables: true,
624663
},
625664
],
626-
callback: (action) => {
627-
this.sendRequest('display', action.options.target)
665+
callback: async (action, context) => {
666+
const target = await context.parseVariablesInString(action.options.target)
667+
this.sendRequest('display', target)
628668
},
629669
},
630670

@@ -634,19 +674,24 @@ export function getActions() {
634674
options: [
635675
{
636676
type: 'textinput',
637-
label: 'Guest (position or stream ID)',
677+
label: 'Guest',
678+
description: 'Position number or stream ID',
638679
id: 'target',
639680
default: '1',
681+
useVariables: true,
640682
},
641683
{
642684
type: 'textinput',
643685
label: 'Message',
644686
id: 'value',
645687
default: '',
688+
useVariables: true,
646689
},
647690
],
648-
callback: (action) => {
649-
this.sendRequest('sendDirectorChat', action.options.target, action.options.value)
691+
callback: async (action, context) => {
692+
const target = await context.parseVariablesInString(action.options.target)
693+
const value = await context.parseVariablesInString(action.options.value)
694+
this.sendRequest('sendDirectorChat', target, value)
650695
},
651696
},
652697

@@ -656,13 +701,16 @@ export function getActions() {
656701
options: [
657702
{
658703
type: 'textinput',
659-
label: 'Guest (position or stream ID)',
704+
label: 'Guest',
705+
description: 'Position number or stream ID',
660706
id: 'target',
661707
default: '1',
708+
useVariables: true,
662709
},
663710
],
664-
callback: (action) => {
665-
this.sendRequest('forceKeyframe', action.options.target)
711+
callback: async (action, context) => {
712+
const target = await context.parseVariablesInString(action.options.target)
713+
this.sendRequest('forceKeyframe', target)
666714
},
667715
},
668716

@@ -672,13 +720,16 @@ export function getActions() {
672720
options: [
673721
{
674722
type: 'textinput',
675-
label: 'Guest (position or stream ID)',
723+
label: 'Guest',
724+
description: 'Position number or stream ID',
676725
id: 'target',
677726
default: '1',
727+
useVariables: true,
678728
},
679729
],
680-
callback: (action) => {
681-
this.sendRequest('soloVideo', action.options.target)
730+
callback: async (action, context) => {
731+
const target = await context.parseVariablesInString(action.options.target)
732+
this.sendRequest('soloVideo', target)
682733
},
683734
},
684735

@@ -688,9 +739,11 @@ export function getActions() {
688739
options: [
689740
{
690741
type: 'textinput',
691-
label: 'Guest (position or stream ID)',
742+
label: 'Guest',
743+
description: 'Position number or stream ID',
692744
id: 'target',
693745
default: '1',
746+
useVariables: true,
694747
},
695748
{
696749
type: 'number',
@@ -702,8 +755,9 @@ export function getActions() {
702755
range: false,
703756
},
704757
],
705-
callback: (action) => {
706-
this.sendRequest('volume', action.options.target, action.options.value)
758+
callback: async (action, context) => {
759+
const target = await context.parseVariablesInString(action.options.target)
760+
this.sendRequest('volume', target, action.options.value)
707761
},
708762
},
709763
}

companion/HELP.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Control [VDO.Ninja](https://vdo.ninja) settings remotely.
6666

6767
### Available Variables
6868

69+
- streamID (Current stream ID for the guest in a given position )
6970
- mic (Current mute status, either by stream ID or guest position)
7071
- camera (Current camera status, either by stream ID or guest position)
7172
- speaker (Available for the "Director" role only)

companion/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"maintainers": [
1111
{
1212
"name": "Bryce Seifert",
13-
"email": "bryceapps@icloud.com"
13+
"email": "contact@bryce.fyi"
1414
}
1515
],
1616
"legacyIds": [],

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vdo-ninja",
3-
"version": "2.4.0",
3+
"version": "2.5.0",
44
"main": "index.js",
55
"type": "module",
66
"scripts": {
@@ -11,21 +11,21 @@
1111
},
1212
"license": "MIT",
1313
"dependencies": {
14-
"@companion-module/base": "~1.12.0",
15-
"ws": "^8.18.2"
14+
"@companion-module/base": "~1.12.1",
15+
"ws": "^8.18.3"
1616
},
1717
"repository": {
1818
"type": "git",
1919
"url": "git+https://github.com/bitfocus/companion-module-vdo-ninja.git"
2020
},
2121
"devDependencies": {
22-
"@companion-module/tools": "^2.3.0",
23-
"eslint": "^9.27.0",
24-
"prettier": "^3.5.3"
22+
"@companion-module/tools": "^2.4.2",
23+
"eslint": "^9.39.1",
24+
"prettier": "^3.6.2"
2525
},
2626
"engines": {
2727
"node": "^22.12"
2828
},
2929
"prettier": "@companion-module/tools/.prettierrc.json",
30-
"packageManager": "yarn@4.9.1"
30+
"packageManager": "yarn@4.11.0"
3131
}

0 commit comments

Comments
 (0)