companion-module-modulopi-m.../src/feedbacks.ts

137 lines
2.8 KiB
TypeScript
Executable File

import { combineRgb } from '@companion-module/base'
import type { MPinstance } from './main.js'
const colorGreenMP = [88, 201, 23]
export function UpdateFeedbacks(self: MPinstance): void {
self.setFeedbackDefinitions({
color_cue: {
name: 'PlayList Color Cue',
type: 'boolean',
defaultStyle: {
bgcolor: combineRgb(255, 0, 0),
color: combineRgb(0, 0, 0),
},
options: [
{
id: 'current_Cue',
type: 'number',
label: 'ID',
default: 1,
min: 1,
max: 10000,
},
{
id: 'pl',
type: 'textinput',
label: 'Playlist UUID',
default: '',
},
],
callback: (feedback) => {
console.log(
'FEEDBACK | Color Cue: ' +
feedback.options.current_Cue + " >>> " +
feedback.options.pl + " >>> " +
self.states[`pl_${feedback.options.pl}_currentIndex`]
+ " >>> " + (self.states[`pl_${feedback.options.pl}_currentIndex`] !== feedback.options.current_Cue)
)
if (self.states[`pl_${feedback.options.pl}_currentIndex`] !== feedback.options.current_Cue) {
return true
} else {
return false
}
},
},
current_Cue: {
name: 'PlayList Current Cue',
type: 'boolean',
defaultStyle: {
bgcolor: combineRgb(255, 0, 0),
color: combineRgb(0, 0, 0),
},
options: [
{
id: 'current_Cue',
type: 'number',
label: 'ID',
default: 1,
min: 1,
max: 10000,
},
{
id: 'pl',
type: 'textinput',
label: 'Playlist UUID',
default: '',
},
],
callback: (feedback) => {
// console.log(
// 'FEEDBACK | Current Cue ID Change State: ' +
// feedback.options.pl +
// self.states[`pl_${feedback.options.pl}_currentIndex`] +
// ' / id: ' +
// feedback.options.current_Cue,
// )
if (self.states[`pl_${feedback.options.pl}_currentIndex`] === feedback.options.current_Cue) {
return true
} else {
return false
}
},
},
status: {
name: 'Modulo Player Status',
type: 'boolean',
defaultStyle: {
bgcolor: combineRgb(colorGreenMP[0], colorGreenMP[1], colorGreenMP[2]),
},
options: [
{
id: 'status',
type: 'number',
label: 'Modulo Player Status',
default: 0,
min: 0,
max: 2,
},
],
callback: (feedback) => {
if (feedback.options.status === self.states[`status`]) {
return true
} else {
return false
}
},
},
master: {
name: 'Modulo Player Master',
type: 'boolean',
defaultStyle: {
text: 'Master',
bgcolor: combineRgb(255, 0, 0),
color: combineRgb(0, 0, 0),
},
options: [
{
id: 'master',
type: 'number',
label: 'Master',
default: 1,
min: 0,
max: 1,
},
],
callback: async (feedback) => {
if (feedback.options.master === self.states[`master`]) {
return true
} else {
return false
}
},
},
})
}