parent
805c1288be
commit
e1e2e283a3
130
src/actions.ts
130
src/actions.ts
|
|
@ -1,7 +1,7 @@
|
||||||
import type { MPinstance } from './main.js'
|
import type { MPinstance } from './main.js'
|
||||||
|
|
||||||
export function UpdateActions(self: MPinstance): void {
|
export function UpdateActions(instance: MPinstance): void {
|
||||||
self.setActionDefinitions({
|
instance.setActionDefinitions({
|
||||||
// LAUNCH TASK
|
// LAUNCH TASK
|
||||||
launch_task: {
|
launch_task: {
|
||||||
name: 'Launch Task {uuid}',
|
name: 'Launch Task {uuid}',
|
||||||
|
|
@ -15,7 +15,7 @@ export function UpdateActions(self: MPinstance): void {
|
||||||
],
|
],
|
||||||
callback: async (event) => {
|
callback: async (event) => {
|
||||||
//console.log('Launch Task ID: ' + event.options.task)
|
//console.log('Launch Task ID: ' + event.options.task)
|
||||||
self.mpConnection.sendMessageLunchTask(event.options.task, 2)
|
instance.mpConnection.sendMessageLunchTask(event.options.task, 2)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -36,32 +36,32 @@ export function UpdateActions(self: MPinstance): void {
|
||||||
type: 'textinput',
|
type: 'textinput',
|
||||||
label: 'Cue UUID',
|
label: 'Cue UUID',
|
||||||
default: '',
|
default: '',
|
||||||
isVisible: () => (false),
|
isVisible: () => false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'plUUID',
|
id: 'plUUID',
|
||||||
type: 'textinput',
|
type: 'textinput',
|
||||||
label: 'Playlist uuid',
|
label: 'Playlist uuid',
|
||||||
default: '',
|
default: '',
|
||||||
isVisible: () => (false),
|
isVisible: () => false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'pl',
|
id: 'pl',
|
||||||
type: 'dropdown',
|
type: 'dropdown',
|
||||||
label: 'Select Playlist',
|
label: 'Select Playlist',
|
||||||
choices: self.dropdownPlayList,
|
choices: instance.dropdownPlayList,
|
||||||
default: `0`
|
default: `0`,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
callback: async (event) => {
|
callback: async (event) => {
|
||||||
let id = 0
|
let id = 0
|
||||||
if (typeof event.options.pl === 'string') {
|
if (typeof event.options.pl === 'string') {
|
||||||
id = parseInt(event.options.pl, 10);
|
id = parseInt(event.options.pl, 10)
|
||||||
}
|
}
|
||||||
const pl = self.dropdownPlayList[id]
|
const pl = instance.dropdownPlayList[id]
|
||||||
// console.log('warn', `MODULO PLAYER | GET DROPDOWN ACTION >>> ${typeof event.options.pl} >>> ${JSON.stringify(pl)}`)
|
// console.log('warn', `MODULO PLAYER | GET DROPDOWN ACTION >>> ${typeof event.options.pl} >>> ${JSON.stringify(pl)}`)
|
||||||
// console.log(`Launch Cue ID: ${event.options.pl} from Playlist UUID: ${pl["uuid"]}`)
|
// console.log(`Launch Cue ID: ${event.options.pl} from Playlist UUID: ${pl["uuid"]}`)
|
||||||
self.moduloplayer?.setGotoCue(pl["uuid"], event.options.index)
|
instance.moduloplayer?.setGotoCue(pl['uuid'], event.options.index)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -82,32 +82,32 @@ export function UpdateActions(self: MPinstance): void {
|
||||||
type: 'textinput',
|
type: 'textinput',
|
||||||
label: 'Cue UUID',
|
label: 'Cue UUID',
|
||||||
default: '',
|
default: '',
|
||||||
isVisible: () => (false),
|
isVisible: () => false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'plUUID',
|
id: 'plUUID',
|
||||||
type: 'textinput',
|
type: 'textinput',
|
||||||
label: 'Playlist uuid',
|
label: 'Playlist uuid',
|
||||||
default: '',
|
default: '',
|
||||||
isVisible: () => (false),
|
isVisible: () => false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'pl',
|
id: 'pl',
|
||||||
type: 'dropdown',
|
type: 'dropdown',
|
||||||
label: 'Select Playlist',
|
label: 'Select Playlist',
|
||||||
choices: self.dropdownPlayList,
|
choices: instance.dropdownPlayList,
|
||||||
default: `0`
|
default: `0`,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
callback: async (event) => {
|
callback: async (event) => {
|
||||||
let id = 0
|
let id = 0
|
||||||
if (typeof event.options.pl === 'string') {
|
if (typeof event.options.pl === 'string') {
|
||||||
id = parseInt(event.options.pl, 10);
|
id = parseInt(event.options.pl, 10)
|
||||||
}
|
}
|
||||||
const pl = self.dropdownPlayList[id]
|
const pl = instance.dropdownPlayList[id]
|
||||||
// console.log('warn', `MODULO PLAYER | GET DROPDOWN ACTION >>> ${typeof event.options.pl} >>> ${JSON.stringify(pl)}`)
|
// console.log('warn', `MODULO PLAYER | GET DROPDOWN ACTION >>> ${typeof event.options.pl} >>> ${JSON.stringify(pl)}`)
|
||||||
// console.log(`Launch Cue ID: ${event.options.pl} from Playlist UUID: ${pl["uuid"]}`)
|
// console.log(`Launch Cue ID: ${event.options.pl} from Playlist UUID: ${pl["uuid"]}`)
|
||||||
self.moduloplayer?.setPreloadCue(pl["uuid"], event.options.index)
|
instance.moduloplayer?.setPreloadCue(pl['uuid'], event.options.index)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -120,23 +120,23 @@ export function UpdateActions(self: MPinstance): void {
|
||||||
type: 'textinput',
|
type: 'textinput',
|
||||||
label: 'Playlist UUID',
|
label: 'Playlist UUID',
|
||||||
default: '',
|
default: '',
|
||||||
isVisible: () => (false),
|
isVisible: () => false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'pl',
|
id: 'pl',
|
||||||
type: 'dropdown',
|
type: 'dropdown',
|
||||||
label: 'Select Playlist',
|
label: 'Select Playlist',
|
||||||
choices: self.dropdownPlayList,
|
choices: instance.dropdownPlayList,
|
||||||
default: `0`
|
default: `0`,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
callback: async (event) => {
|
callback: async (event) => {
|
||||||
let id = 0
|
let id = 0
|
||||||
if (typeof event.options.pl === 'string') {
|
if (typeof event.options.pl === 'string') {
|
||||||
id = parseInt(event.options.pl, 10);
|
id = parseInt(event.options.pl, 10)
|
||||||
}
|
}
|
||||||
const pl = self.dropdownPlayList[id]
|
const pl = instance.dropdownPlayList[id]
|
||||||
self.moduloplayer?.setPlay(pl["uuid"])
|
instance.moduloplayer?.setPlay(pl['uuid'])
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -149,23 +149,23 @@ export function UpdateActions(self: MPinstance): void {
|
||||||
type: 'textinput',
|
type: 'textinput',
|
||||||
label: 'Playlist UUID',
|
label: 'Playlist UUID',
|
||||||
default: '',
|
default: '',
|
||||||
isVisible: () => (false),
|
isVisible: () => false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'pl',
|
id: 'pl',
|
||||||
type: 'dropdown',
|
type: 'dropdown',
|
||||||
label: 'Select Playlist',
|
label: 'Select Playlist',
|
||||||
choices: self.dropdownPlayList,
|
choices: instance.dropdownPlayList,
|
||||||
default: `0`
|
default: `0`,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
callback: async (event) => {
|
callback: async (event) => {
|
||||||
let id = 0
|
let id = 0
|
||||||
if (typeof event.options.pl === 'string') {
|
if (typeof event.options.pl === 'string') {
|
||||||
id = parseInt(event.options.pl, 10);
|
id = parseInt(event.options.pl, 10)
|
||||||
}
|
}
|
||||||
const pl = self.dropdownPlayList[id]
|
const pl = instance.dropdownPlayList[id]
|
||||||
self.moduloplayer?.setPause(pl["uuid"])
|
instance.moduloplayer?.setPause(pl['uuid'])
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -178,23 +178,23 @@ export function UpdateActions(self: MPinstance): void {
|
||||||
type: 'textinput',
|
type: 'textinput',
|
||||||
label: 'Playlist UUID',
|
label: 'Playlist UUID',
|
||||||
default: '',
|
default: '',
|
||||||
isVisible: () => (false),
|
isVisible: () => false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'pl',
|
id: 'pl',
|
||||||
type: 'dropdown',
|
type: 'dropdown',
|
||||||
label: 'Select Playlist',
|
label: 'Select Playlist',
|
||||||
choices: self.dropdownPlayList,
|
choices: instance.dropdownPlayList,
|
||||||
default: `0`
|
default: `0`,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
callback: async (event) => {
|
callback: async (event) => {
|
||||||
let id = 0
|
let id = 0
|
||||||
if (typeof event.options.pl === 'string') {
|
if (typeof event.options.pl === 'string') {
|
||||||
id = parseInt(event.options.pl, 10);
|
id = parseInt(event.options.pl, 10)
|
||||||
}
|
}
|
||||||
const pl = self.dropdownPlayList[id]
|
const pl = instance.dropdownPlayList[id]
|
||||||
self.moduloplayer?.setNextCue(pl["uuid"])
|
instance.moduloplayer?.setNextCue(pl['uuid'])
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -207,23 +207,23 @@ export function UpdateActions(self: MPinstance): void {
|
||||||
type: 'textinput',
|
type: 'textinput',
|
||||||
label: 'Playlist UUID',
|
label: 'Playlist UUID',
|
||||||
default: '',
|
default: '',
|
||||||
isVisible: () => (false),
|
isVisible: () => false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'pl',
|
id: 'pl',
|
||||||
type: 'dropdown',
|
type: 'dropdown',
|
||||||
label: 'Select Playlist',
|
label: 'Select Playlist',
|
||||||
choices: self.dropdownPlayList,
|
choices: instance.dropdownPlayList,
|
||||||
default: `0`
|
default: `0`,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
callback: async (event) => {
|
callback: async (event) => {
|
||||||
let id = 0
|
let id = 0
|
||||||
if (typeof event.options.pl === 'string') {
|
if (typeof event.options.pl === 'string') {
|
||||||
id = parseInt(event.options.pl, 10);
|
id = parseInt(event.options.pl, 10)
|
||||||
}
|
}
|
||||||
const pl = self.dropdownPlayList[id]
|
const pl = instance.dropdownPlayList[id]
|
||||||
self.moduloplayer?.setPrevCue(pl["uuid"])
|
instance.moduloplayer?.setPrevCue(pl['uuid'])
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -235,15 +235,15 @@ export function UpdateActions(self: MPinstance): void {
|
||||||
id: 'pl',
|
id: 'pl',
|
||||||
type: 'dropdown',
|
type: 'dropdown',
|
||||||
label: 'Select Playlist',
|
label: 'Select Playlist',
|
||||||
choices: self.dropdownPlayList,
|
choices: instance.dropdownPlayList,
|
||||||
default: `0`
|
default: `0`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'plUUID',
|
id: 'plUUID',
|
||||||
type: 'textinput',
|
type: 'textinput',
|
||||||
label: 'Playlist ID',
|
label: 'Playlist ID',
|
||||||
default: '',
|
default: '',
|
||||||
isVisible: () => (false),
|
isVisible: () => false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'value',
|
id: 'value',
|
||||||
|
|
@ -265,10 +265,10 @@ export function UpdateActions(self: MPinstance): void {
|
||||||
callback: async (event) => {
|
callback: async (event) => {
|
||||||
let id = 0
|
let id = 0
|
||||||
if (typeof event.options.pl === 'string') {
|
if (typeof event.options.pl === 'string') {
|
||||||
id = parseInt(event.options.pl, 10);
|
id = parseInt(event.options.pl, 10)
|
||||||
}
|
}
|
||||||
const pl = self.dropdownPlayList[id]
|
const pl = instance.dropdownPlayList[id]
|
||||||
self.moduloplayer?.setGrandMasterFader(pl["uuid"], event.options.value, event.options.duration)
|
instance.moduloplayer?.setGrandMasterFader(pl['uuid'], event.options.value, event.options.duration)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -280,15 +280,15 @@ export function UpdateActions(self: MPinstance): void {
|
||||||
id: 'pl',
|
id: 'pl',
|
||||||
type: 'dropdown',
|
type: 'dropdown',
|
||||||
label: 'Select Playlist',
|
label: 'Select Playlist',
|
||||||
choices: self.dropdownPlayList,
|
choices: instance.dropdownPlayList,
|
||||||
default: `0`
|
default: `0`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'plUUID',
|
id: 'plUUID',
|
||||||
type: 'textinput',
|
type: 'textinput',
|
||||||
label: 'Playlist ID',
|
label: 'Playlist ID',
|
||||||
default: '',
|
default: '',
|
||||||
isVisible: () => (false),
|
isVisible: () => false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'value',
|
id: 'value',
|
||||||
|
|
@ -310,10 +310,10 @@ export function UpdateActions(self: MPinstance): void {
|
||||||
callback: async (event) => {
|
callback: async (event) => {
|
||||||
let id = 0
|
let id = 0
|
||||||
if (typeof event.options.pl === 'string') {
|
if (typeof event.options.pl === 'string') {
|
||||||
id = parseInt(event.options.pl, 10);
|
id = parseInt(event.options.pl, 10)
|
||||||
}
|
}
|
||||||
const pl = self.dropdownPlayList[id]
|
const pl = instance.dropdownPlayList[id]
|
||||||
self.moduloplayer?.setAudioMaster(pl["uuid"], event.options.value, event.options.duration)
|
instance.moduloplayer?.setAudioMaster(pl['uuid'], event.options.value, event.options.duration)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -323,7 +323,7 @@ export function UpdateActions(self: MPinstance): void {
|
||||||
name: 'Save Show',
|
name: 'Save Show',
|
||||||
options: [],
|
options: [],
|
||||||
callback: async () => {
|
callback: async () => {
|
||||||
self.moduloplayer?.setShowSave()
|
instance.moduloplayer?.setShowSave()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -332,7 +332,7 @@ export function UpdateActions(self: MPinstance): void {
|
||||||
name: 'Backup Show',
|
name: 'Backup Show',
|
||||||
options: [],
|
options: [],
|
||||||
callback: async () => {
|
callback: async () => {
|
||||||
self.moduloplayer?.setShowbackup()
|
instance.moduloplayer?.setShowbackup()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -341,7 +341,7 @@ export function UpdateActions(self: MPinstance): void {
|
||||||
name: 'Rescan Medias',
|
name: 'Rescan Medias',
|
||||||
options: [],
|
options: [],
|
||||||
callback: async () => {
|
callback: async () => {
|
||||||
self.moduloplayer?.setShowRescanMedia()
|
instance.moduloplayer?.setShowRescanMedia()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -350,7 +350,7 @@ export function UpdateActions(self: MPinstance): void {
|
||||||
name: 'Remove Missing Medias',
|
name: 'Remove Missing Medias',
|
||||||
options: [],
|
options: [],
|
||||||
callback: async () => {
|
callback: async () => {
|
||||||
self.moduloplayer?.setShowRemoveMissingMedia()
|
instance.moduloplayer?.setShowRemoveMissingMedia()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -359,7 +359,7 @@ export function UpdateActions(self: MPinstance): void {
|
||||||
name: 'Rescan Medias Force',
|
name: 'Rescan Medias Force',
|
||||||
options: [],
|
options: [],
|
||||||
callback: async () => {
|
callback: async () => {
|
||||||
self.moduloplayer?.setShowRescanMediaForce()
|
instance.moduloplayer?.setShowRescanMediaForce()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -368,7 +368,7 @@ export function UpdateActions(self: MPinstance): void {
|
||||||
name: 'Send show to all remotes',
|
name: 'Send show to all remotes',
|
||||||
options: [],
|
options: [],
|
||||||
callback: async () => {
|
callback: async () => {
|
||||||
self.moduloplayer?.setShowSendShowToRemote()
|
instance.moduloplayer?.setShowSendShowToRemote()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
124
src/feedbacks.ts
124
src/feedbacks.ts
|
|
@ -1,10 +1,8 @@
|
||||||
import { combineRgb } from '@companion-module/base'
|
import { combineRgb } from '@companion-module/base'
|
||||||
import type { MPinstance } from './main.js'
|
import type { MPinstance } from './main.js'
|
||||||
|
|
||||||
const colorGreenMP = [88, 201, 23]
|
export function UpdateFeedbacks(instance: MPinstance): void {
|
||||||
|
instance.setFeedbackDefinitions({
|
||||||
export function UpdateFeedbacks(self: MPinstance): void {
|
|
||||||
self.setFeedbackDefinitions({
|
|
||||||
color_task: {
|
color_task: {
|
||||||
name: 'Color Task',
|
name: 'Color Task',
|
||||||
type: 'advanced',
|
type: 'advanced',
|
||||||
|
|
@ -14,12 +12,12 @@ export function UpdateFeedbacks(self: MPinstance): void {
|
||||||
label: 'UUID',
|
label: 'UUID',
|
||||||
id: 'uuid',
|
id: 'uuid',
|
||||||
default: '',
|
default: '',
|
||||||
isVisible: () => (false),
|
isVisible: () => false,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
callback: (feedback) => {
|
callback: (feedback) => {
|
||||||
const uuid = feedback.options.uuid
|
const uuid = feedback.options.uuid
|
||||||
const colorStr = self.getVariableValue(`tl_${uuid}_color`) // string "16750848"
|
const colorStr = instance.getVariableValue(`tl_${uuid}_color`) // string "16750848"
|
||||||
if (typeof colorStr === 'string') {
|
if (typeof colorStr === 'string') {
|
||||||
const bgColor = parseInt(colorStr, 10)
|
const bgColor = parseInt(colorStr, 10)
|
||||||
return {
|
return {
|
||||||
|
|
@ -38,12 +36,12 @@ export function UpdateFeedbacks(self: MPinstance): void {
|
||||||
label: 'UUID',
|
label: 'UUID',
|
||||||
id: 'uuid',
|
id: 'uuid',
|
||||||
default: '',
|
default: '',
|
||||||
isVisible: () => (false),
|
isVisible: () => false,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
callback: (feedback) => {
|
callback: (feedback) => {
|
||||||
const uuid = feedback.options.uuid
|
const uuid = feedback.options.uuid
|
||||||
const colorStr = self.getVariableValue(`cue_${uuid}_color`) // string "16750848"
|
const colorStr = instance.getVariableValue(`cue_${uuid}_color`) // string "16750848"
|
||||||
if (typeof colorStr === 'string') {
|
if (typeof colorStr === 'string') {
|
||||||
const bgColor = parseInt(colorStr, 10)
|
const bgColor = parseInt(colorStr, 10)
|
||||||
return {
|
return {
|
||||||
|
|
@ -74,11 +72,11 @@ export function UpdateFeedbacks(self: MPinstance): void {
|
||||||
type: 'textinput',
|
type: 'textinput',
|
||||||
label: 'Playlist UUID',
|
label: 'Playlist UUID',
|
||||||
default: '',
|
default: '',
|
||||||
isVisible: () => (false),
|
isVisible: () => false,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
callback: (feedback) => {
|
callback: (feedback) => {
|
||||||
if (self.states[`pl_${feedback.options.pl}_currentIndex`] === feedback.options.current_Cue) {
|
if (instance.states[`pl_${feedback.options.pl}_currentIndex`] === feedback.options.current_Cue) {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
|
|
@ -89,20 +87,23 @@ export function UpdateFeedbacks(self: MPinstance): void {
|
||||||
name: 'Modulo Player Status',
|
name: 'Modulo Player Status',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
defaultStyle: {
|
defaultStyle: {
|
||||||
bgcolor: combineRgb(colorGreenMP[0], colorGreenMP[1], colorGreenMP[2]),
|
bgcolor: instance.greenModuloPlayer,
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
id: 'status',
|
id: 'status',
|
||||||
type: 'number',
|
type: 'dropdown',
|
||||||
label: 'Modulo Player Status',
|
label: 'Modulo Player Status',
|
||||||
default: 0,
|
default: 0,
|
||||||
min: 0,
|
choices: [
|
||||||
max: 2,
|
{ id: 0, label: 'Offline' },
|
||||||
|
{ id: 1, label: 'Launching' },
|
||||||
|
{ id: 2, label: 'Online' },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
callback: (feedback) => {
|
callback: (feedback) => {
|
||||||
if (feedback.options.status === self.states[`status`]) {
|
if (feedback.options.status === instance.states[`status`]) {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
|
|
@ -125,16 +126,101 @@ export function UpdateFeedbacks(self: MPinstance): void {
|
||||||
default: 1,
|
default: 1,
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 1,
|
max: 1,
|
||||||
|
isVisible: () => false,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
callback: async (feedback) => {
|
callback: async (feedback) => {
|
||||||
if (feedback.options.master === self.states[`master`]) {
|
if (feedback.options.master === instance.states[`master`]) {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
color: {
|
||||||
|
name: 'Color Player',
|
||||||
|
type: 'advanced',
|
||||||
|
options: [],
|
||||||
|
callback: () => {
|
||||||
|
const colorStr = instance.getVariableValue(`color`)
|
||||||
|
if (typeof colorStr === 'string') {
|
||||||
|
return {
|
||||||
|
bgcolor: instance.getCombineRGBFromHex(colorStr),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fps_ok: {
|
||||||
|
name: 'FPS Player',
|
||||||
|
type: 'advanced',
|
||||||
|
options: [],
|
||||||
|
callback: () => {
|
||||||
|
const fpsOk = !!instance.getVariableValue(`fpsOk`)
|
||||||
|
if (fpsOk) {
|
||||||
|
return {
|
||||||
|
bgcolor: instance.greenModuloPlayer,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
bgcolor: instance.redModuloPlayer,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
memory_use: {
|
||||||
|
name: 'Memory Use',
|
||||||
|
type: 'advanced',
|
||||||
|
options: [],
|
||||||
|
callback: () => {
|
||||||
|
const memoryValue = instance.getVariableValue(`memoryUse`)
|
||||||
|
let memory: number = NaN
|
||||||
|
if (typeof memoryValue === 'number') {
|
||||||
|
memory = memoryValue
|
||||||
|
} else if (typeof memoryValue === 'string') {
|
||||||
|
memory = parseFloat(memoryValue)
|
||||||
|
}
|
||||||
|
if (!isNaN(memory) && memory < 50) {
|
||||||
|
return {
|
||||||
|
bgcolor: instance.greenModuloPlayer,
|
||||||
|
}
|
||||||
|
} else if (!isNaN(memory) && memory <= 90 && memory >= 50) {
|
||||||
|
return {
|
||||||
|
bgcolor: instance.orangeModuloPlayer,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
bgcolor: instance.redModuloPlayer,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
cpu_use: {
|
||||||
|
name: 'CPU Use',
|
||||||
|
type: 'advanced',
|
||||||
|
options: [],
|
||||||
|
callback: () => {
|
||||||
|
const cpuValue = instance.getVariableValue(`cpuUse`)
|
||||||
|
let cpu: number = NaN
|
||||||
|
if (typeof cpuValue === 'number') {
|
||||||
|
cpu = cpuValue
|
||||||
|
} else if (typeof cpuValue === 'string') {
|
||||||
|
cpu = parseFloat(cpuValue)
|
||||||
|
}
|
||||||
|
if (!isNaN(cpu) && cpu < 50) {
|
||||||
|
return {
|
||||||
|
bgcolor: instance.greenModuloPlayer,
|
||||||
|
}
|
||||||
|
} else if (!isNaN(cpu) && cpu <= 90 && cpu >= 50) {
|
||||||
|
return {
|
||||||
|
bgcolor: instance.orangeModuloPlayer,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
bgcolor: instance.redModuloPlayer,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
75
src/main.ts
75
src/main.ts
|
|
@ -1,10 +1,17 @@
|
||||||
import { InstanceBase, runEntrypoint, InstanceStatus, SomeCompanionConfigField } from '@companion-module/base'
|
import {
|
||||||
|
InstanceBase,
|
||||||
|
runEntrypoint,
|
||||||
|
InstanceStatus,
|
||||||
|
SomeCompanionConfigField,
|
||||||
|
combineRgb,
|
||||||
|
} from '@companion-module/base'
|
||||||
import { GetConfigFields, type ModuloPlayConfig } from './configFields.js'
|
import { GetConfigFields, type ModuloPlayConfig } from './configFields.js'
|
||||||
import { UpdateVariableDefinitions } from './variables.js'
|
import { UpdateVariableDefinitions } from './variables.js'
|
||||||
import { InitVariableDefinitions } from './variables.js'
|
import { InitVariableDefinitions } from './variables.js'
|
||||||
import { UpgradeScripts } from './upgrades.js'
|
import { UpgradeScripts } from './upgrades.js'
|
||||||
import { UpdateActions } from './actions.js'
|
import { UpdateActions } from './actions.js'
|
||||||
import { UpdateFeedbacks } from './feedbacks.js'
|
import { UpdateFeedbacks } from './feedbacks.js'
|
||||||
|
import { getPresets } from './presets.js'
|
||||||
|
|
||||||
//import { getPresets } from './presets.js'
|
//import { getPresets } from './presets.js'
|
||||||
|
|
||||||
|
|
@ -35,6 +42,14 @@ export class MPinstance extends InstanceBase<ModuloPlayConfig> {
|
||||||
public playLists = []
|
public playLists = []
|
||||||
public states: IStringIndex = {}
|
public states: IStringIndex = {}
|
||||||
public dropdownPlayList = []
|
public dropdownPlayList = []
|
||||||
|
public dynamicInfo = {}
|
||||||
|
public staticInfo = {}
|
||||||
|
|
||||||
|
// COLORS
|
||||||
|
public grayModuloPlayer: number = 2763306
|
||||||
|
public orangeModuloPlayer: number = 16753920
|
||||||
|
public greenModuloPlayer: number = 5818647
|
||||||
|
public redModuloPlayer: number = 16711680
|
||||||
|
|
||||||
// CONTRUCTOR
|
// CONTRUCTOR
|
||||||
constructor(internal: unknown) {
|
constructor(internal: unknown) {
|
||||||
|
|
@ -48,40 +63,7 @@ export class MPinstance extends InstanceBase<ModuloPlayConfig> {
|
||||||
this.spydog = new SpyDog(this)
|
this.spydog = new SpyDog(this)
|
||||||
await this.configUpdated(config)
|
await this.configUpdated(config)
|
||||||
|
|
||||||
this.updateActions() // export actions
|
this.updateInstance()
|
||||||
this.updateFeedbacks() // export feedbacks
|
|
||||||
this.updateVariableDefinitions()
|
|
||||||
|
|
||||||
// SET SPYDOG STATIC INFO
|
|
||||||
this.setVariableValues({ clusterId: 0 })
|
|
||||||
this.setVariableValues({ color: "" })
|
|
||||||
this.setVariableValues({ cpuTemperature: 0 })
|
|
||||||
this.setVariableValues({ cpuUse: 0 })
|
|
||||||
this.setVariableValues({ detacastTemperature: "" })
|
|
||||||
this.setVariableValues({ fps: 0 })
|
|
||||||
this.setVariableValues({ fpsOk: false })
|
|
||||||
this.setVariableValues({ gpuTemperature: 0 })
|
|
||||||
|
|
||||||
// SET SPYDOG DYNAMIC VARIABLE
|
|
||||||
this.setVariableValues({ clusterId: 0 })
|
|
||||||
this.setVariableValues({ color: "" })
|
|
||||||
this.setVariableValues({ cpuTemperature: 0 })
|
|
||||||
this.setVariableValues({ cpuUse: 0 })
|
|
||||||
this.setVariableValues({ detacastTemperature: "" })
|
|
||||||
this.setVariableValues({ fps: 0 })
|
|
||||||
this.setVariableValues({ fpsOk: false })
|
|
||||||
this.setVariableValues({ gpuTemperature: 0 })
|
|
||||||
this.setVariableValues({ lockStatus: 0 })
|
|
||||||
this.setVariableValues({ master: true })
|
|
||||||
this.setVariableValues({ maxAutocalibOutputs: 0 })
|
|
||||||
this.setVariableValues({ maxOutputs: 0 })
|
|
||||||
this.setVariableValues({ memoryUse: 0 })
|
|
||||||
this.setVariableValues({ motherboardTemperature: 0 })
|
|
||||||
this.setVariableValues({ serverIp: "" })
|
|
||||||
this.setVariableValues({ serverName: "" })
|
|
||||||
this.setVariableValues({ serverTime: "" })
|
|
||||||
this.setVariableValues({ status: 0 })
|
|
||||||
this.setVariableValues({ upTime: "" })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// When module gets deleted
|
// When module gets deleted
|
||||||
|
|
@ -98,8 +80,10 @@ export class MPinstance extends InstanceBase<ModuloPlayConfig> {
|
||||||
this.sdConnection.disconnect()
|
this.sdConnection.disconnect()
|
||||||
this.updateStatus(InstanceStatus.Connecting, `Init Connection`)
|
this.updateStatus(InstanceStatus.Connecting, `Init Connection`)
|
||||||
await this.mpConnection.connect(this.config.host, this.config.mpPort)
|
await this.mpConnection.connect(this.config.host, this.config.mpPort)
|
||||||
|
if (this.config.sdEnable) {
|
||||||
await this.sdConnection.connect(this.config.host, this.config.sdPort)
|
await this.sdConnection.connect(this.config.host, this.config.sdPort)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async isConnected() {
|
async isConnected() {
|
||||||
if (this.mpConnected && this.sdConnected) {
|
if (this.mpConnected && this.sdConnected) {
|
||||||
|
|
@ -109,17 +93,20 @@ export class MPinstance extends InstanceBase<ModuloPlayConfig> {
|
||||||
if (this.sdConnected) this.spydog?.getStaticInfo()
|
if (this.sdConnected) this.spydog?.getStaticInfo()
|
||||||
if (this.sdConnected) this.spydog?.getDynamicInfo()
|
if (this.sdConnected) this.spydog?.getDynamicInfo()
|
||||||
} else if (!this.mpConnected && this.sdConnected) {
|
} else if (!this.mpConnected && this.sdConnected) {
|
||||||
this.updateStatus(InstanceStatus.Connecting, `Spydog Connected | Start Modulo Player`)
|
this.updateStatus(InstanceStatus.Ok, `Spydog Online | Modulo Player Offline`)
|
||||||
if (this.mpConnected) this.moduloplayer?.getTaskListModuloPlayer()
|
|
||||||
if (this.mpConnected) this.moduloplayer?.getPlaylistModuloPlayer()
|
|
||||||
if (this.sdConnected) this.spydog?.getStaticInfo()
|
if (this.sdConnected) this.spydog?.getStaticInfo()
|
||||||
if (this.sdConnected) this.spydog?.getDynamicInfo()
|
if (this.sdConnected) this.spydog?.getDynamicInfo()
|
||||||
|
} else if (this.mpConnected && !this.sdConnected) {
|
||||||
|
this.updateStatus(InstanceStatus.Ok, `Modulo Player Online | Spydog Offline`)
|
||||||
|
if (this.mpConnected) this.moduloplayer?.getTaskListModuloPlayer()
|
||||||
|
if (this.mpConnected) this.moduloplayer?.getPlaylistModuloPlayer()
|
||||||
} else {
|
} else {
|
||||||
this.updateStatus(InstanceStatus.Connecting, `Init Connection`)
|
this.updateStatus(InstanceStatus.Connecting, `Init Connection`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateInstance() {
|
async updateInstance() {
|
||||||
|
this.setPresetDefinitions(getPresets(this))
|
||||||
this.updateActions() // export actions
|
this.updateActions() // export actions
|
||||||
this.updateFeedbacks() // export feedbacks
|
this.updateFeedbacks() // export feedbacks
|
||||||
this.updateVariableDefinitions()
|
this.updateVariableDefinitions()
|
||||||
|
|
@ -151,11 +138,18 @@ export class MPinstance extends InstanceBase<ModuloPlayConfig> {
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanUUID(uuid: String) {
|
cleanUUID(uuid: String) {
|
||||||
return uuid.replaceAll("{", "").replaceAll("}", "")
|
return uuid.replaceAll('{', '').replaceAll('}', '')
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanName(name: String) {
|
cleanName(name: String) {
|
||||||
return name.replaceAll(" ", "-")
|
return name.replaceAll(' ', '-')
|
||||||
|
}
|
||||||
|
|
||||||
|
getCombineRGBFromHex(colorHex: any) {
|
||||||
|
//this.log('debug', `MAIN | GET COMBINE RGB ${colorHex}`)
|
||||||
|
if (colorHex === undefined || colorHex === null) return
|
||||||
|
let rgb = this.getColorFromHex(colorHex)
|
||||||
|
return combineRgb(rgb[0], rgb[1], rgb[2])
|
||||||
}
|
}
|
||||||
|
|
||||||
getColorFromHex(colorHex: any) {
|
getColorFromHex(colorHex: any) {
|
||||||
|
|
@ -175,7 +169,6 @@ export class MPinstance extends InstanceBase<ModuloPlayConfig> {
|
||||||
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
runEntrypoint(MPinstance, UpgradeScripts)
|
runEntrypoint(MPinstance, UpgradeScripts)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { MPinstance } from './main.js'
|
import { MPinstance } from './main.js'
|
||||||
import { getPresets } from './presets.js'
|
//import { getPresets } from './presets.js'
|
||||||
|
|
||||||
// JSON ID
|
// JSON ID
|
||||||
// 1 = list Tasks,
|
// 1 = list Tasks,
|
||||||
|
|
@ -36,26 +36,22 @@ export class ModuloPlayer {
|
||||||
const tlInstance: any[] = this.instance.tasksList
|
const tlInstance: any[] = this.instance.tasksList
|
||||||
const tlNew: any[] = obj
|
const tlNew: any[] = obj
|
||||||
const checkTL = areJsonArraysEqual(tlInstance, tlNew)
|
const checkTL = areJsonArraysEqual(tlInstance, tlNew)
|
||||||
this.instance.log('debug', `MODULO PLAYER | CHECK TL >>> ${checkTL}`)
|
//this.instance.log('debug', `MODULO PLAYER | CHECK TL >>> ${checkTL}`)
|
||||||
if (!checkTL) {
|
if (!checkTL) {
|
||||||
this.instance.tasksList = obj
|
this.instance.tasksList = obj
|
||||||
this.instance.setPresetDefinitions(getPresets(this.instance))
|
|
||||||
this.instance.updateInstance()
|
this.instance.updateInstance()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// PLAY LISTS CUES
|
// PLAY LISTS CUES
|
||||||
public playListCuesManager(obj: any): void {
|
public playListCuesManager(obj: any): void {
|
||||||
const plInstance: any[] = this.instance.playLists
|
const plInstance: any[] = this.instance.playLists
|
||||||
const plNew: any[] = obj
|
const plNew: any[] = obj
|
||||||
const checkPL = areJsonArraysEqual(plInstance, plNew)
|
const checkPL = areJsonArraysEqual(plInstance, plNew)
|
||||||
this.instance.log('debug', `MODULO PLAYER | CHECK PL >>> ${checkPL}`)
|
//this.instance.log('debug', `MODULO PLAYER | CHECK PL >>> ${checkPL}`)
|
||||||
if (!checkPL) {
|
if (!checkPL) {
|
||||||
this.instance.playLists = obj
|
this.instance.playLists = obj
|
||||||
this.setDropDownPL(obj)
|
this.setDropDownPL(obj)
|
||||||
this.instance.setPresetDefinitions(getPresets(this.instance))
|
|
||||||
this.instance.updateInstance()
|
this.instance.updateInstance()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -63,17 +59,17 @@ export class ModuloPlayer {
|
||||||
public setDropDownPL(pls: any) {
|
public setDropDownPL(pls: any) {
|
||||||
let plsa: any = []
|
let plsa: any = []
|
||||||
for (let pl = 0; pl < pls.length; pl++) {
|
for (let pl = 0; pl < pls.length; pl++) {
|
||||||
this.instance.log('info', `MODULO PLAYER | GET DROPDOWN >>> ${pl}`)
|
// this.instance.log('info', `MODULO PLAYER | GET DROPDOWN >>> ${pl}`)
|
||||||
const obj = { id: `${pl}`, label: `${pls[pl]["name"]}`, uuid: `${pls[pl]["uuid"]}` }
|
const obj = { id: `${pl}`, label: `${pls[pl]['name']}`, uuid: `${pls[pl]['uuid']}` }
|
||||||
plsa.push(obj)
|
plsa.push(obj)
|
||||||
}
|
}
|
||||||
this.instance.dropdownPlayList = plsa
|
this.instance.dropdownPlayList = plsa
|
||||||
this.instance.log('warn', `MODULO PLAYER | GET DROPDOWN 1 >>> ${JSON.stringify(this.instance.dropdownPlayList)}`)
|
// this.instance.log('warn', `MODULO PLAYER | GET DROPDOWN 1 >>> ${JSON.stringify(this.instance.dropdownPlayList)}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET CURRENT CUE INDEX
|
// GET CURRENT CUE INDEX
|
||||||
async getPlaylistsCurrentCues() {
|
async getPlaylistsCurrentCues() {
|
||||||
//this.instance.log('info', `MODULO PLAYER | GET PLAYLISTS CURRENT CUE !`)
|
// this.instance.log('info', `MODULO PLAYER | GET PLAYLISTS CURRENT CUE !`)
|
||||||
this.instance.mpConnection?.sendMessage('get.list.playlists', 100)
|
this.instance.mpConnection?.sendMessage('get.list.playlists', 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -81,11 +77,11 @@ export class ModuloPlayer {
|
||||||
const pls: any[] = obj
|
const pls: any[] = obj
|
||||||
for (let playlist = 0; playlist < pls.length; playlist++) {
|
for (let playlist = 0; playlist < pls.length; playlist++) {
|
||||||
let uuid: String = this.instance.cleanUUID(pls[playlist]['uuid'])
|
let uuid: String = this.instance.cleanUUID(pls[playlist]['uuid'])
|
||||||
//this.instance.log('warn', `MODULO PLAYER | GET CURRENT INDEX >>> ${uuid} >>> ${pls[playlist]['index']} >>> ${pls[playlist]['grandMasterFader']}`)
|
// this.instance.log('warn', `MODULO PLAYER | GET CURRENT INDEX >>> ${uuid} >>> ${pls[playlist]['index']} >>> ${pls[playlist]['grandMasterFader']}`)
|
||||||
let grandMasterFader = (pls[playlist]['grandMasterFader'] * 100).toFixed(0)
|
let grandMasterFader = (pls[playlist]['grandMasterFader'] * 100).toFixed(0)
|
||||||
var obj: any = {
|
var obj: any = {
|
||||||
[`pl_${uuid}_currentIndex`]: parseInt(pls[playlist]['index']),
|
[`pl_${uuid}_currentIndex`]: parseInt(pls[playlist]['index']),
|
||||||
[`pl_${uuid}_grandMasterFader`]: grandMasterFader
|
[`pl_${uuid}_grandMasterFader`]: grandMasterFader,
|
||||||
}
|
}
|
||||||
this.instance.states[`pl_${uuid}_currentIndex`] = parseInt(pls[playlist]['index'])
|
this.instance.states[`pl_${uuid}_currentIndex`] = parseInt(pls[playlist]['index'])
|
||||||
this.instance.states[`pl_${uuid}_grandMasterFader`] = grandMasterFader
|
this.instance.states[`pl_${uuid}_grandMasterFader`] = grandMasterFader
|
||||||
|
|
@ -180,7 +176,7 @@ export class ModuloPlayer {
|
||||||
this.instance.mpConnection?.sendMessagePlaylistsCues()
|
this.instance.mpConnection?.sendMessagePlaylistsCues()
|
||||||
}
|
}
|
||||||
|
|
||||||
async setNextCue(plUUDI: any,) {
|
async setNextCue(plUUDI: any) {
|
||||||
var m = `{"jsonrpc": "2.0", "method": "doaction.playlist",
|
var m = `{"jsonrpc": "2.0", "method": "doaction.playlist",
|
||||||
"params": {
|
"params": {
|
||||||
"uuid": "${plUUDI}",
|
"uuid": "${plUUDI}",
|
||||||
|
|
@ -189,7 +185,7 @@ export class ModuloPlayer {
|
||||||
this.instance.mpConnection.sendJsonMessage(m)
|
this.instance.mpConnection.sendJsonMessage(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
async setPrevCue(plUUDI: any,) {
|
async setPrevCue(plUUDI: any) {
|
||||||
var m = `{"jsonrpc": "2.0", "method": "doaction.playlist",
|
var m = `{"jsonrpc": "2.0", "method": "doaction.playlist",
|
||||||
"params": {
|
"params": {
|
||||||
"uuid": "${plUUDI}",
|
"uuid": "${plUUDI}",
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ export class MPconnection {
|
||||||
async connect(addr: string | undefined, port: any): Promise<void> {
|
async connect(addr: string | undefined, port: any): Promise<void> {
|
||||||
this.mpAddr = addr
|
this.mpAddr = addr
|
||||||
this.mpPort = port
|
this.mpPort = port
|
||||||
this.instance!.log('debug', `WEBSOCKET MP CONNECT ${this.mpAddr} ${this.mpPort}`)
|
//this.instance!.log('debug', `WEBSOCKET MP CONNECT ${this.mpAddr} ${this.mpPort}`)
|
||||||
if (this.mpAddr === undefined || this.mpPort == undefined) return
|
if (this.mpAddr === undefined || this.mpPort == undefined) return
|
||||||
this.shouldBeConnected = true
|
this.shouldBeConnected = true
|
||||||
|
|
||||||
|
|
|
||||||
304
src/presets.ts
304
src/presets.ts
|
|
@ -8,10 +8,7 @@ import type { MPinstance } from './main.js'
|
||||||
|
|
||||||
export type PresetCategory = 'Tasks List' | 'PL'
|
export type PresetCategory = 'Tasks List' | 'PL'
|
||||||
|
|
||||||
const colorModuloGray = [42, 42, 42]
|
|
||||||
const textSize = 14
|
const textSize = 14
|
||||||
const colorOrangeMP = [255, 165, 0]
|
|
||||||
const colorGreenMP = [88, 201, 23]
|
|
||||||
|
|
||||||
export type mpPreset = CompanionButtonPresetDefinition | CompanionTextPresetDefinition
|
export type mpPreset = CompanionButtonPresetDefinition | CompanionTextPresetDefinition
|
||||||
type mpPresetArray = mpPreset[] | any
|
type mpPresetArray = mpPreset[] | any
|
||||||
|
|
@ -87,7 +84,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
text: `${plName}\nPlay`,
|
text: `${plName}\nPlay`,
|
||||||
size: textSize,
|
size: textSize,
|
||||||
color: combineRgb(255, 255, 255),
|
color: combineRgb(255, 255, 255),
|
||||||
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
|
bgcolor: instance.grayModuloPlayer,
|
||||||
},
|
},
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
|
|
@ -96,7 +93,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
actionId: 'play_pl',
|
actionId: 'play_pl',
|
||||||
options: {
|
options: {
|
||||||
plUUID: `${plID}`,
|
plUUID: `${plID}`,
|
||||||
pl: playlist.toString()
|
pl: playlist.toString(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
@ -115,7 +112,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
text: `${plName}\nPause`,
|
text: `${plName}\nPause`,
|
||||||
size: textSize,
|
size: textSize,
|
||||||
color: combineRgb(255, 255, 255),
|
color: combineRgb(255, 255, 255),
|
||||||
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
|
bgcolor: instance.grayModuloPlayer,
|
||||||
},
|
},
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
|
|
@ -124,7 +121,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
actionId: 'pause_pl',
|
actionId: 'pause_pl',
|
||||||
options: {
|
options: {
|
||||||
plUUID: `${plID}`,
|
plUUID: `${plID}`,
|
||||||
pl: playlist.toString()
|
pl: playlist.toString(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
@ -143,7 +140,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
text: `${plName}\nNext cue`,
|
text: `${plName}\nNext cue`,
|
||||||
size: textSize,
|
size: textSize,
|
||||||
color: combineRgb(255, 255, 255),
|
color: combineRgb(255, 255, 255),
|
||||||
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
|
bgcolor: instance.grayModuloPlayer,
|
||||||
},
|
},
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
|
|
@ -152,7 +149,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
actionId: 'next_cue',
|
actionId: 'next_cue',
|
||||||
options: {
|
options: {
|
||||||
plUUID: `${plID}`,
|
plUUID: `${plID}`,
|
||||||
pl: playlist.toString()
|
pl: playlist.toString(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
@ -171,7 +168,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
text: `${plName}\nPrev cue`,
|
text: `${plName}\nPrev cue`,
|
||||||
size: textSize,
|
size: textSize,
|
||||||
color: combineRgb(255, 255, 255),
|
color: combineRgb(255, 255, 255),
|
||||||
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
|
bgcolor: instance.grayModuloPlayer,
|
||||||
},
|
},
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
|
|
@ -180,7 +177,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
actionId: 'prev_cue',
|
actionId: 'prev_cue',
|
||||||
options: {
|
options: {
|
||||||
plUUID: `${plID}`,
|
plUUID: `${plID}`,
|
||||||
pl: playlist.toString()
|
pl: playlist.toString(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
@ -199,7 +196,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
text: `${plName}\nGM\n0%`,
|
text: `${plName}\nGM\n0%`,
|
||||||
size: textSize,
|
size: textSize,
|
||||||
color: combineRgb(255, 255, 255),
|
color: combineRgb(255, 255, 255),
|
||||||
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
|
bgcolor: instance.grayModuloPlayer,
|
||||||
},
|
},
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
|
|
@ -210,7 +207,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
value: 0,
|
value: 0,
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
plUUID: `${plID}`,
|
plUUID: `${plID}`,
|
||||||
pl: playlist.toString()
|
pl: playlist.toString(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
@ -229,7 +226,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
text: `${plName}\nGM\n100%`,
|
text: `${plName}\nGM\n100%`,
|
||||||
size: textSize,
|
size: textSize,
|
||||||
color: combineRgb(255, 255, 255),
|
color: combineRgb(255, 255, 255),
|
||||||
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
|
bgcolor: instance.grayModuloPlayer,
|
||||||
},
|
},
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
|
|
@ -240,7 +237,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
value: 100,
|
value: 100,
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
plUUID: `${plID}`,
|
plUUID: `${plID}`,
|
||||||
pl: playlist.toString()
|
pl: playlist.toString(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
@ -259,7 +256,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
text: `${plName}\nAM\n0%`,
|
text: `${plName}\nAM\n0%`,
|
||||||
size: textSize,
|
size: textSize,
|
||||||
color: combineRgb(255, 255, 255),
|
color: combineRgb(255, 255, 255),
|
||||||
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
|
bgcolor: instance.grayModuloPlayer,
|
||||||
},
|
},
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
|
|
@ -270,7 +267,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
value: 0,
|
value: 0,
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
plUUID: `${plID}`,
|
plUUID: `${plID}`,
|
||||||
pl: playlist.toString()
|
pl: playlist.toString(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
@ -289,7 +286,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
text: `${plName}\nAM\n100%`,
|
text: `${plName}\nAM\n100%`,
|
||||||
size: textSize,
|
size: textSize,
|
||||||
color: combineRgb(255, 255, 255),
|
color: combineRgb(255, 255, 255),
|
||||||
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
|
bgcolor: instance.grayModuloPlayer,
|
||||||
},
|
},
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
|
|
@ -300,7 +297,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
value: 100,
|
value: 100,
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
plUUID: `${plID}`,
|
plUUID: `${plID}`,
|
||||||
pl: playlist.toString()
|
pl: playlist.toString(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
@ -345,7 +342,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
cueUUID: `${cl[cue]['uuid']}`,
|
cueUUID: `${cl[cue]['uuid']}`,
|
||||||
plUUID: `${plID}`,
|
plUUID: `${plID}`,
|
||||||
index: `${cue + 1}`,
|
index: `${cue + 1}`,
|
||||||
pl: playlist.toString()
|
pl: playlist.toString(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
@ -366,7 +363,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
pl: uuid,
|
pl: uuid,
|
||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
bgcolor: combineRgb(colorOrangeMP[0], colorOrangeMP[1], colorOrangeMP[2]),
|
bgcolor: instance.orangeModuloPlayer,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
@ -392,7 +389,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
text: `Preload\n$(Modulo_Player:cue_${cuuid}_name)`,
|
text: `Preload\n$(Modulo_Player:cue_${cuuid}_name)`,
|
||||||
size: textSize,
|
size: textSize,
|
||||||
color: combineRgb(255, 255, 255),
|
color: combineRgb(255, 255, 255),
|
||||||
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
|
bgcolor: instance.grayModuloPlayer,
|
||||||
},
|
},
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
|
|
@ -403,7 +400,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
cueUUID: `${cl[cue]['uuid']}`,
|
cueUUID: `${cl[cue]['uuid']}`,
|
||||||
plUUID: `${plID}`,
|
plUUID: `${plID}`,
|
||||||
index: `${cue + 1}`,
|
index: `${cue + 1}`,
|
||||||
pl: playlist.toString()
|
pl: playlist.toString(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
@ -424,7 +421,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
pl: uuid,
|
pl: uuid,
|
||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
bgcolor: combineRgb(colorOrangeMP[0], colorOrangeMP[1], colorOrangeMP[2]),
|
bgcolor: instance.orangeModuloPlayer,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
@ -448,7 +445,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
text: `Save`,
|
text: `Save`,
|
||||||
size: textSize,
|
size: textSize,
|
||||||
color: combineRgb(255, 255, 255),
|
color: combineRgb(255, 255, 255),
|
||||||
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
|
bgcolor: instance.grayModuloPlayer,
|
||||||
},
|
},
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
|
|
@ -472,7 +469,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
text: `Backup`,
|
text: `Backup`,
|
||||||
size: textSize,
|
size: textSize,
|
||||||
color: combineRgb(255, 255, 255),
|
color: combineRgb(255, 255, 255),
|
||||||
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
|
bgcolor: instance.grayModuloPlayer,
|
||||||
},
|
},
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
|
|
@ -496,7 +493,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
text: `Rescan Medias`,
|
text: `Rescan Medias`,
|
||||||
size: textSize,
|
size: textSize,
|
||||||
color: combineRgb(255, 255, 255),
|
color: combineRgb(255, 255, 255),
|
||||||
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
|
bgcolor: instance.grayModuloPlayer,
|
||||||
},
|
},
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
|
|
@ -520,7 +517,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
text: `Rescan Medias Force`,
|
text: `Rescan Medias Force`,
|
||||||
size: textSize,
|
size: textSize,
|
||||||
color: combineRgb(255, 255, 255),
|
color: combineRgb(255, 255, 255),
|
||||||
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
|
bgcolor: instance.grayModuloPlayer,
|
||||||
},
|
},
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
|
|
@ -544,7 +541,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
text: `Remove Missing Medias`,
|
text: `Remove Missing Medias`,
|
||||||
size: textSize,
|
size: textSize,
|
||||||
color: combineRgb(255, 255, 255),
|
color: combineRgb(255, 255, 255),
|
||||||
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
|
bgcolor: instance.grayModuloPlayer,
|
||||||
},
|
},
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
|
|
@ -568,7 +565,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
text: `Send Show to All Remotes`,
|
text: `Send Show to All Remotes`,
|
||||||
size: textSize,
|
size: textSize,
|
||||||
color: combineRgb(255, 255, 255),
|
color: combineRgb(255, 255, 255),
|
||||||
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
|
bgcolor: instance.grayModuloPlayer,
|
||||||
},
|
},
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
|
|
@ -592,13 +589,21 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
|
|
||||||
variablesPresets.push({
|
variablesPresets.push({
|
||||||
category: `Variables`,
|
category: `Variables`,
|
||||||
name: `$(Modulo_Player:serverName) Master`,
|
name: 'General',
|
||||||
|
type: 'text',
|
||||||
|
//text: 'Generals',
|
||||||
|
})
|
||||||
|
|
||||||
|
// STATUS
|
||||||
|
variablesPresets.push({
|
||||||
|
category: `Variables`,
|
||||||
|
name: `Satut`,
|
||||||
type: 'button',
|
type: 'button',
|
||||||
style: {
|
style: {
|
||||||
text: `$(Modulo_Player:serverName) Master`,
|
text: `Satut`,
|
||||||
size: textSize,
|
size: textSize,
|
||||||
color: combineRgb(255, 255, 255),
|
color: combineRgb(255, 255, 255),
|
||||||
bgcolor: combineRgb(colorGreenMP[0], colorGreenMP[1], colorGreenMP[2]),
|
bgcolor: instance.greenModuloPlayer,
|
||||||
},
|
},
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
|
|
@ -607,6 +612,61 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
feedbacks: [
|
feedbacks: [
|
||||||
|
{
|
||||||
|
feedbackId: 'status',
|
||||||
|
options: {
|
||||||
|
status: 0,
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
text: `Offline`,
|
||||||
|
bgcolor: combineRgb(255, 0, 0),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
feedbackId: 'status',
|
||||||
|
options: {
|
||||||
|
status: 1,
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
text: `Launching`,
|
||||||
|
bgcolor: instance.orangeModuloPlayer,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
feedbackId: 'status',
|
||||||
|
options: {
|
||||||
|
status: 2,
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
text: `Online`,
|
||||||
|
bgcolor: instance.greenModuloPlayer,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
// NAME
|
||||||
|
variablesPresets.push({
|
||||||
|
category: `Variables`,
|
||||||
|
name: `Name\nMaster\nor\nSlave`,
|
||||||
|
type: 'button',
|
||||||
|
style: {
|
||||||
|
text: `Name\nMaster\nor\nSlave`,
|
||||||
|
size: textSize,
|
||||||
|
color: combineRgb(255, 255, 255),
|
||||||
|
bgcolor: instance.getCombineRGBFromHex(instance.states['color']),
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
down: [],
|
||||||
|
up: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
feedbacks: [
|
||||||
|
{
|
||||||
|
feedbackId: 'color',
|
||||||
|
options: {},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
feedbackId: 'master',
|
feedbackId: 'master',
|
||||||
options: {
|
options: {
|
||||||
|
|
@ -625,45 +685,138 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
text: `$(Modulo_Player:serverName) Slave`,
|
text: `$(Modulo_Player:serverName) Slave`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
],
|
||||||
feedbackId: 'status',
|
})
|
||||||
options: {
|
|
||||||
status: 0,
|
// FPS
|
||||||
},
|
variablesPresets.push({
|
||||||
|
category: `Variables`,
|
||||||
|
name: `FPS\n$(Modulo_Player:fps)`,
|
||||||
|
type: 'button',
|
||||||
style: {
|
style: {
|
||||||
bgcolor: combineRgb(255, 0, 0),
|
text: `FPS\n$(Modulo_Player:fps)`,
|
||||||
|
size: textSize,
|
||||||
|
color: combineRgb(255, 255, 255),
|
||||||
|
bgcolor: instance.greenModuloPlayer,
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
down: [],
|
||||||
|
up: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
feedbacks: [
|
||||||
|
{
|
||||||
|
feedbackId: 'fps_ok',
|
||||||
|
options: {},
|
||||||
|
style: {
|
||||||
|
bgcolor: instance.greenModuloPlayer,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
feedbackId: 'status',
|
feedbackId: 'fps_ok',
|
||||||
options: {
|
options: {},
|
||||||
status: 1,
|
|
||||||
},
|
|
||||||
style: {
|
style: {
|
||||||
bgcolor: combineRgb(colorOrangeMP[0], colorOrangeMP[1], colorOrangeMP[2]),
|
bgcolor: instance.redModuloPlayer,
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
feedbackId: 'status',
|
|
||||||
options: {
|
|
||||||
status: 2,
|
|
||||||
},
|
|
||||||
style: {
|
|
||||||
bgcolor: combineRgb(colorGreenMP[0], colorGreenMP[1], colorGreenMP[2]),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// MEMORY USE
|
||||||
variablesPresets.push({
|
variablesPresets.push({
|
||||||
category: `Variables`,
|
category: `Variables`,
|
||||||
name: `$(Modulo_Player:serverName)`,
|
name: `Memory\n$(Modulo_Player:memoryUse) %`,
|
||||||
type: 'button',
|
type: 'button',
|
||||||
style: {
|
style: {
|
||||||
text: `$(Modulo_Player:serverName)`,
|
text: `Memory\n$(Modulo_Player:memoryUse) %`,
|
||||||
size: textSize,
|
size: textSize,
|
||||||
color: combineRgb(255, 255, 255),
|
color: combineRgb(255, 255, 255),
|
||||||
bgcolor: combineRgb(instance.states['color'][0], instance.states['color'][1], instance.states['color'][2]),
|
bgcolor: instance.greenModuloPlayer,
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
down: [],
|
||||||
|
up: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
feedbacks: [
|
||||||
|
{
|
||||||
|
feedbackId: 'memory_use',
|
||||||
|
options: {},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
// CPU USE
|
||||||
|
variablesPresets.push({
|
||||||
|
category: `Variables`,
|
||||||
|
name: `CPU\n$(Modulo_Player:cpuUse) %`,
|
||||||
|
type: 'button',
|
||||||
|
style: {
|
||||||
|
text: `CPU\n$(Modulo_Player:cpuUse) %`,
|
||||||
|
size: textSize,
|
||||||
|
color: combineRgb(255, 255, 255),
|
||||||
|
bgcolor: instance.greenModuloPlayer,
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
down: [],
|
||||||
|
up: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
feedbacks: [
|
||||||
|
{
|
||||||
|
feedbackId: 'cpu_use',
|
||||||
|
options: {},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
// DYNAMIC INFO
|
||||||
|
variablesPresets.push({
|
||||||
|
category: `Variables`,
|
||||||
|
name: 'Dynamic Info',
|
||||||
|
type: 'text',
|
||||||
|
//text: 'Generals',
|
||||||
|
})
|
||||||
|
|
||||||
|
const dynamicArray: { [key: string]: any } = instance.dynamicInfo
|
||||||
|
for (var key in dynamicArray) {
|
||||||
|
if (key === 'color') {
|
||||||
|
variablesPresets.push({
|
||||||
|
category: `Variables`,
|
||||||
|
name: `Color Player`,
|
||||||
|
type: 'button',
|
||||||
|
style: {
|
||||||
|
text: `Color Player`,
|
||||||
|
size: textSize,
|
||||||
|
color: combineRgb(255, 255, 255),
|
||||||
|
bgcolor: instance.getCombineRGBFromHex(instance.states['color']),
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
down: [],
|
||||||
|
up: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
feedbacks: [
|
||||||
|
{
|
||||||
|
feedbackId: 'color',
|
||||||
|
options: {},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
variablesPresets.push({
|
||||||
|
category: `Variables`,
|
||||||
|
name: `(Modulo_Player:${key})`,
|
||||||
|
type: 'button',
|
||||||
|
style: {
|
||||||
|
text: `$(Modulo_Player:${key})`,
|
||||||
|
size: textSize,
|
||||||
|
color: combineRgb(255, 255, 255),
|
||||||
|
//bgcolor: instance.getCombineRGBFromHex(instance.states['color']),
|
||||||
},
|
},
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
|
|
@ -673,11 +826,48 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
||||||
],
|
],
|
||||||
feedbacks: [],
|
feedbacks: [],
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// STATIC INFO
|
||||||
|
variablesPresets.push({
|
||||||
|
category: `Variables`,
|
||||||
|
name: 'Static Info',
|
||||||
|
type: 'text',
|
||||||
|
//text: 'Generals',
|
||||||
|
})
|
||||||
|
|
||||||
|
const staticInfo: { [key: string]: any } = instance.staticInfo
|
||||||
|
for (var key in staticInfo) {
|
||||||
|
variablesPresets.push({
|
||||||
|
category: `Variables`,
|
||||||
|
name: `(Modulo_Player:${key})`,
|
||||||
|
type: 'button',
|
||||||
|
style: {
|
||||||
|
text: `$(Modulo_Player:${key})`,
|
||||||
|
size: textSize,
|
||||||
|
color: combineRgb(255, 255, 255),
|
||||||
|
//bgcolor: instance.getCombineRGBFromHex(instance.states['color']),
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
down: [],
|
||||||
|
up: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
feedbacks: [],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return variablesPresets
|
return variablesPresets
|
||||||
}
|
}
|
||||||
|
|
||||||
const presets: mpPresetArray = [...getTasksPresets(), ...getPlayListsCuesPresets(), ...getShowPresets(), ...getVariablesPresets()]
|
let presets: mpPresetArray = []
|
||||||
|
if (instance.sdConnected) {
|
||||||
|
presets = [...getTasksPresets(), ...getPlayListsCuesPresets(), ...getShowPresets(), ...getVariablesPresets()]
|
||||||
|
} else {
|
||||||
|
presets = [...getTasksPresets(), ...getPlayListsCuesPresets(), ...getShowPresets()]
|
||||||
|
}
|
||||||
|
|
||||||
return presets as unknown as CompanionPresetDefinitions
|
return presets as unknown as CompanionPresetDefinitions
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ export class SDconnection {
|
||||||
async connect(addr: string | undefined, port: any): Promise<void> {
|
async connect(addr: string | undefined, port: any): Promise<void> {
|
||||||
this.mpAddr = addr
|
this.mpAddr = addr
|
||||||
this.sdPort = port
|
this.sdPort = port
|
||||||
this.instance!.log('debug', `WEBSOCKET SD CONNECT ${this.mpAddr} ${this.sdPort}`)
|
//this.instance!.log('debug', `WEBSOCKET SD CONNECT ${this.mpAddr} ${this.sdPort}`)
|
||||||
if (this.mpAddr === undefined || this.sdPort == null) return
|
if (this.mpAddr === undefined || this.sdPort == null) return
|
||||||
this.shouldBeConnected = true
|
this.shouldBeConnected = true
|
||||||
|
|
||||||
|
|
@ -113,7 +113,7 @@ export class SDconnection {
|
||||||
this.websocket = null
|
this.websocket = null
|
||||||
this.instance.sdConnected = false
|
this.instance.sdConnected = false
|
||||||
this.instance.isConnected()
|
this.instance.isConnected()
|
||||||
this.instance!.log('debug', 'Connection has been destroyed due to removal or disable by user')
|
//this.instance!.log('debug', 'Connection has been destroyed due to removal or disable by user')
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly initPolling = (): void => {
|
public readonly initPolling = (): void => {
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,9 @@
|
||||||
import { MPinstance } from './main.js'
|
import { MPinstance } from './main.js'
|
||||||
//import { getPresets } from './presets.js'
|
|
||||||
|
|
||||||
// JSON ID
|
// JSON ID
|
||||||
// 1 = list Tasks,
|
|
||||||
// 2 = Launch Task,
|
|
||||||
// 3 = list Playlist
|
|
||||||
|
|
||||||
// 100 = CURRENT CUE LIST
|
|
||||||
// 110 = ACTION GOTO
|
|
||||||
// 200 = SPYDOG DYNAMIC INFO
|
// 200 = SPYDOG DYNAMIC INFO
|
||||||
// 201 = SPYDOG STATIC INFO
|
// 201 = SPYDOG STATIC INFO
|
||||||
|
|
||||||
export function hexToRgb(hex: any) {
|
|
||||||
const normal = hex.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i)
|
|
||||||
if (normal) return normal.slice(1).map((e: string) => parseInt(e, 16))
|
|
||||||
|
|
||||||
const shorthand = hex.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i)
|
|
||||||
if (shorthand) return shorthand.slice(1).map((e: string) => 0x11 * parseInt(e, 16))
|
|
||||||
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
export class SpyDog {
|
export class SpyDog {
|
||||||
instance: MPinstance
|
instance: MPinstance
|
||||||
|
|
||||||
|
|
@ -51,16 +34,17 @@ export class SpyDog {
|
||||||
}
|
}
|
||||||
|
|
||||||
async setStaticInfo(objs: any) {
|
async setStaticInfo(objs: any) {
|
||||||
|
this.instance.staticInfo = objs[0]
|
||||||
for (var key in objs[0]) {
|
for (var key in objs[0]) {
|
||||||
// this.instance.log(
|
// this.instance.log(
|
||||||
// 'info',
|
// 'info',
|
||||||
// `MODULO SPYDOG | SET STATIC INFO | ELEMENTS >>> ${key}: ${objs[0][key]} ${typeof objs[0][key]}`,
|
// `MODULO SPYDOG | SET STATIC INFO | ELEMENTS >>> ${key}: ${objs[0][key]} ${typeof objs[0][key]}`,
|
||||||
// )
|
// )
|
||||||
var objTemp: any = {}
|
var objTemp: any = {}
|
||||||
if (typeof objs[0][key] === "number") {
|
if (typeof objs[0][key] === 'number') {
|
||||||
objTemp = { [`${key}`]: parseInt(objs[0][key]), }
|
objTemp = { [`${key}`]: parseInt(objs[0][key]) }
|
||||||
} else {
|
} else {
|
||||||
objTemp = { [`${key}`]: objs[0][key], }
|
objTemp = { [`${key}`]: objs[0][key] }
|
||||||
}
|
}
|
||||||
this.instance.states[`${key}`] = objs[0][key]
|
this.instance.states[`${key}`] = objs[0][key]
|
||||||
this.instance.setVariableValues(objTemp)
|
this.instance.setVariableValues(objTemp)
|
||||||
|
|
@ -70,26 +54,21 @@ export class SpyDog {
|
||||||
}
|
}
|
||||||
|
|
||||||
async setDynamicInfo(objs: any) {
|
async setDynamicInfo(objs: any) {
|
||||||
|
this.instance.dynamicInfo = objs[0]
|
||||||
for (var key in objs[0]) {
|
for (var key in objs[0]) {
|
||||||
// this.instance.log(
|
// this.instance.log(
|
||||||
// 'info',
|
// 'info',
|
||||||
// `MODULO SPYDOG | SET DYNAMIC INFO | ELEMENTS >>> ${key}: ${objs[0][key]} ${typeof objs[0][key]}`,
|
// `MODULO SPYDOG | SET DYNAMIC INFO | ELEMENTS >>> ${key}: ${objs[0][key]} ${typeof objs[0][key]}`,
|
||||||
// )
|
// )
|
||||||
var objTemp: any = {}
|
var objTemp: any = {}
|
||||||
if (typeof objs[0][key] === "number") {
|
if (typeof objs[0][key] === 'number') {
|
||||||
objTemp = { [`${key}`]: parseInt(objs[0][key]), }
|
objTemp = { [`${key}`]: parseInt(objs[0][key]) }
|
||||||
} else {
|
} else {
|
||||||
objTemp = { [`${key}`]: objs[0][key], }
|
objTemp = { [`${key}`]: objs[0][key] }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (`${key}` === "color") {
|
if (`${key}` === 'color') {
|
||||||
if (objs[0][key] == "transparent"){
|
this.instance.states[`${key}`] = objs[0][key]
|
||||||
objTemp = { [`${key}`]: hexToRgb("#000000"), }
|
|
||||||
this.instance.states[`${key}`] = hexToRgb("#000000")
|
|
||||||
} else {
|
|
||||||
objTemp = { [`${key}`]: hexToRgb(objs[0][key]), }
|
|
||||||
this.instance.states[`${key}`] = hexToRgb(objs[0][key])
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this.instance.states[`${key}`] = objs[0][key]
|
this.instance.states[`${key}`] = objs[0][key]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,22 +2,22 @@ import { CompanionVariableValues, combineRgb } from '@companion-module/base/dist
|
||||||
import type { MPinstance } from './main.js'
|
import type { MPinstance } from './main.js'
|
||||||
|
|
||||||
export function UpdateVariableDefinitions(instance: MPinstance): void {
|
export function UpdateVariableDefinitions(instance: MPinstance): void {
|
||||||
instance.log('info', 'VARIABLES DEFINITIONS !')
|
//instance.log('info', 'VARIABLES DEFINITIONS !')
|
||||||
// CUES
|
// CUES
|
||||||
const pls: any[] = instance.playLists
|
const pls: any[] = instance.playLists
|
||||||
const variables = []
|
const variables = []
|
||||||
for (let pl = 0; pl < pls.length; pl++) {
|
for (let pl = 0; pl < pls.length; pl++) {
|
||||||
// CURRENT PL
|
// CURRENT PL
|
||||||
const cpl = pls[pl];
|
const cpl = pls[pl]
|
||||||
const uuidPL: String = instance.cleanUUID(cpl['uuid'])
|
const uuidPL: String = instance.cleanUUID(cpl['uuid'])
|
||||||
variables.push({ variableId: `pl_${uuidPL}_currentIndex`, name: `${cpl['name']} Current Cue ` })
|
variables.push({ variableId: `pl_${uuidPL}_currentIndex`, name: `${cpl['name']} Current Cue ` })
|
||||||
variables.push({ variableId: `pl_${uuidPL}_grandMasterFader`, name: `${cpl['name']} Grand Master Fader ` })
|
variables.push({ variableId: `pl_${uuidPL}_grandMasterFader`, name: `${cpl['name']} Grand Master Fader ` })
|
||||||
|
|
||||||
// CUES LIST
|
// CUES LIST
|
||||||
const cueslist: any = cpl["cues"]
|
const cueslist: any = cpl['cues']
|
||||||
//instance.log('warn', `VARIABLES DEFINITIONS | GET CUES LIST >>> ${instance.playLists}`)
|
//instance.log('warn', `VARIABLES DEFINITIONS | GET CUES LIST >>> ${instance.playLists}`)
|
||||||
for (let cue = 0; cue < cueslist.length; cue++) {
|
for (let cue = 0; cue < cueslist.length; cue++) {
|
||||||
const c = cueslist[cue];
|
const c = cueslist[cue]
|
||||||
const uuidCue: String = instance.cleanUUID(c['uuid'])
|
const uuidCue: String = instance.cleanUUID(c['uuid'])
|
||||||
variables.push({ variableId: `cue_${uuidCue}_name`, name: `Cue Name` })
|
variables.push({ variableId: `cue_${uuidCue}_name`, name: `Cue Name` })
|
||||||
variables.push({ variableId: `cue_${uuidCue}_color`, name: `Cue Color` })
|
variables.push({ variableId: `cue_${uuidCue}_color`, name: `Cue Color` })
|
||||||
|
|
@ -33,6 +33,7 @@ export function UpdateVariableDefinitions(instance: MPinstance): void {
|
||||||
variables.push({ variableId: `tl_${tlUuid}_color`, name: `Task Color` })
|
variables.push({ variableId: `tl_${tlUuid}_color`, name: `Task Color` })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (instance.sdConnected) {
|
||||||
// SPYDOG STATIC INFO
|
// SPYDOG STATIC INFO
|
||||||
variables.push({ variableId: 'CPU', name: 'CPU' })
|
variables.push({ variableId: 'CPU', name: 'CPU' })
|
||||||
variables.push({ variableId: 'GpuBrand', name: 'GPU Brand' })
|
variables.push({ variableId: 'GpuBrand', name: 'GPU Brand' })
|
||||||
|
|
@ -63,31 +64,34 @@ export function UpdateVariableDefinitions(instance: MPinstance): void {
|
||||||
variables.push({ variableId: 'serverTime', name: 'Server Time' })
|
variables.push({ variableId: 'serverTime', name: 'Server Time' })
|
||||||
variables.push({ variableId: 'status', name: 'Status' })
|
variables.push({ variableId: 'status', name: 'Status' })
|
||||||
variables.push({ variableId: 'upTime', name: 'UP Time' })
|
variables.push({ variableId: 'upTime', name: 'UP Time' })
|
||||||
|
}
|
||||||
|
|
||||||
instance.setVariableDefinitions(variables)
|
instance.setVariableDefinitions(variables)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function InitVariableDefinitions(instance: MPinstance): void {
|
export function InitVariableDefinitions(instance: MPinstance): void {
|
||||||
instance.log('info', 'INIT VARIABLES DEFINITIONS !')
|
//instance.log('info', 'INIT VARIABLES DEFINITIONS !')
|
||||||
// CUES
|
// CUES
|
||||||
const pls: any[] = instance.playLists
|
const pls: any[] = instance.playLists
|
||||||
const variables: CompanionVariableValues = {};
|
const variables: CompanionVariableValues = {}
|
||||||
for (let pl = 0; pl < pls.length; pl++) {
|
for (let pl = 0; pl < pls.length; pl++) {
|
||||||
// CURRENT PL
|
// CURRENT PL
|
||||||
const cpl = pls[pl];
|
const cpl = pls[pl]
|
||||||
// CUES LIST
|
// CUES LIST
|
||||||
const cueslist: any = cpl["cues"]
|
const cueslist: any = cpl['cues']
|
||||||
//instance.log('warn', `VARIABLES DEFINITIONS | GET CUES LIST >>> ${instance.playLists}`)
|
//instance.log('warn', `VARIABLES DEFINITIONS | GET CUES LIST >>> ${instance.playLists}`)
|
||||||
for (let cue = 0; cue < cueslist.length; cue++) {
|
for (let cue = 0; cue < cueslist.length; cue++) {
|
||||||
const c = cueslist[cue];
|
const c = cueslist[cue]
|
||||||
const uuidCue: String = instance.cleanUUID(c['uuid'])
|
const uuidCue: String = instance.cleanUUID(c['uuid'])
|
||||||
let n = c['name']
|
let n = c['name']
|
||||||
if (n === '') { n = `Cue ${cue + 1}` }
|
if (n === '') {
|
||||||
|
n = `Cue ${cue + 1}`
|
||||||
|
}
|
||||||
const id = `cue_${uuidCue}_name`
|
const id = `cue_${uuidCue}_name`
|
||||||
const idColor = `cue_${uuidCue}_color`
|
const idColor = `cue_${uuidCue}_color`
|
||||||
const couleurRgb = instance.getColorFromHex(`${c['uiColor']}`)
|
const couleurRgb = instance.getColorFromHex(`${c['uiColor']}`)
|
||||||
variables[id] = `${n}`;
|
variables[id] = `${n}`
|
||||||
variables[idColor] = combineRgb(couleurRgb[0], couleurRgb[1], couleurRgb[2]).toString();
|
variables[idColor] = combineRgb(couleurRgb[0], couleurRgb[1], couleurRgb[2]).toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -100,8 +104,8 @@ export function InitVariableDefinitions(instance: MPinstance): void {
|
||||||
const id = `tl_${tlUuid}_name`
|
const id = `tl_${tlUuid}_name`
|
||||||
const idColor = `tl_${tlUuid}_color`
|
const idColor = `tl_${tlUuid}_color`
|
||||||
const couleurRgb = instance.getColorFromHex(`${tls[tl]['uiColor']}`)
|
const couleurRgb = instance.getColorFromHex(`${tls[tl]['uiColor']}`)
|
||||||
variables[id] = `${tlName}`;
|
variables[id] = `${tlName}`
|
||||||
variables[idColor] = combineRgb(couleurRgb[0], couleurRgb[1], couleurRgb[2]).toString();
|
variables[idColor] = combineRgb(couleurRgb[0], couleurRgb[1], couleurRgb[2]).toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.setVariableValues(variables)
|
instance.setVariableValues(variables)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue