diff --git a/src/actions.ts b/src/actions.ts index c5c0990..b55886a 100755 --- a/src/actions.ts +++ b/src/actions.ts @@ -4,7 +4,7 @@ export function UpdateActions(self: MPinstance): void { self.setActionDefinitions({ // LAUNCH TASK launch_task: { - name: 'Launch Task (ID)', + name: 'Launch Task {uuid}', options: [ { id: 'task', @@ -14,14 +14,14 @@ export function UpdateActions(self: MPinstance): void { }, ], 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) }, }, // GOTO CUE goto_cue: { - name: 'Launch Cue (ID) on Playlist (ID)', + name: 'Launch Cue (ID) from Playlist', options: [ { id: 'index', @@ -32,32 +32,218 @@ export function UpdateActions(self: MPinstance): void { max: 10000, }, { - id: 'cue', + id: 'cueUUID', type: 'textinput', label: 'Cue UUID', default: '', + isVisible: () => (false), + }, + { + id: 'plUUID', + type: 'textinput', + label: 'Playlist uuid', + default: '', + isVisible: () => (false), }, { id: 'pl', - type: 'textinput', - label: 'Playlist ID', - default: '', - }, + type: 'dropdown', + label: 'Select Playlist', + choices: self.dropdownPlayList, + default: `0` + } ], callback: async (event) => { - console.log(`Launch Cue ID: ${event.options.index} from Playlist UUID: ${event.options.pl}`) - self.moduloplayer?.setGotoCue(event.options.pl, event.options.index) + 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?.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: { name: 'GrandMaster Fader on Playlist (ID)', 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', @@ -77,11 +263,112 @@ export function UpdateActions(self: MPinstance): void { }, ], callback: async (event) => { - self.log( - 'info', - `SET GRAND MASTER PL: ${event.options.pl} | value: ${event.options.value} | duration: ${event.options.duration}`, - ) - self.moduloplayer?.setGrandMasterFader(event.options.pl, event.options.value, event.options.duration) + let id = 0 + if (typeof event.options.pl === 'string') { + id = parseInt(event.options.pl, 10); + } + 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() }, }, }) diff --git a/src/feedbacks.ts b/src/feedbacks.ts index b00eb3a..e797738 100755 --- a/src/feedbacks.ts +++ b/src/feedbacks.ts @@ -78,13 +78,6 @@ export function UpdateFeedbacks(self: MPinstance): void { }, ], 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 { diff --git a/src/main.ts b/src/main.ts index 9115f5b..f9b42e0 100755 --- a/src/main.ts +++ b/src/main.ts @@ -34,6 +34,7 @@ export class MPinstance extends InstanceBase { public tasksList = [] public playLists = [] public states: IStringIndex = {} + public dropdownPlayList = [] // CONTRUCTOR constructor(internal: unknown) { diff --git a/src/moduloplayer.ts b/src/moduloplayer.ts index 36591d0..baa39ae 100755 --- a/src/moduloplayer.ts +++ b/src/moduloplayer.ts @@ -54,11 +54,23 @@ export class ModuloPlayer { this.instance.log('debug', `MODULO PLAYER | CHECK PL >>> ${checkPL}`) if (!checkPL) { this.instance.playLists = obj + this.setDropDownPL(obj) this.instance.setPresetDefinitions(getPresets(this.instance)) 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 async getPlaylistsCurrentCues() { //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++) { 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']}`) - let grandMasterFader = (pls[playlist]['grandMasterFader']*100).toFixed(0) + let grandMasterFader = (pls[playlist]['grandMasterFader'] * 100).toFixed(0) var obj: any = { [`pl_${uuid}_currentIndex`]: parseInt(pls[playlist]['index']), [`pl_${uuid}_grandMasterFader`]: grandMasterFader @@ -96,6 +108,46 @@ export class ModuloPlayer { 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) { var m = `{"jsonrpc":"2.0","method":"doaction.playlist", "params": { @@ -107,6 +159,17 @@ export class ModuloPlayer { 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() { //this.instance.log('info', 'GET TASKS LIST') this.instance.mpConnection?.sendMessage('get.list.tasks', 1) @@ -116,6 +179,61 @@ export class ModuloPlayer { //this.instance.log('info', 'GET PLAY LIST') 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 { diff --git a/src/mpconnection.ts b/src/mpconnection.ts index aca8cbb..ab604d8 100755 --- a/src/mpconnection.ts +++ b/src/mpconnection.ts @@ -107,7 +107,7 @@ export class MPconnection { sendJsonMessage(message: String) { if (this.websocket?.readyState === 1 && 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) } } diff --git a/src/presets.ts b/src/presets.ts index 14ff234..c9ddfd2 100755 --- a/src/presets.ts +++ b/src/presets.ts @@ -8,22 +8,11 @@ import type { MPinstance } from './main.js' export type PresetCategory = 'Tasks List' | 'PL' -const colorGrayLight = [100, 100, 100] -const textSize = 18 - +const colorModuloGray = [42, 42, 42] +const textSize = 14 const colorOrangeMP = [255, 165, 0] 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 type mpPresetArray = mpPreset[] | any @@ -42,7 +31,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions { type: 'button', style: { text: `$(Modulo_Player:tl_${uuid}_name)`, - size: '24', + size: textSize, color: combineRgb(255, 255, 255), 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)) for (let playlist = 0; playlist < pls.length; playlist++) { 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'] //instance.log('warn', 'GET CUES PRESETS >>> ' + uuid) + playlistsPresets.push({ - category: `Playlists`, - name: `${plName}`, + category: `${playlist + 1} - ${plName}`, + name: 'Generals', 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++) { const cuuid = instance.cleanUUID(cl[cue]['uuid']) // COLOR let color = [0, 0, 0] if (cl[cue]['uiColor'] !== '') { - color = hexToRgb(`${cl[cue]['uiColor']}`) + color = instance.getColorFromHex(cl[cue]['uiColor']) } + playlistsPresets.push({ - category: `Playlists`, - name: `$(Modulo_Player:cue_${cuuid}_name)`, //n, //`${cl[cue]['name']}`, + category: `${playlist + 1} - ${plName}`, + name: `$(Modulo_Player:cue_${cuuid}_name)`, type: 'button', style: { - text: `$(Modulo_Player:cue_${cuuid}_name)`, //n, //`${cl[cue]['name']}`, + text: `$(Modulo_Player:cue_${cuuid}_name)`, size: textSize, color: combineRgb(255, 255, 255), bgcolor: combineRgb(color[0], color[1], color[2]), @@ -108,7 +341,12 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions { down: [ { 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: [], @@ -135,60 +373,219 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions { }) } - // GRAND MASTER 0% + // PRELOAD playlistsPresets.push({ - category: `Playlists`, - name: `${plName} GM 0`, - type: 'button', - style: { - 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: [], + category: `${playlist + 1} - ${plName}`, + name: `Preload`, + type: 'text', + //text: 'Goto', }) - // GRAND MASTER 100% - playlistsPresets.push({ - category: `Playlists`, - name: `${plName} GM`, - type: 'button', - style: { - text: `${plName} GM\nFF`, - size: textSize, - color: combineRgb(255, 255, 255), - bgcolor: combineRgb(colorGrayLight[0], colorGrayLight[1], colorGrayLight[2]), - }, - steps: [ - { - down: [ - { - actionId: 'pl_grand_master_fader', - options: { value: 100, duration: 2000, pl: `${pls[playlist]['uuid']}` }, - }, - ], - up: [], + for (let cue = 0; cue < cl.length; cue++) { + const cuuid = instance.cleanUUID(cl[cue]['uuid']) + + playlistsPresets.push({ + category: `${playlist + 1} - ${plName}`, + name: `Preload\n$(Modulo_Player:cue_${cuuid}_name)`, + type: 'button', + style: { + text: `Preload\n$(Modulo_Player:cue_${cuuid}_name)`, + size: textSize, + color: combineRgb(255, 255, 255), + bgcolor: combineRgb(colorModuloGray[0], colorModuloGray[1], colorModuloGray[2]), }, - ], - feedbacks: [], - }) + steps: [ + { + 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) 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 const getVariablesPresets = (): mpPresetArray => { const variablesPresets: mpPresetArray = [] @@ -280,7 +677,7 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions { return variablesPresets } - const presets: mpPresetArray = [...getTasksPresets(), ...getPlayListsCuesPresets(), ...getVariablesPresets()] + const presets: mpPresetArray = [...getTasksPresets(), ...getPlayListsCuesPresets(), ...getShowPresets(), ...getVariablesPresets()] return presets as unknown as CompanionPresetDefinitions }