parent
a08d65b762
commit
e510b9c895
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "modulopi-moduloplayer",
|
||||
"version": "4.0.4",
|
||||
"version": "4.0.5",
|
||||
"main": "dist/main.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
@ -48,4 +48,4 @@
|
|||
]
|
||||
},
|
||||
"packageManager": "yarn@4.9.1"
|
||||
}
|
||||
}
|
||||
212
src/actions.ts
212
src/actions.ts
|
|
@ -15,7 +15,7 @@ export function UpdateActions(instance: MPinstance): void {
|
|||
],
|
||||
callback: async (event) => {
|
||||
//console.log('Launch Task ID: ' + event.options.task)
|
||||
instance.mpConnection.sendMessageLunchTask(event.options.task, 2)
|
||||
instance.moduloplayer?.sendLaunchTask(event.options.task)
|
||||
},
|
||||
},
|
||||
|
||||
|
|
@ -59,9 +59,7 @@ export function UpdateActions(instance: MPinstance): void {
|
|||
id = parseInt(event.options.pl, 10)
|
||||
}
|
||||
const pl = instance.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"]}`)
|
||||
instance.moduloplayer?.setGotoCue(pl['uuid'], event.options.index)
|
||||
instance.moduloplayer?.sendGotoCue(pl['uuid'], event.options.index)
|
||||
},
|
||||
},
|
||||
|
||||
|
|
@ -107,7 +105,7 @@ export function UpdateActions(instance: MPinstance): void {
|
|||
const pl = instance.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"]}`)
|
||||
instance.moduloplayer?.setPreloadCue(pl['uuid'], event.options.index)
|
||||
instance.moduloplayer?.sendPreloadCue(pl['uuid'], event.options.index)
|
||||
},
|
||||
},
|
||||
|
||||
|
|
@ -136,7 +134,7 @@ export function UpdateActions(instance: MPinstance): void {
|
|||
id = parseInt(event.options.pl, 10)
|
||||
}
|
||||
const pl = instance.dropdownPlayList[id]
|
||||
instance.moduloplayer?.setPlay(pl['uuid'])
|
||||
instance.moduloplayer?.sendPlay(pl['uuid'])
|
||||
},
|
||||
},
|
||||
|
||||
|
|
@ -165,7 +163,7 @@ export function UpdateActions(instance: MPinstance): void {
|
|||
id = parseInt(event.options.pl, 10)
|
||||
}
|
||||
const pl = instance.dropdownPlayList[id]
|
||||
instance.moduloplayer?.setPause(pl['uuid'])
|
||||
instance.moduloplayer?.sendPause(pl['uuid'])
|
||||
},
|
||||
},
|
||||
|
||||
|
|
@ -194,7 +192,7 @@ export function UpdateActions(instance: MPinstance): void {
|
|||
id = parseInt(event.options.pl, 10)
|
||||
}
|
||||
const pl = instance.dropdownPlayList[id]
|
||||
instance.moduloplayer?.setNextCue(pl['uuid'])
|
||||
instance.moduloplayer?.sendNextCue(pl['uuid'])
|
||||
},
|
||||
},
|
||||
|
||||
|
|
@ -223,13 +221,13 @@ export function UpdateActions(instance: MPinstance): void {
|
|||
id = parseInt(event.options.pl, 10)
|
||||
}
|
||||
const pl = instance.dropdownPlayList[id]
|
||||
instance.moduloplayer?.setPrevCue(pl['uuid'])
|
||||
instance.moduloplayer?.sendPrevCue(pl['uuid'])
|
||||
},
|
||||
},
|
||||
|
||||
// GRAND MASTER FADER
|
||||
pl_grand_master_fader: {
|
||||
name: 'GrandMaster Fader on Playlist (ID)',
|
||||
name: 'Grand Master Fader on Playlist',
|
||||
options: [
|
||||
{
|
||||
id: 'pl',
|
||||
|
|
@ -268,11 +266,103 @@ export function UpdateActions(instance: MPinstance): void {
|
|||
id = parseInt(event.options.pl, 10)
|
||||
}
|
||||
const pl = instance.dropdownPlayList[id]
|
||||
instance.moduloplayer?.setGrandMasterFader(pl['uuid'], event.options.value, event.options.duration)
|
||||
instance.moduloplayer?.sendGrandMasterFader(pl['uuid'], event.options.value, event.options.duration)
|
||||
},
|
||||
},
|
||||
|
||||
// GRAND MASTER FADER
|
||||
grand_master_fader_add: {
|
||||
name: 'Add Grand Master Fader Rotate on Playlist',
|
||||
options: [
|
||||
{
|
||||
id: 'pl',
|
||||
type: 'dropdown',
|
||||
label: 'Select Playlist',
|
||||
choices: instance.dropdownPlayList,
|
||||
default: `0`,
|
||||
},
|
||||
{
|
||||
id: 'plUUID',
|
||||
type: 'textinput',
|
||||
label: 'Playlist ID',
|
||||
default: '',
|
||||
isVisible: () => false,
|
||||
},
|
||||
{
|
||||
id: 'value',
|
||||
type: 'number',
|
||||
label: 'Value in % (0 to 100)',
|
||||
default: 1,
|
||||
min: 0,
|
||||
max: 100,
|
||||
},
|
||||
],
|
||||
callback: async (event) => {
|
||||
let id = 0
|
||||
if (typeof event.options.pl === 'string') {
|
||||
id = parseInt(event.options.pl, 10)
|
||||
}
|
||||
const pl = instance.dropdownPlayList[id]
|
||||
const plName = `pl_${instance.cleanUUID(pl['uuid'])}_grandMasterFader`
|
||||
const value = parseInt(instance.states[plName])
|
||||
const addValue = typeof event.options.value === 'number' ? event.options.value : 0
|
||||
let newValue = value + addValue
|
||||
if (newValue > 100) newValue = 100
|
||||
// console.log(
|
||||
// `Add GrandMaster Fader on Playlist ID: ${variableValue} with value: ${newValue}` +
|
||||
// `pl_${pl['uuid']}_grandMasterFader`,
|
||||
// )
|
||||
instance.moduloplayer?.sendGrandMasterFader(pl['uuid'], newValue, 0)
|
||||
instance.states[plName] = newValue
|
||||
},
|
||||
},
|
||||
|
||||
grand_master_fader_remove: {
|
||||
name: 'Remove Grand Master Fader Rotate on Playlist',
|
||||
options: [
|
||||
{
|
||||
id: 'pl',
|
||||
type: 'dropdown',
|
||||
label: 'Select Playlist',
|
||||
choices: instance.dropdownPlayList,
|
||||
default: `0`,
|
||||
},
|
||||
{
|
||||
id: 'plUUID',
|
||||
type: 'textinput',
|
||||
label: 'Playlist ID',
|
||||
default: '',
|
||||
isVisible: () => false,
|
||||
},
|
||||
{
|
||||
id: 'value',
|
||||
type: 'number',
|
||||
label: 'Value in % (0 to 100)',
|
||||
default: 1,
|
||||
min: 0,
|
||||
max: 100,
|
||||
},
|
||||
],
|
||||
callback: async (event) => {
|
||||
let id = 0
|
||||
if (typeof event.options.pl === 'string') {
|
||||
id = parseInt(event.options.pl, 10)
|
||||
}
|
||||
const pl = instance.dropdownPlayList[id]
|
||||
const plName = `pl_${instance.cleanUUID(pl['uuid'])}_grandMasterFader`
|
||||
const value = parseInt(instance.states[plName])
|
||||
const addValue = typeof event.options.value === 'number' ? event.options.value : 0
|
||||
let newValue = value - addValue
|
||||
if (newValue < 0) newValue = 0
|
||||
// console.log(
|
||||
// `Remove GrandMaster Fader on Playlist ID: ${variableValue} with value: ${newValue}` +
|
||||
// `pl_${pl['uuid']}_grandMasterFader`,
|
||||
// )
|
||||
instance.moduloplayer?.sendGrandMasterFader(pl['uuid'], newValue, 0)
|
||||
instance.states[plName] = newValue
|
||||
},
|
||||
},
|
||||
|
||||
// AUDIO MASTER
|
||||
audio_master: {
|
||||
name: 'Audio Master on Playlist',
|
||||
options: [
|
||||
|
|
@ -313,7 +403,91 @@ export function UpdateActions(instance: MPinstance): void {
|
|||
id = parseInt(event.options.pl, 10)
|
||||
}
|
||||
const pl = instance.dropdownPlayList[id]
|
||||
instance.moduloplayer?.setAudioMaster(pl['uuid'], event.options.value, event.options.duration)
|
||||
instance.moduloplayer?.sendAudioMaster(pl['uuid'], event.options.value, event.options.duration)
|
||||
},
|
||||
},
|
||||
|
||||
audio_master_add: {
|
||||
name: 'Add Audio Master Rotate on Playlist',
|
||||
options: [
|
||||
{
|
||||
id: 'pl',
|
||||
type: 'dropdown',
|
||||
label: 'Select Playlist',
|
||||
choices: instance.dropdownPlayList,
|
||||
default: `0`,
|
||||
},
|
||||
{
|
||||
id: 'plUUID',
|
||||
type: 'textinput',
|
||||
label: 'Playlist ID',
|
||||
default: '',
|
||||
isVisible: () => false,
|
||||
},
|
||||
{
|
||||
id: 'value',
|
||||
type: 'number',
|
||||
label: 'Value in % (0 to 100)',
|
||||
default: 1,
|
||||
min: 0,
|
||||
max: 100,
|
||||
},
|
||||
],
|
||||
callback: async (event) => {
|
||||
let id = 0
|
||||
if (typeof event.options.pl === 'string') {
|
||||
id = parseInt(event.options.pl, 10)
|
||||
}
|
||||
const pl = instance.dropdownPlayList[id]
|
||||
const plName = `pl_${instance.cleanUUID(pl['uuid'])}_audioMaster`
|
||||
const value = parseInt(instance.states[plName])
|
||||
const addValue = typeof event.options.value === 'number' ? event.options.value : 0
|
||||
let newValue = value + addValue
|
||||
if (newValue > 100) newValue = 100
|
||||
instance.moduloplayer?.sendAudioMaster(pl['uuid'], newValue, 0)
|
||||
instance.states[plName] = newValue
|
||||
},
|
||||
},
|
||||
|
||||
audio_master_remove: {
|
||||
name: 'Remove Audio Master Rotate on Playlist',
|
||||
options: [
|
||||
{
|
||||
id: 'pl',
|
||||
type: 'dropdown',
|
||||
label: 'Select Playlist',
|
||||
choices: instance.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,
|
||||
},
|
||||
],
|
||||
callback: async (event) => {
|
||||
let id = 0
|
||||
if (typeof event.options.pl === 'string') {
|
||||
id = parseInt(event.options.pl, 10)
|
||||
}
|
||||
const pl = instance.dropdownPlayList[id]
|
||||
const plName = `pl_${instance.cleanUUID(pl['uuid'])}_audioMaster`
|
||||
const value = parseInt(instance.states[plName])
|
||||
const addValue = typeof event.options.value === 'number' ? event.options.value : 0
|
||||
let newValue = value - addValue
|
||||
if (newValue < 0) newValue = 0
|
||||
instance.moduloplayer?.sendAudioMaster(pl['uuid'], newValue, 0)
|
||||
instance.states[plName] = newValue
|
||||
},
|
||||
},
|
||||
|
||||
|
|
@ -323,7 +497,7 @@ export function UpdateActions(instance: MPinstance): void {
|
|||
name: 'Save Show',
|
||||
options: [],
|
||||
callback: async () => {
|
||||
instance.moduloplayer?.setShowSave()
|
||||
instance.moduloplayer?.sendShowSave()
|
||||
},
|
||||
},
|
||||
|
||||
|
|
@ -332,7 +506,7 @@ export function UpdateActions(instance: MPinstance): void {
|
|||
name: 'Backup Show',
|
||||
options: [],
|
||||
callback: async () => {
|
||||
instance.moduloplayer?.setShowbackup()
|
||||
instance.moduloplayer?.sendShowbackup()
|
||||
},
|
||||
},
|
||||
|
||||
|
|
@ -341,7 +515,7 @@ export function UpdateActions(instance: MPinstance): void {
|
|||
name: 'Rescan Medias',
|
||||
options: [],
|
||||
callback: async () => {
|
||||
instance.moduloplayer?.setShowRescanMedia()
|
||||
instance.moduloplayer?.sendShowRescanMedia()
|
||||
},
|
||||
},
|
||||
|
||||
|
|
@ -350,7 +524,7 @@ export function UpdateActions(instance: MPinstance): void {
|
|||
name: 'Remove Missing Medias',
|
||||
options: [],
|
||||
callback: async () => {
|
||||
instance.moduloplayer?.setShowRemoveMissingMedia()
|
||||
instance.moduloplayer?.sendShowRemoveMissingMedia()
|
||||
},
|
||||
},
|
||||
|
||||
|
|
@ -359,7 +533,7 @@ export function UpdateActions(instance: MPinstance): void {
|
|||
name: 'Rescan Medias Force',
|
||||
options: [],
|
||||
callback: async () => {
|
||||
instance.moduloplayer?.setShowRescanMediaForce()
|
||||
instance.moduloplayer?.sendShowRescanMediaForce()
|
||||
},
|
||||
},
|
||||
|
||||
|
|
@ -368,7 +542,7 @@ export function UpdateActions(instance: MPinstance): void {
|
|||
name: 'Send show to all remotes',
|
||||
options: [],
|
||||
callback: async () => {
|
||||
instance.moduloplayer?.setShowSendShowToRemote()
|
||||
instance.moduloplayer?.sendShowSendShowToRemote()
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
|
|||
14
src/main.ts
14
src/main.ts
|
|
@ -88,8 +88,8 @@ export class MPinstance extends InstanceBase<ModuloPlayConfig> {
|
|||
async isConnected() {
|
||||
if (this.mpConnected && this.sdConnected) {
|
||||
this.updateStatus(InstanceStatus.Ok, `Connected`)
|
||||
if (this.mpConnected) this.moduloplayer?.getTaskListModuloPlayer()
|
||||
if (this.mpConnected) this.moduloplayer?.getPlaylistModuloPlayer()
|
||||
if (this.mpConnected) this.moduloplayer?.sendTaskListModuloPlayer()
|
||||
if (this.mpConnected) this.moduloplayer?.sendPlaylistModuloPlayer()
|
||||
if (this.sdConnected) this.spydog?.getStaticInfo()
|
||||
if (this.sdConnected) this.spydog?.getDynamicInfo()
|
||||
} else if (!this.mpConnected && this.sdConnected) {
|
||||
|
|
@ -98,8 +98,8 @@ export class MPinstance extends InstanceBase<ModuloPlayConfig> {
|
|||
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()
|
||||
if (this.mpConnected) this.moduloplayer?.sendTaskListModuloPlayer()
|
||||
if (this.mpConnected) this.moduloplayer?.sendPlaylistModuloPlayer()
|
||||
} else {
|
||||
this.updateStatus(InstanceStatus.Connecting, `Init Connection`)
|
||||
}
|
||||
|
|
@ -113,9 +113,9 @@ export class MPinstance extends InstanceBase<ModuloPlayConfig> {
|
|||
}
|
||||
|
||||
updatPolling() {
|
||||
if (this.mpConnected) this.moduloplayer?.getPlaylistsCurrentCues()
|
||||
if (this.mpConnected) this.moduloplayer?.getTaskListModuloPlayer()
|
||||
if (this.mpConnected) this.moduloplayer?.getPlaylistModuloPlayer()
|
||||
if (this.mpConnected) this.moduloplayer?.sendCurrentCues()
|
||||
if (this.mpConnected) this.moduloplayer?.sendTaskListModuloPlayer()
|
||||
if (this.mpConnected) this.moduloplayer?.sendPlaylistModuloPlayer()
|
||||
if (this.sdConnected) this.spydog?.getDynamicInfo()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,10 @@ import { MPinstance } from './main.js'
|
|||
// 2 = Launch Task,
|
||||
// 3 = list Playlist
|
||||
|
||||
// 100 = CURRENT CUE LIST
|
||||
// 100 =
|
||||
// 110 = ACTION GOTO
|
||||
// 120 = GRAND MASTER FADER
|
||||
// 130 = AUDIO MASTER
|
||||
|
||||
export class ModuloPlayer {
|
||||
instance: MPinstance
|
||||
|
|
@ -18,16 +20,27 @@ export class ModuloPlayer {
|
|||
|
||||
public messageManager(data: String): void {
|
||||
const datas = JSON.parse(data.toString())
|
||||
//this.instance.log('debug', 'MODULO PLAYER | MESSAGE MANAGER | DATA ID >>> ' + datas['id'])
|
||||
//this.instance.log('warn', 'MODULO PLAYER | MESSAGE MANAGER | DATA ID >>> ' + datas['id'])
|
||||
if (datas['id'] == 1) {
|
||||
//console.log('debug', 'MODULO PLAYER | MESSAGE MANAGER | DATA >>> ' + data.toString())
|
||||
this.tasksListManager(datas['result'])
|
||||
} else if (datas['id'] == 2) {
|
||||
//console.log('debug', 'MODULO PLAYER | MESSAGE MANAGER | LAUNCH TASK | DATA >>> ' + data.toString())
|
||||
//this.playListCuesManager(datas['result'])
|
||||
} else if (datas['id'] == 3) {
|
||||
//console.log('debug', 'MODULO PLAYER | MESSAGE MANAGER | DATA >>> ' + data.toString())
|
||||
this.playListCuesManager(datas['result'])
|
||||
} else if (datas['id'] == 100) {
|
||||
} else if (datas['id'] == 110) {
|
||||
//console.log('debug', 'MODULO PLAYER | MESSAGE MANAGER | DATA >>> ' + data.toString())
|
||||
this.setPlayListCurrentCueIndex(datas['result'])
|
||||
this.setGrandMasterFaderVariable(datas['result'])
|
||||
this.setAudioMasterVariable(datas['result'])
|
||||
} else if (datas['id'] == 120) {
|
||||
//this.instance.log('info', 'MODULO PLAYER | MESSAGE MANAGER| GRAND MASTER | DATA >>> ' + data.toString())
|
||||
this.setGrandMasterFaderVariable(datas['result'])
|
||||
} else if (datas['id'] == 130) {
|
||||
//this.instance.log('info', 'MODULO PLAYER | MESSAGE MANAGER| GRAND MASTER | DATA >>> ' + data.toString())
|
||||
this.setAudioMasterVariable(datas['result'])
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -36,7 +49,6 @@ export class ModuloPlayer {
|
|||
const tlInstance: any[] = this.instance.tasksList
|
||||
const tlNew: any[] = obj
|
||||
const checkTL = areJsonArraysEqual(tlInstance, tlNew)
|
||||
//this.instance.log('debug', `MODULO PLAYER | CHECK TL >>> ${checkTL}`)
|
||||
if (!checkTL) {
|
||||
this.instance.tasksList = obj
|
||||
this.instance.updateInstance()
|
||||
|
|
@ -48,49 +60,78 @@ export class ModuloPlayer {
|
|||
const plInstance: any[] = this.instance.playLists
|
||||
const plNew: any[] = obj
|
||||
const checkPL = areJsonArraysEqual(plInstance, plNew)
|
||||
//this.instance.log('debug', `MODULO PLAYER | CHECK PL >>> ${checkPL}`)
|
||||
if (!checkPL) {
|
||||
this.instance.playLists = obj
|
||||
this.setDropDownPL(obj)
|
||||
this.instance.updateInstance()
|
||||
this.setGrandMasterFaderVariable(obj)
|
||||
}
|
||||
}
|
||||
|
||||
// ACTION DROPDOWN PLAY LIST ARRAY
|
||||
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 !`)
|
||||
this.instance.mpConnection?.sendMessage('get.list.playlists', 100)
|
||||
}
|
||||
|
||||
// SET PLAYLIST CURRENT CUE INDEX
|
||||
async setPlayListCurrentCueIndex(obj: any) {
|
||||
const pls: any[] = obj
|
||||
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)
|
||||
var obj: any = {
|
||||
[`pl_${uuid}_currentIndex`]: parseInt(pls[playlist]['index']),
|
||||
[`pl_${uuid}_grandMasterFader`]: grandMasterFader,
|
||||
}
|
||||
this.instance.states[`pl_${uuid}_currentIndex`] = parseInt(pls[playlist]['index'])
|
||||
this.instance.states[`pl_${uuid}_grandMasterFader`] = grandMasterFader
|
||||
this.instance.setVariableValues(obj)
|
||||
this.instance.checkFeedbacks()
|
||||
this.instance.checkFeedbacks(`current_Cue`)
|
||||
}
|
||||
}
|
||||
|
||||
async setGotoCue(plUUID: any, cueID: any) {
|
||||
async setGrandMasterFaderVariable(obj: any) {
|
||||
const pls: any[] = obj
|
||||
for (let playlist = 0; playlist < pls.length; playlist++) {
|
||||
let uuid: String = this.instance.cleanUUID(pls[playlist]['uuid'])
|
||||
// this.instance.log('warn', `MODULO PLAYER | GET GRAND MASTER FADER >>> ${uuid} >>> ${pls[playlist]['grandMasterFader']}`)
|
||||
let grandMasterFader = (pls[playlist]['grandMasterFader'] * 100).toFixed(0)
|
||||
var obj: any = {
|
||||
[`pl_${uuid}_grandMasterFader`]: grandMasterFader,
|
||||
}
|
||||
this.instance.states[`pl_${uuid}_grandMasterFader`] = grandMasterFader
|
||||
this.instance.setVariableValues(obj)
|
||||
// this.instance.checkFeedbacks()
|
||||
}
|
||||
}
|
||||
|
||||
async setAudioMasterVariable(obj: any) {
|
||||
const pls: any[] = obj
|
||||
for (let playlist = 0; playlist < pls.length; playlist++) {
|
||||
let uuid: String = this.instance.cleanUUID(pls[playlist]['uuid'])
|
||||
let audioMaster = (pls[playlist]['audioMaster'] * 100).toFixed(0)
|
||||
var obj: any = {
|
||||
[`pl_${uuid}_audioMaster`]: audioMaster,
|
||||
}
|
||||
this.instance.states[`pl_${uuid}_audioMaster`] = audioMaster
|
||||
this.instance.setVariableValues(obj)
|
||||
}
|
||||
}
|
||||
|
||||
// SEND ACTIONS
|
||||
|
||||
// GET CURRENT CUE INDEX
|
||||
async sendCurrentCues() {
|
||||
var m = `{"jsonrpc":"2.0","method":"get.list.playlists",
|
||||
"params": {
|
||||
"level": "playlist"},
|
||||
"id": 110}`
|
||||
this.instance.mpConnection.sendJsonMessage(m)
|
||||
}
|
||||
|
||||
async sendGotoCue(plUUID: any, cueID: any) {
|
||||
var m = `{
|
||||
"jsonrpc": "2.0",
|
||||
"method": "doaction.playlist",
|
||||
|
|
@ -102,9 +143,11 @@ export class ModuloPlayer {
|
|||
"id": 110
|
||||
}`
|
||||
this.instance.mpConnection.sendJsonMessage(m)
|
||||
this.instance.states[`pl_${this.instance.cleanUUID(plUUID)}_currentIndex`] = cueID
|
||||
this.instance.checkFeedbacks(`current_Cue`)
|
||||
}
|
||||
|
||||
async setPreloadCue(plUUID: any, cueID: any) {
|
||||
async sendPreloadCue(plUUID: any, cueID: any) {
|
||||
var m = `{
|
||||
"jsonrpc": "2.0",
|
||||
"method": "doaction.playlist",
|
||||
|
|
@ -118,7 +161,7 @@ export class ModuloPlayer {
|
|||
this.instance.mpConnection.sendJsonMessage(m)
|
||||
}
|
||||
|
||||
async setPlay(plUUID: any) {
|
||||
async sendPlay(plUUID: any) {
|
||||
var m = `{
|
||||
"jsonrpc": "2.0",
|
||||
"method": "doaction.playlist",
|
||||
|
|
@ -131,7 +174,7 @@ export class ModuloPlayer {
|
|||
this.instance.mpConnection.sendJsonMessage(m)
|
||||
}
|
||||
|
||||
async setPause(plUUID: any) {
|
||||
async sendPause(plUUID: any) {
|
||||
var m = `{
|
||||
"jsonrpc": "2.0",
|
||||
"method": "doaction.playlist",
|
||||
|
|
@ -144,39 +187,52 @@ export class ModuloPlayer {
|
|||
this.instance.mpConnection.sendJsonMessage(m)
|
||||
}
|
||||
|
||||
async setGrandMasterFader(_pl: any, _value: any, _duration: any) {
|
||||
async sendGrandMasterFader(_pl: any, _value: any, _duration: any) {
|
||||
var m = `{"jsonrpc":"2.0","method":"doaction.playlist",
|
||||
"params": {
|
||||
"uuid": "${_pl}",
|
||||
"action": "grandMasterFader",
|
||||
"value": ${_value},
|
||||
"duration": ${_duration}
|
||||
},"id": ${110}}`
|
||||
},"id": 120}`
|
||||
this.instance.mpConnection.sendJsonMessage(m)
|
||||
}
|
||||
|
||||
async setAudioMaster(_pl: any, _value: any, _duration: any) {
|
||||
async sendAudioMaster(_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}}`
|
||||
},"id": 130}`
|
||||
this.instance.mpConnection.sendJsonMessage(m)
|
||||
}
|
||||
|
||||
async getTaskListModuloPlayer() {
|
||||
async sendTaskListModuloPlayer() {
|
||||
var m = `{"jsonrpc":"2.0","method":"get.list.tasks","id": 1}`
|
||||
//this.instance.log('info', 'GET TASKS LIST')
|
||||
this.instance.mpConnection?.sendMessage('get.list.tasks', 1)
|
||||
this.instance.mpConnection.sendJsonMessage(m)
|
||||
}
|
||||
|
||||
async getPlaylistModuloPlayer() {
|
||||
//this.instance.log('info', 'GET PLAY LIST')
|
||||
this.instance.mpConnection?.sendMessagePlaylistsCues()
|
||||
async sendLaunchTask(uuid: any) {
|
||||
var m = `{"jsonrpc":"2.0","method":"doaction.task", "params": {
|
||||
"uuid": "${uuid}",
|
||||
"action": "launch"
|
||||
},"id": 2}`
|
||||
//this.instance.log('debug', 'SENDING WS MESSAGE LAUNCH TASK ' + this.websocket.url + ' ' + m)
|
||||
this.instance.mpConnection.sendJsonMessage(m)
|
||||
}
|
||||
|
||||
async setNextCue(plUUDI: any) {
|
||||
async sendPlaylistModuloPlayer() {
|
||||
var m = `{"jsonrpc":"2.0","method":"get.list.playlists",
|
||||
"params": {
|
||||
"level": "cue"},
|
||||
"id": 3}`
|
||||
this.instance.mpConnection.sendJsonMessage(m)
|
||||
}
|
||||
|
||||
async sendNextCue(plUUDI: any) {
|
||||
var m = `{"jsonrpc": "2.0", "method": "doaction.playlist",
|
||||
"params": {
|
||||
"uuid": "${plUUDI}",
|
||||
|
|
@ -185,7 +241,7 @@ export class ModuloPlayer {
|
|||
this.instance.mpConnection.sendJsonMessage(m)
|
||||
}
|
||||
|
||||
async setPrevCue(plUUDI: any) {
|
||||
async sendPrevCue(plUUDI: any) {
|
||||
var m = `{"jsonrpc": "2.0", "method": "doaction.playlist",
|
||||
"params": {
|
||||
"uuid": "${plUUDI}",
|
||||
|
|
@ -196,37 +252,37 @@ export class ModuloPlayer {
|
|||
|
||||
// SHOW FONCTIONS
|
||||
// SAVE
|
||||
async setShowSave() {
|
||||
async sendShowSave() {
|
||||
var m = `{"jsonrpc": "2.0", "method": "doaction.show", "params": {"action": "save"}, "id": 0}`
|
||||
this.instance.mpConnection.sendJsonMessage(m)
|
||||
}
|
||||
|
||||
// BACKUP
|
||||
async setShowbackup() {
|
||||
async sendShowbackup() {
|
||||
var m = `{"jsonrpc": "2.0", "method": "doaction.show", "params": {"action": "backup"}, "id": 0}`
|
||||
this.instance.mpConnection.sendJsonMessage(m)
|
||||
}
|
||||
|
||||
// RESCAN MEDIAS
|
||||
async setShowRescanMedia() {
|
||||
async sendShowRescanMedia() {
|
||||
var m = `{"jsonrpc": "2.0", "method": "doaction.show", "params": {"action": "rescanmedia"}, "id": 0}`
|
||||
this.instance.mpConnection.sendJsonMessage(m)
|
||||
}
|
||||
|
||||
// REMOVE MISSING MEDIAS
|
||||
async setShowRemoveMissingMedia() {
|
||||
async sendShowRemoveMissingMedia() {
|
||||
var m = `{"jsonrpc": "2.0", "method": "doaction.show", "params": {"action": "removemissingmedia"}, "id": 0}`
|
||||
this.instance.mpConnection.sendJsonMessage(m)
|
||||
}
|
||||
|
||||
// RESCAN MEDIAS FORCE
|
||||
async setShowRescanMediaForce() {
|
||||
async sendShowRescanMediaForce() {
|
||||
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() {
|
||||
async sendShowSendShowToRemote() {
|
||||
var m = `{"jsonrpc": "2.0", "method": "doaction.show", "params": {"action": "sendshowtoremote"}, "id": 0}`
|
||||
this.instance.mpConnection.sendJsonMessage(m)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,42 +85,52 @@ export class MPconnection {
|
|||
}
|
||||
}
|
||||
|
||||
sendMessage(method: string, id: any): void {
|
||||
if (this.websocket?.readyState === 1) {
|
||||
var m = `{"jsonrpc":"2.0","method":"${method}","id": ${id}}`
|
||||
this.websocket?.send(m)
|
||||
//this.instance.log('debug', 'SENDING WS MESSAGE ' + this.websocket.url + ' ' + m)
|
||||
}
|
||||
}
|
||||
// sendMessage(method: string, id: any): void {
|
||||
// if (this.websocket?.readyState === 1) {
|
||||
// var m = `{"jsonrpc":"2.0","method":"${method}","id": ${id}}`
|
||||
// this.websocket?.send(m)
|
||||
// //this.instance.log('debug', 'SENDING WS MESSAGE ' + this.websocket.url + ' ' + m)
|
||||
// }
|
||||
// }
|
||||
|
||||
sendMessageLunchTask(uuid: any, id: any): void {
|
||||
if (this.websocket?.readyState === 1) {
|
||||
var m = `{"jsonrpc":"2.0","method":"doaction.task", "params": {
|
||||
"uuid": "${uuid}",
|
||||
"action": "launch"
|
||||
},"id": ${id}}`
|
||||
this.websocket?.send(m)
|
||||
//this.instance.log('debug', 'SENDING WS MESSAGE LAUNCH TASK ' + this.websocket.url + ' ' + m)
|
||||
}
|
||||
}
|
||||
// sendMessageLunchTask(uuid: any, id: any): void {
|
||||
// if (this.websocket?.readyState === 1) {
|
||||
// var m = `{"jsonrpc":"2.0","method":"doaction.task", "params": {
|
||||
// "uuid": "${uuid}",
|
||||
// "action": "launch"
|
||||
// },"id": ${id}}`
|
||||
// this.websocket?.send(m)
|
||||
// //this.instance.log('debug', 'SENDING WS MESSAGE LAUNCH TASK ' + this.websocket.url + ' ' + m)
|
||||
// }
|
||||
// }
|
||||
|
||||
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 ' + this.websocket.url + ' ' + message)
|
||||
}
|
||||
}
|
||||
|
||||
sendMessagePlaylistsCues(): void {
|
||||
if (this.websocket?.readyState === 1) {
|
||||
var m = `{"jsonrpc":"2.0","method":"get.list.playlists",
|
||||
"params": {
|
||||
"level": "cue"},
|
||||
"id": 3}`
|
||||
this.websocket?.send(m)
|
||||
//this.instance.log('debug', 'SENDING WS MESSAGE GET PLAYLISTS CUES ' + this.websocket.url + ' ' + m)
|
||||
}
|
||||
}
|
||||
// sendMessagePlaylistsCues(): void {
|
||||
// if (this.websocket?.readyState === 1) {
|
||||
// var m = `{"jsonrpc":"2.0","method":"get.list.playlists",
|
||||
// "params": {
|
||||
// "level": "cue"},
|
||||
// "id": 3}`
|
||||
// this.websocket?.send(m)
|
||||
// //this.instance.log('debug', 'SENDING WS MESSAGE GET PLAYLISTS CUES ' + this.websocket.url + ' ' + m)
|
||||
// }
|
||||
// }
|
||||
|
||||
// async sendMessageCurrentCues(): Promise<void> {
|
||||
// if (this.websocket?.readyState === 1) {
|
||||
// var m = `{"jsonrpc":"2.0","method":"get.list.playlists",
|
||||
// "params": {
|
||||
// "level": "playlist"},
|
||||
// "id": 110}`
|
||||
// this.websocket?.send(m)
|
||||
// }
|
||||
// }
|
||||
|
||||
disconnect(): void {
|
||||
clearTimeout(this.wsTimeout)
|
||||
|
|
|
|||
145
src/presets.ts
145
src/presets.ts
|
|
@ -253,6 +253,51 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
|||
feedbacks: [],
|
||||
})
|
||||
|
||||
// GRAND MASTER LIVE
|
||||
playlistsPresets.push({
|
||||
category: `${playlist + 1} - ${plName}`,
|
||||
name: `${plName}\nGM\nRotate`,
|
||||
type: 'button',
|
||||
options: {
|
||||
rotaryActions: true,
|
||||
},
|
||||
style: {
|
||||
text: `${plName}\nGM\nRotate`,
|
||||
size: textSize,
|
||||
color: combineRgb(255, 255, 255),
|
||||
bgcolor: instance.grayModuloPlayer,
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
down: [],
|
||||
up: [],
|
||||
rotate_left: [
|
||||
{
|
||||
actionId: 'grand_master_fader_remove',
|
||||
options: {
|
||||
value: 1,
|
||||
duration: 0,
|
||||
plUUID: `${plID}`,
|
||||
pl: playlist.toString(),
|
||||
},
|
||||
},
|
||||
],
|
||||
rotate_right: [
|
||||
{
|
||||
actionId: 'grand_master_fader_add',
|
||||
options: {
|
||||
value: 1,
|
||||
duration: 0,
|
||||
plUUID: `${plID}`,
|
||||
pl: playlist.toString(),
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
feedbacks: [],
|
||||
})
|
||||
|
||||
// AUDIO MASTER 0%
|
||||
playlistsPresets.push({
|
||||
category: `${playlist + 1} - ${plName}`,
|
||||
|
|
@ -313,6 +358,51 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
|||
feedbacks: [],
|
||||
})
|
||||
|
||||
// AUDIO MASTER LIVE
|
||||
playlistsPresets.push({
|
||||
category: `${playlist + 1} - ${plName}`,
|
||||
name: `${plName}\nAM\nRotate`,
|
||||
type: 'button',
|
||||
options: {
|
||||
rotaryActions: true,
|
||||
},
|
||||
style: {
|
||||
text: `${plName}\nAM\nRotate`,
|
||||
size: textSize,
|
||||
color: combineRgb(255, 255, 255),
|
||||
bgcolor: instance.grayModuloPlayer,
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
down: [],
|
||||
up: [],
|
||||
rotate_left: [
|
||||
{
|
||||
actionId: 'audio_master_remove',
|
||||
options: {
|
||||
value: 1,
|
||||
duration: 0,
|
||||
plUUID: `${plID}`,
|
||||
pl: playlist.toString(),
|
||||
},
|
||||
},
|
||||
],
|
||||
rotate_right: [
|
||||
{
|
||||
actionId: 'audio_master_add',
|
||||
options: {
|
||||
value: 1,
|
||||
duration: 0,
|
||||
plUUID: `${plID}`,
|
||||
pl: playlist.toString(),
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
feedbacks: [],
|
||||
})
|
||||
|
||||
// GOTO
|
||||
playlistsPresets.push({
|
||||
category: `${playlist + 1} - ${plName}`,
|
||||
|
|
@ -433,7 +523,62 @@ export function getPresets(instance: MPinstance): CompanionPresetDefinitions {
|
|||
],
|
||||
})
|
||||
}
|
||||
|
||||
// VARIABLES
|
||||
playlistsPresets.push({
|
||||
category: `${playlist + 1} - ${plName}`,
|
||||
name: `Variables`,
|
||||
type: 'text',
|
||||
//text: 'Goto',
|
||||
})
|
||||
|
||||
// GRAND MASTER VARIABLES //$(Modulo_Player:pl_${instance.cleanUUID(plID)}_grandMasterFader)
|
||||
playlistsPresets.push({
|
||||
category: `${playlist + 1} - ${plName}`,
|
||||
name: `${plName}\nGM\n$(Modulo_Player:pl_${plID}_grandMasterFader)`,
|
||||
type: 'button',
|
||||
options: {
|
||||
rotaryActions: true,
|
||||
},
|
||||
style: {
|
||||
text: `${plName}\nGM\n$(Modulo_Player:pl_${instance.cleanUUID(plID)}_grandMasterFader)`,
|
||||
size: textSize,
|
||||
color: combineRgb(255, 255, 255),
|
||||
bgcolor: instance.grayModuloPlayer,
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
down: [],
|
||||
up: [],
|
||||
},
|
||||
],
|
||||
feedbacks: [],
|
||||
})
|
||||
|
||||
// GRAND MASTER VARIABLES //$(Modulo_Player:pl_${instance.cleanUUID(plID)}_grandMasterFader)
|
||||
playlistsPresets.push({
|
||||
category: `${playlist + 1} - ${plName}`,
|
||||
name: `${plName}\nAM\n$(Modulo_Player:pl_${plID}_audioMaster)`,
|
||||
type: 'button',
|
||||
options: {
|
||||
rotaryActions: true,
|
||||
},
|
||||
style: {
|
||||
text: `${plName}\nAM\n$(Modulo_Player:pl_${instance.cleanUUID(plID)}_audioMaster)`,
|
||||
size: textSize,
|
||||
color: combineRgb(255, 255, 255),
|
||||
bgcolor: instance.grayModuloPlayer,
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
down: [],
|
||||
up: [],
|
||||
},
|
||||
],
|
||||
feedbacks: [],
|
||||
})
|
||||
}
|
||||
|
||||
//instance.log("warn", "GET TASKS PRESETS 1 >>> " + tasksPresets.length)
|
||||
return playlistsPresets
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,9 @@ export function UpdateVariableDefinitions(instance: MPinstance): void {
|
|||
// CURRENT PL
|
||||
const cpl = pls[pl]
|
||||
const uuidPL: String = instance.cleanUUID(cpl['uuid'])
|
||||
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}_currentIndex`, name: `${cpl['name']} Current Cue` })
|
||||
variables.push({ variableId: `pl_${uuidPL}_grandMasterFader`, name: `${cpl['name']} Grand Master Fader` })
|
||||
variables.push({ variableId: `pl_${uuidPL}_audioMaster`, name: `${cpl['name']} Audio Master` })
|
||||
|
||||
// CUES LIST
|
||||
const cueslist: any = cpl['cues']
|
||||
|
|
|
|||
Loading…
Reference in New Issue