cmit 240625

Show actions presets
This commit is contained in:
knicolas22 2025-06-24 04:47:07 +02:00
parent fbdaf64558
commit 805c1288be
6 changed files with 889 additions and 93 deletions

View File

@ -4,7 +4,7 @@ export function UpdateActions(self: MPinstance): void {
self.setActionDefinitions({ self.setActionDefinitions({
// LAUNCH TASK // LAUNCH TASK
launch_task: { launch_task: {
name: 'Launch Task (ID)', name: 'Launch Task {uuid}',
options: [ options: [
{ {
id: 'task', id: 'task',
@ -14,14 +14,14 @@ 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) self.mpConnection.sendMessageLunchTask(event.options.task, 2)
}, },
}, },
// GOTO CUE // GOTO CUE
goto_cue: { goto_cue: {
name: 'Launch Cue (ID) on Playlist (ID)', name: 'Launch Cue (ID) from Playlist',
options: [ options: [
{ {
id: 'index', id: 'index',
@ -32,32 +32,218 @@ export function UpdateActions(self: MPinstance): void {
max: 10000, max: 10000,
}, },
{ {
id: 'cue', id: 'cueUUID',
type: 'textinput', type: 'textinput',
label: 'Cue UUID', label: 'Cue UUID',
default: '', default: '',
isVisible: () => (false),
},
{
id: 'plUUID',
type: 'textinput',
label: 'Playlist uuid',
default: '',
isVisible: () => (false),
}, },
{ {
id: 'pl', id: 'pl',
type: 'textinput', type: 'dropdown',
label: 'Playlist ID', label: 'Select Playlist',
default: '', choices: self.dropdownPlayList,
}, default: `0`
}
], ],
callback: async (event) => { callback: async (event) => {
console.log(`Launch Cue ID: ${event.options.index} from Playlist UUID: ${event.options.pl}`) let id = 0
self.moduloplayer?.setGotoCue(event.options.pl, event.options.index) if (typeof event.options.pl === 'string') {
id = parseInt(event.options.pl, 10);
}
const pl = self.dropdownPlayList[id]
// 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"]}`)
self.moduloplayer?.setGotoCue(pl["uuid"], event.options.index)
}, },
}, },
// PRELOAD CUE
preload_cue: {
name: 'Preload Cue (ID) from Playlist',
options: [
{
id: 'index',
type: 'number',
label: 'Cue ID',
default: 1,
min: 1,
max: 10000,
},
{
id: 'cueUUID',
type: 'textinput',
label: 'Cue UUID',
default: '',
isVisible: () => (false),
},
{
id: 'plUUID',
type: 'textinput',
label: 'Playlist uuid',
default: '',
isVisible: () => (false),
},
{
id: 'pl',
type: 'dropdown',
label: 'Select Playlist',
choices: self.dropdownPlayList,
default: `0`
}
],
callback: async (event) => {
let id = 0
if (typeof event.options.pl === 'string') {
id = parseInt(event.options.pl, 10);
}
const pl = self.dropdownPlayList[id]
// 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"]}`)
self.moduloplayer?.setPreloadCue(pl["uuid"], event.options.index)
},
},
// PLAY CUE
play_pl: {
name: 'Play Playlist',
options: [
{
id: 'plUUID',
type: 'textinput',
label: 'Playlist UUID',
default: '',
isVisible: () => (false),
},
{
id: 'pl',
type: 'dropdown',
label: 'Select Playlist',
choices: self.dropdownPlayList,
default: `0`
}
],
callback: async (event) => {
let id = 0
if (typeof event.options.pl === 'string') {
id = parseInt(event.options.pl, 10);
}
const pl = self.dropdownPlayList[id]
self.moduloplayer?.setPlay(pl["uuid"])
},
},
// PLAY CUE
pause_pl: {
name: 'Pause Playlist',
options: [
{
id: 'plUUID',
type: 'textinput',
label: 'Playlist UUID',
default: '',
isVisible: () => (false),
},
{
id: 'pl',
type: 'dropdown',
label: 'Select Playlist',
choices: self.dropdownPlayList,
default: `0`
}
],
callback: async (event) => {
let id = 0
if (typeof event.options.pl === 'string') {
id = parseInt(event.options.pl, 10);
}
const pl = self.dropdownPlayList[id]
self.moduloplayer?.setPause(pl["uuid"])
},
},
// NEXT CUE
next_cue: {
name: 'Next Cue on Playlist',
options: [
{
id: 'plUUID',
type: 'textinput',
label: 'Playlist UUID',
default: '',
isVisible: () => (false),
},
{
id: 'pl',
type: 'dropdown',
label: 'Select Playlist',
choices: self.dropdownPlayList,
default: `0`
}
],
callback: async (event) => {
let id = 0
if (typeof event.options.pl === 'string') {
id = parseInt(event.options.pl, 10);
}
const pl = self.dropdownPlayList[id]
self.moduloplayer?.setNextCue(pl["uuid"])
},
},
// PREV CUE
prev_cue: {
name: 'Next Cue on Playlist',
options: [
{
id: 'plUUID',
type: 'textinput',
label: 'Playlist UUID',
default: '',
isVisible: () => (false),
},
{
id: 'pl',
type: 'dropdown',
label: 'Select Playlist',
choices: self.dropdownPlayList,
default: `0`
}
],
callback: async (event) => {
let id = 0
if (typeof event.options.pl === 'string') {
id = parseInt(event.options.pl, 10);
}
const pl = self.dropdownPlayList[id]
self.moduloplayer?.setPrevCue(pl["uuid"])
},
},
// GRAND MASTER FADER
pl_grand_master_fader: { pl_grand_master_fader: {
name: 'GrandMaster Fader on Playlist (ID)', name: 'GrandMaster Fader on Playlist (ID)',
options: [ options: [
{ {
id: 'pl', id: 'pl',
type: 'dropdown',
label: 'Select Playlist',
choices: self.dropdownPlayList,
default: `0`
},
{
id: 'plUUID',
type: 'textinput', type: 'textinput',
label: 'Playlist ID', label: 'Playlist ID',
default: '', default: '',
isVisible: () => (false),
}, },
{ {
id: 'value', id: 'value',
@ -77,11 +263,112 @@ export function UpdateActions(self: MPinstance): void {
}, },
], ],
callback: async (event) => { callback: async (event) => {
self.log( let id = 0
'info', if (typeof event.options.pl === 'string') {
`SET GRAND MASTER PL: ${event.options.pl} | value: ${event.options.value} | duration: ${event.options.duration}`, id = parseInt(event.options.pl, 10);
) }
self.moduloplayer?.setGrandMasterFader(event.options.pl, event.options.value, event.options.duration) const pl = self.dropdownPlayList[id]
self.moduloplayer?.setGrandMasterFader(pl["uuid"], event.options.value, event.options.duration)
},
},
// GRAND MASTER FADER
audio_master: {
name: 'Audio Master on Playlist',
options: [
{
id: 'pl',
type: 'dropdown',
label: 'Select Playlist',
choices: self.dropdownPlayList,
default: `0`
},
{
id: 'plUUID',
type: 'textinput',
label: 'Playlist ID',
default: '',
isVisible: () => (false),
},
{
id: 'value',
type: 'number',
label: 'Value in % (0 to 100)',
default: 100,
min: 0,
max: 100,
},
{
id: 'duration',
type: 'number',
label: 'Duration in ms (max 3600000 = 1 hour)',
default: 2000,
min: 0,
max: 3600000,
},
],
callback: async (event) => {
let id = 0
if (typeof event.options.pl === 'string') {
id = parseInt(event.options.pl, 10);
}
const pl = self.dropdownPlayList[id]
self.moduloplayer?.setAudioMaster(pl["uuid"], event.options.value, event.options.duration)
},
},
// ----- SHOW -----
// SAVE
save: {
name: 'Save Show',
options: [],
callback: async () => {
self.moduloplayer?.setShowSave()
},
},
// BACKUP
backup: {
name: 'Backup Show',
options: [],
callback: async () => {
self.moduloplayer?.setShowbackup()
},
},
// RESSCAN MEDIAS
rescan_medias: {
name: 'Rescan Medias',
options: [],
callback: async () => {
self.moduloplayer?.setShowRescanMedia()
},
},
// RESSCAN MEDIAS
remove_missing_medias: {
name: 'Remove Missing Medias',
options: [],
callback: async () => {
self.moduloplayer?.setShowRemoveMissingMedia()
},
},
// RESSCAN MEDIAS Froce
rescan_medias_force: {
name: 'Rescan Medias Force',
options: [],
callback: async () => {
self.moduloplayer?.setShowRescanMediaForce()
},
},
// RESSCAN MEDIAS Froce
send_show_to_remote: {
name: 'Send show to all remotes',
options: [],
callback: async () => {
self.moduloplayer?.setShowSendShowToRemote()
}, },
}, },
}) })

View File

@ -78,13 +78,6 @@ export function UpdateFeedbacks(self: MPinstance): void {
}, },
], ],
callback: (feedback) => { 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) { if (self.states[`pl_${feedback.options.pl}_currentIndex`] === feedback.options.current_Cue) {
return true return true
} else { } else {

View File

@ -34,6 +34,7 @@ export class MPinstance extends InstanceBase<ModuloPlayConfig> {
public tasksList = [] public tasksList = []
public playLists = [] public playLists = []
public states: IStringIndex = {} public states: IStringIndex = {}
public dropdownPlayList = []
// CONTRUCTOR // CONTRUCTOR
constructor(internal: unknown) { constructor(internal: unknown) {

View File

@ -54,11 +54,23 @@ export class ModuloPlayer {
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.instance.setPresetDefinitions(getPresets(this.instance)) this.instance.setPresetDefinitions(getPresets(this.instance))
this.instance.updateInstance() this.instance.updateInstance()
} }
} }
public setDropDownPL(pls: any) {
let plsa: any = []
for (let pl = 0; pl < pls.length; pl++) {
this.instance.log('info', `MODULO PLAYER | GET DROPDOWN >>> ${pl}`)
const obj = { id: `${pl}`, label: `${pls[pl]["name"]}`, uuid: `${pls[pl]["uuid"]}` }
plsa.push(obj)
}
this.instance.dropdownPlayList = plsa
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 !`)
@ -70,7 +82,7 @@ export class ModuloPlayer {
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
@ -96,6 +108,46 @@ export class ModuloPlayer {
this.instance.mpConnection.sendJsonMessage(m) this.instance.mpConnection.sendJsonMessage(m)
} }
async setPreloadCue(plUUID: any, cueID: any) {
var m = `{
"jsonrpc": "2.0",
"method": "doaction.playlist",
"params": {
"uuid": "${plUUID}",
"action": "preload",
"cue": ${cueID}
},
"id": 0
}`
this.instance.mpConnection.sendJsonMessage(m)
}
async setPlay(plUUID: any) {
var m = `{
"jsonrpc": "2.0",
"method": "doaction.playlist",
"params": {
"uuid": "${plUUID}",
"action": "play"
},
"id": 0
}`
this.instance.mpConnection.sendJsonMessage(m)
}
async setPause(plUUID: any) {
var m = `{
"jsonrpc": "2.0",
"method": "doaction.playlist",
"params": {
"uuid": "${plUUID}",
"action": "pause"
},
"id": 0
}`
this.instance.mpConnection.sendJsonMessage(m)
}
async setGrandMasterFader(_pl: any, _value: any, _duration: any) { async setGrandMasterFader(_pl: any, _value: any, _duration: any) {
var m = `{"jsonrpc":"2.0","method":"doaction.playlist", var m = `{"jsonrpc":"2.0","method":"doaction.playlist",
"params": { "params": {
@ -107,6 +159,17 @@ export class ModuloPlayer {
this.instance.mpConnection.sendJsonMessage(m) this.instance.mpConnection.sendJsonMessage(m)
} }
async setAudioMaster(_pl: any, _value: any, _duration: any) {
var m = `{"jsonrpc":"2.0","method":"doaction.playlist",
"params": {
"uuid": "${_pl}",
"action": "audioMaster",
"value": ${_value},
"duration": ${_duration}
},"id": ${110}}`
this.instance.mpConnection.sendJsonMessage(m)
}
async getTaskListModuloPlayer() { async getTaskListModuloPlayer() {
//this.instance.log('info', 'GET TASKS LIST') //this.instance.log('info', 'GET TASKS LIST')
this.instance.mpConnection?.sendMessage('get.list.tasks', 1) this.instance.mpConnection?.sendMessage('get.list.tasks', 1)
@ -116,6 +179,61 @@ export class ModuloPlayer {
//this.instance.log('info', 'GET PLAY LIST') //this.instance.log('info', 'GET PLAY LIST')
this.instance.mpConnection?.sendMessagePlaylistsCues() this.instance.mpConnection?.sendMessagePlaylistsCues()
} }
async setNextCue(plUUDI: any,) {
var m = `{"jsonrpc": "2.0", "method": "doaction.playlist",
"params": {
"uuid": "${plUUDI}",
"action": "next"
},"id": 0}`
this.instance.mpConnection.sendJsonMessage(m)
}
async setPrevCue(plUUDI: any,) {
var m = `{"jsonrpc": "2.0", "method": "doaction.playlist",
"params": {
"uuid": "${plUUDI}",
"action": "prev"
},"id": 0}`
this.instance.mpConnection.sendJsonMessage(m)
}
// SHOW FONCTIONS
// SAVE
async setShowSave() {
var m = `{"jsonrpc": "2.0", "method": "doaction.show", "params": {"action": "save"}, "id": 0}`
this.instance.mpConnection.sendJsonMessage(m)
}
// BACKUP
async setShowbackup() {
var m = `{"jsonrpc": "2.0", "method": "doaction.show", "params": {"action": "backup"}, "id": 0}`
this.instance.mpConnection.sendJsonMessage(m)
}
// RESCAN MEDIAS
async setShowRescanMedia() {
var m = `{"jsonrpc": "2.0", "method": "doaction.show", "params": {"action": "rescanmedia"}, "id": 0}`
this.instance.mpConnection.sendJsonMessage(m)
}
// REMOVE MISSING MEDIAS
async setShowRemoveMissingMedia() {
var m = `{"jsonrpc": "2.0", "method": "doaction.show", "params": {"action": "removemissingmedia"}, "id": 0}`
this.instance.mpConnection.sendJsonMessage(m)
}
// RESCAN MEDIAS FORCE
async setShowRescanMediaForce() {
var m = `{"jsonrpc": "2.0", "method": "doaction.show", "params": {"action": "rescanmediaforce"}, "id": 0}`
this.instance.mpConnection.sendJsonMessage(m)
}
// SEND SHOW TO ALL REMOTES
async setShowSendShowToRemote() {
var m = `{"jsonrpc": "2.0", "method": "doaction.show", "params": {"action": "sendshowtoremote"}, "id": 0}`
this.instance.mpConnection.sendJsonMessage(m)
}
} }
function areJsonArraysEqual(a: any[], b: any[]): boolean { function areJsonArraysEqual(a: any[], b: any[]): boolean {

View File

@ -107,7 +107,7 @@ export class MPconnection {
sendJsonMessage(message: String) { sendJsonMessage(message: String) {
if (this.websocket?.readyState === 1 && message !== '') { if (this.websocket?.readyState === 1 && message !== '') {
this.websocket?.send(message) this.websocket?.send(message)
//this.instance.log('debug', 'SENDING WS MESSAGE LAUNCH TASK ' + this.websocket.url + ' ' + message) this.instance.log('debug', 'SENDING WS MESSAGE LAUNCH TASK ' + this.websocket.url + ' ' + message)
} }
} }

View File

@ -8,22 +8,11 @@ import type { MPinstance } from './main.js'
export type PresetCategory = 'Tasks List' | 'PL' export type PresetCategory = 'Tasks List' | 'PL'
const colorGrayLight = [100, 100, 100] const colorModuloGray = [42, 42, 42]
const textSize = 18 const textSize = 14
const colorOrangeMP = [255, 165, 0] const colorOrangeMP = [255, 165, 0]
const colorGreenMP = [88, 201, 23] const colorGreenMP = [88, 201, 23]
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 type mpPreset = CompanionButtonPresetDefinition | CompanionTextPresetDefinition export type mpPreset = CompanionButtonPresetDefinition | CompanionTextPresetDefinition
type mpPresetArray = mpPreset[] | any type mpPresetArray = mpPreset[] | any
@ -42,7 +31,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
type: 'button', type: 'button',
style: { style: {
text: `$(Modulo_Player:tl_${uuid}_name)`, text: `$(Modulo_Player:tl_${uuid}_name)`,
size: '24', size: textSize,
color: combineRgb(255, 255, 255), color: combineRgb(255, 255, 255),
bgcolor: combineRgb(color[0], color[1], color[2]), bgcolor: combineRgb(color[0], color[1], color[2]),
}, },
@ -77,28 +66,272 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
//instance.log('warn', 'GET PLAYLISTS PRESETS >>> ' + JSON.stringify(pls, null, 4)) //instance.log('warn', 'GET PLAYLISTS PRESETS >>> ' + JSON.stringify(pls, null, 4))
for (let playlist = 0; playlist < pls.length; playlist++) { for (let playlist = 0; playlist < pls.length; playlist++) {
let cl: any[] = pls[playlist]['cues'] let cl: any[] = pls[playlist]['cues']
let uuid: String = pls[playlist]['uuid']//.slice(1, -1) let plID = pls[playlist]['uuid']
let uuid: String = instance.cleanUUID(pls[playlist]['uuid'])
let plName = pls[playlist]['name'] let plName = pls[playlist]['name']
//instance.log('warn', 'GET CUES PRESETS >>> ' + uuid) //instance.log('warn', 'GET CUES PRESETS >>> ' + uuid)
playlistsPresets.push({ playlistsPresets.push({
category: `Playlists`, category: `${playlist + 1} - ${plName}`,
name: `${plName}`, name: 'Generals',
type: 'text', type: 'text',
//text: 'Inputs 1 to 8', //text: 'Generals',
}) })
// Play
playlistsPresets.push({
category: `${playlist + 1} - ${plName}`,
name: `${plName}\nPlay`,
type: 'button',
style: {
text: `${plName}\nPlay`,
size: textSize,
color: combineRgb(255, 255, 255),
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
},
steps: [
{
down: [
{
actionId: 'play_pl',
options: {
plUUID: `${plID}`,
pl: playlist.toString()
},
},
],
up: [],
},
],
feedbacks: [],
})
// Play
playlistsPresets.push({
category: `${playlist + 1} - ${plName}`,
name: `${plName}\nPause`,
type: 'button',
style: {
text: `${plName}\nPause`,
size: textSize,
color: combineRgb(255, 255, 255),
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
},
steps: [
{
down: [
{
actionId: 'pause_pl',
options: {
plUUID: `${plID}`,
pl: playlist.toString()
},
},
],
up: [],
},
],
feedbacks: [],
})
// NEXT CUE
playlistsPresets.push({
category: `${playlist + 1} - ${plName}`,
name: `${plName}\nNext cue`,
type: 'button',
style: {
text: `${plName}\nNext cue`,
size: textSize,
color: combineRgb(255, 255, 255),
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
},
steps: [
{
down: [
{
actionId: 'next_cue',
options: {
plUUID: `${plID}`,
pl: playlist.toString()
},
},
],
up: [],
},
],
feedbacks: [],
})
// PREV CUE
playlistsPresets.push({
category: `${playlist + 1} - ${plName}`,
name: `${plName}\nPrev cue`,
type: 'button',
style: {
text: `${plName}\nPrev cue`,
size: textSize,
color: combineRgb(255, 255, 255),
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
},
steps: [
{
down: [
{
actionId: 'prev_cue',
options: {
plUUID: `${plID}`,
pl: playlist.toString()
},
},
],
up: [],
},
],
feedbacks: [],
})
// GRAND MASTER 0%
playlistsPresets.push({
category: `${playlist + 1} - ${plName}`,
name: `${plName}\nGM\n0%`,
type: 'button',
style: {
text: `${plName}\nGM\n0%`,
size: textSize,
color: combineRgb(255, 255, 255),
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
},
steps: [
{
down: [
{
actionId: 'pl_grand_master_fader',
options: {
value: 0,
duration: 2000,
plUUID: `${plID}`,
pl: playlist.toString()
},
},
],
up: [],
},
],
feedbacks: [],
})
// GRAND MASTER 100%
playlistsPresets.push({
category: `${playlist + 1} - ${plName}`,
name: `${plName}\nGM\n100%`,
type: 'button',
style: {
text: `${plName}\nGM\n100%`,
size: textSize,
color: combineRgb(255, 255, 255),
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
},
steps: [
{
down: [
{
actionId: 'pl_grand_master_fader',
options: {
value: 100,
duration: 2000,
plUUID: `${plID}`,
pl: playlist.toString()
},
},
],
up: [],
},
],
feedbacks: [],
})
// AUDIO MASTER 0%
playlistsPresets.push({
category: `${playlist + 1} - ${plName}`,
name: `${plName}\nAM\n0%`,
type: 'button',
style: {
text: `${plName}\nAM\n0%`,
size: textSize,
color: combineRgb(255, 255, 255),
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
},
steps: [
{
down: [
{
actionId: 'audio_master',
options: {
value: 0,
duration: 2000,
plUUID: `${plID}`,
pl: playlist.toString()
},
},
],
up: [],
},
],
feedbacks: [],
})
// AUDIO MASTER 100%
playlistsPresets.push({
category: `${playlist + 1} - ${plName}`,
name: `${plName}\nAM\n100%`,
type: 'button',
style: {
text: `${plName}\nAM\n100%`,
size: textSize,
color: combineRgb(255, 255, 255),
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
},
steps: [
{
down: [
{
actionId: 'audio_master',
options: {
value: 100,
duration: 2000,
plUUID: `${plID}`,
pl: playlist.toString()
},
},
],
up: [],
},
],
feedbacks: [],
})
// GOTO
playlistsPresets.push({
category: `${playlist + 1} - ${plName}`,
name: `Goto`,
type: 'text',
//text: 'Goto',
})
for (let cue = 0; cue < cl.length; cue++) { for (let cue = 0; cue < cl.length; cue++) {
const cuuid = instance.cleanUUID(cl[cue]['uuid']) const cuuid = instance.cleanUUID(cl[cue]['uuid'])
// COLOR // COLOR
let color = [0, 0, 0] let color = [0, 0, 0]
if (cl[cue]['uiColor'] !== '') { if (cl[cue]['uiColor'] !== '') {
color = hexToRgb(`${cl[cue]['uiColor']}`) color = instance.getColorFromHex(cl[cue]['uiColor'])
} }
playlistsPresets.push({ playlistsPresets.push({
category: `Playlists`, category: `${playlist + 1} - ${plName}`,
name: `$(Modulo_Player:cue_${cuuid}_name)`, //n, //`${cl[cue]['name']}`, name: `$(Modulo_Player:cue_${cuuid}_name)`,
type: 'button', type: 'button',
style: { style: {
text: `$(Modulo_Player:cue_${cuuid}_name)`, //n, //`${cl[cue]['name']}`, text: `$(Modulo_Player:cue_${cuuid}_name)`,
size: textSize, size: textSize,
color: combineRgb(255, 255, 255), color: combineRgb(255, 255, 255),
bgcolor: combineRgb(color[0], color[1], color[2]), bgcolor: combineRgb(color[0], color[1], color[2]),
@ -108,7 +341,12 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
down: [ down: [
{ {
actionId: 'goto_cue', actionId: 'goto_cue',
options: { cue: `${cl[cue]['uuid']}`, pl: `${pls[playlist]['uuid']}`, index: `${cue + 1}` }, options: {
cueUUID: `${cl[cue]['uuid']}`,
plUUID: `${plID}`,
index: `${cue + 1}`,
pl: playlist.toString()
},
}, },
], ],
up: [], up: [],
@ -135,60 +373,219 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
}) })
} }
// GRAND MASTER 0% // PRELOAD
playlistsPresets.push({ playlistsPresets.push({
category: `Playlists`, category: `${playlist + 1} - ${plName}`,
name: `${plName} GM 0`, name: `Preload`,
type: 'button', type: 'text',
style: { //text: 'Goto',
text: `${plName} GM\n00`,
size: textSize,
color: combineRgb(255, 255, 255),
bgcolor: combineRgb(colorGrayLight[0], colorGrayLight[1], colorGrayLight[2]),
},
steps: [
{
down: [
{
actionId: 'pl_grand_master_fader',
options: { value: 0, duration: 2000, pl: `${pls[playlist]['uuid']}` },
},
],
up: [],
},
],
feedbacks: [],
}) })
// GRAND MASTER 100% for (let cue = 0; cue < cl.length; cue++) {
playlistsPresets.push({ const cuuid = instance.cleanUUID(cl[cue]['uuid'])
category: `Playlists`,
name: `${plName} GM`, playlistsPresets.push({
type: 'button', category: `${playlist + 1} - ${plName}`,
style: { name: `Preload\n$(Modulo_Player:cue_${cuuid}_name)`,
text: `${plName} GM\nFF`, type: 'button',
size: textSize, style: {
color: combineRgb(255, 255, 255), text: `Preload\n$(Modulo_Player:cue_${cuuid}_name)`,
bgcolor: combineRgb(colorGrayLight[0], colorGrayLight[1], colorGrayLight[2]), size: textSize,
}, color: combineRgb(255, 255, 255),
steps: [ bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
{
down: [
{
actionId: 'pl_grand_master_fader',
options: { value: 100, duration: 2000, pl: `${pls[playlist]['uuid']}` },
},
],
up: [],
}, },
], steps: [
feedbacks: [], {
}) down: [
{
actionId: 'preload_cue',
options: {
cueUUID: `${cl[cue]['uuid']}`,
plUUID: `${plID}`,
index: `${cue + 1}`,
pl: playlist.toString()
},
},
],
up: [],
},
],
feedbacks: [
{
feedbackId: 'color_cue',
options: {
uuid: cuuid,
},
},
{
feedbackId: 'current_Cue',
options: {
current_Cue: cue + 1, // pls[playlist]['index'],
pl: uuid,
},
style: {
bgcolor: combineRgb(colorOrangeMP[0], colorOrangeMP[1], colorOrangeMP[2]),
},
},
],
})
}
} }
//instance.log("warn", "GET TASKS PRESETS 1 >>> " + tasksPresets.length) //instance.log("warn", "GET TASKS PRESETS 1 >>> " + tasksPresets.length)
return playlistsPresets return playlistsPresets
} }
// SHOW PRESETS
const getShowPresets = (): mpPresetArray => {
const showPresets: mpPresetArray = []
// SAVE
showPresets.push({
category: `Show`,
name: `Save`,
type: 'button',
style: {
text: `Save`,
size: textSize,
color: combineRgb(255, 255, 255),
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
},
steps: [
{
down: [
{
actionId: 'save',
},
],
up: [],
},
],
feedbacks: [],
})
// BACKUP
showPresets.push({
category: `Show`,
name: `Backup`,
type: 'button',
style: {
text: `Backup`,
size: textSize,
color: combineRgb(255, 255, 255),
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
},
steps: [
{
down: [
{
actionId: 'backup',
},
],
up: [],
},
],
feedbacks: [],
})
// RESCAN MEDIAS
showPresets.push({
category: `Show`,
name: `Rescan Medias`,
type: 'button',
style: {
text: `Rescan Medias`,
size: textSize,
color: combineRgb(255, 255, 255),
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
},
steps: [
{
down: [
{
actionId: 'rescan_medias',
},
],
up: [],
},
],
feedbacks: [],
})
// RESCAN MEDIAS FORCE
showPresets.push({
category: `Show`,
name: `Rescan Medias Force`,
type: 'button',
style: {
text: `Rescan Medias Force`,
size: textSize,
color: combineRgb(255, 255, 255),
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
},
steps: [
{
down: [
{
actionId: 'rescan_medias_force',
},
],
up: [],
},
],
feedbacks: [],
})
// REMOVE MISSING MEDIAS
showPresets.push({
category: `Show`,
name: `Remove Missing Medias`,
type: 'button',
style: {
text: `Remove Missing Medias`,
size: textSize,
color: combineRgb(255, 255, 255),
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
},
steps: [
{
down: [
{
actionId: 'remove_missing_medias',
},
],
up: [],
},
],
feedbacks: [],
})
// SEND SHOW TO ALL REMOTE
showPresets.push({
category: `Show`,
name: `Send Show to All Remotes`,
type: 'button',
style: {
text: `Send Show to All Remotes`,
size: textSize,
color: combineRgb(255, 255, 255),
bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]),
},
steps: [
{
down: [
{
actionId: 'send_show_to_remote',
},
],
up: [],
},
],
feedbacks: [],
})
return showPresets
}
// VARIABLES CUES // VARIABLES CUES
const getVariablesPresets = (): mpPresetArray => { const getVariablesPresets = (): mpPresetArray => {
const variablesPresets: mpPresetArray = [] const variablesPresets: mpPresetArray = []
@ -280,7 +677,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
return variablesPresets return variablesPresets
} }
const presets: mpPresetArray = [...getTasksPresets(), ...getPlayListsCuesPresets(), ...getVariablesPresets()] const presets: mpPresetArray = [...getTasksPresets(), ...getPlayListsCuesPresets(), ...getShowPresets(), ...getVariablesPresets()]
return presets as unknown as CompanionPresetDefinitions return presets as unknown as CompanionPresetDefinitions
} }