mirror of
https://github.com/stagehacks/Cue-View.git
synced 2026-08-07 14:53:38 +00:00
eos cleanup
This commit is contained in:
+77
-80
@@ -1,83 +1,80 @@
|
||||
<tbody id="<%= q[0].uid %>">
|
||||
<% for(var partNumber in q){ %>
|
||||
<% var part = q[partNumber] %>
|
||||
<%if(part.scene.length>0 && partNumber==0){ %>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td colspan="12" class="scene">
|
||||
<hr />
|
||||
<span><%= part.scene %></span>
|
||||
</td>
|
||||
</tr>
|
||||
<% } %>
|
||||
|
||||
<% for(var partNumber in q){ %>
|
||||
|
||||
<% var part = q[partNumber] %>
|
||||
|
||||
|
||||
<% if(part.scene.length>0 && partNumber==0){ %>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td colspan="12" class="scene"><hr><span><%= part.scene %></span></td>
|
||||
</tr>
|
||||
<% } %>
|
||||
|
||||
<% if(isActive){ %>
|
||||
<tr class="active-cue scroll-position">
|
||||
<% }else{ %>
|
||||
<tr >
|
||||
<% } %>
|
||||
|
||||
<% if(partNumber!=0){ %>
|
||||
<td class="num" style="padding-left: 20px;"><div>P<%= partNumber %></div></td>
|
||||
<% }else{ %>
|
||||
<td class="num"><div><%= cueNumber %></div></td>
|
||||
<% } %>
|
||||
|
||||
<% if(partNumber!=0 || part.partcount==0){ %>
|
||||
|
||||
<!-- Int Up/Int Down -->
|
||||
<% if(part.uptimeduration == part.downtimeduration || part.downtimeduration==-1){ %>
|
||||
<td class="black" colspan="2"><%= prettyDuration(part.uptimedelay) || "" %><%= prettyDuration(part.uptimeduration, true) %></td>
|
||||
<% }else{ %>
|
||||
<td class="black"><%= prettyDuration(part.uptimedelay) || "" %><%= prettyDuration(part.uptimeduration, true) %></td>
|
||||
<td class="black "><%= prettyDuration(part.downtimeduration, true) %></td>
|
||||
<% } %>
|
||||
|
||||
<td class="black hide-medium"><%= prettyDuration(part.focustimeduration, true) %></td>
|
||||
<td class="black hide-medium"><%= prettyDuration(part.colortimeduration, true) %></td>
|
||||
<td class="black hide-medium"><%= prettyDuration(part.beamtimeduration, true) %></td>
|
||||
<td class="hide-small"><%= prettyDuration(part.duration) %></td>
|
||||
|
||||
<% }else{ %>
|
||||
<td class="black" colspan="2"></td>
|
||||
<td class="black hide-medium"></td>
|
||||
<td class="black hide-medium"></td>
|
||||
<td class="black hide-medium"></td>
|
||||
<td class="hide-small"></td>
|
||||
|
||||
<% } %>
|
||||
|
||||
<td class="black hide-small"><%= part.mark %></td>
|
||||
<td class="black hide-small"><%= part.block %></td>
|
||||
<td class="black hide-small"><%= part.assert %></td>
|
||||
<td class="black hide-small">
|
||||
<%= (part.follow>=0)? "F"+prettyDuration(part.follow) : "" %>
|
||||
<%= (part.hang>=0)? "H"+prettyDuration(part.hang) : "" %>
|
||||
</td>
|
||||
<td class="black" style="text-align: left">
|
||||
<%= (partNumber==0 ? "": " ") %>
|
||||
<%= part.label %>
|
||||
</td>
|
||||
<td class="black hide-medium"><%= part.extlinks %></td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
<% } %>
|
||||
|
||||
</tbody>
|
||||
|
||||
<%
|
||||
function prettyDuration(milliseconds, box){
|
||||
if(milliseconds==-1){
|
||||
return "";
|
||||
}
|
||||
var num = Math.round(milliseconds/100)/10;
|
||||
if(box){
|
||||
return "<div class='time'>"+num+"</div>";
|
||||
}
|
||||
return num;
|
||||
<% if(isActive){ %>
|
||||
<tr class="active-cue scroll-position">
|
||||
<% }else{ %>
|
||||
</tr>
|
||||
<tr>
|
||||
<% } %>
|
||||
|
||||
}
|
||||
%>
|
||||
<% if(partNumber!=0){ %>
|
||||
<td class="num" style="padding-left: 20px">
|
||||
<div>P<%= partNumber %></div>
|
||||
</td>
|
||||
<% }else{ %>
|
||||
<td class="num"><div><%= cueNumber %></div></td>
|
||||
<% } %>
|
||||
|
||||
<% if(partNumber !== 0 || part.partCount === 0){ %>
|
||||
|
||||
<!-- Int Up/Int Down -->
|
||||
<% if(part.uptimeDuration === part.downtimeDuration || part.downtimeDuration === -1){ %>
|
||||
<td class="black" colspan="2">
|
||||
<%= part.prettyDuration(part.uptimeDelay) || "" %>
|
||||
<%= part.prettyDuration(part.uptimeDuration, true) %>
|
||||
</td>
|
||||
<% }else{ %>
|
||||
<td class="black">
|
||||
<%= part.prettyDuration(part.uptimeDelay) || "" %>
|
||||
<%= part.prettyDuration(part.uptimeDuration, true) %>
|
||||
</td>
|
||||
<td class="black">
|
||||
<%= part.prettyDuration(part.downtimeDuration, true) %>
|
||||
</td>
|
||||
<% } %>
|
||||
|
||||
<td class="black hide-medium">
|
||||
<%= part.prettyDuration(part.focusDimeDuration, true) %>
|
||||
</td>
|
||||
<td class="black hide-medium">
|
||||
<%= part.prettyDuration(part.colorDimeDuration, true) %>
|
||||
</td>
|
||||
<td class="black hide-medium">
|
||||
<%= part.prettyDuration(part.beamDimeDuration, true) %>
|
||||
</td>
|
||||
<td class="hide-small"><%= part.prettyDuration(part.duration) %></td>
|
||||
|
||||
<% }else{ %>
|
||||
<td class="black" colspan="2"></td>
|
||||
<td class="black hide-medium"></td>
|
||||
<td class="black hide-medium"></td>
|
||||
<td class="black hide-medium"></td>
|
||||
<td class="hide-small"></td>
|
||||
<% } %>
|
||||
|
||||
<td class="black hide-small"><%= part.mark %></td>
|
||||
<td class="black hide-small"><%= part.block %></td>
|
||||
<td class="black hide-small"><%= part.assert %></td>
|
||||
<td class="black hide-small">
|
||||
<%= (part.follow>=0)? "F"+part.prettyDuration(part.follow) : "" %>
|
||||
<%= (part.hang>=0)? "H"+part.prettyDuration(part.hang) : "" %>
|
||||
</td>
|
||||
<td class="black" style="text-align: left">
|
||||
<%= (partNumber==0 ? "": " ") %>
|
||||
<%= part.label %>
|
||||
</td>
|
||||
<td class="black hide-medium"><%= part.extLinks %></td>
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/* eslint-disable class-methods-use-this */
|
||||
class Cue {
|
||||
constructor(args) {
|
||||
this.uid = args[1];
|
||||
this.label = args[2];
|
||||
this.uptimeDuration = args[3];
|
||||
this.uptimeDelay = args[4];
|
||||
this.downtimeDuration = args[5];
|
||||
this.downtimeDelay = args[6];
|
||||
this.focusTimeDuration = args[7];
|
||||
this.focusTimeDelay = args[8];
|
||||
this.colorTimeDuration = args[9];
|
||||
this.colorTimeDelay = args[10];
|
||||
this.beamTimeDuration = args[11];
|
||||
this.beamTimeDelay = args[12];
|
||||
this.mark = args[16];
|
||||
this.block = args[17];
|
||||
this.assert = args[18];
|
||||
this.follow = args[20];
|
||||
this.hang = args[21];
|
||||
this.partCount = args[26];
|
||||
this.scene = args[28];
|
||||
this.duration = Math.max(args[3], args[5], args[7], args[9], args[11]);
|
||||
}
|
||||
|
||||
prettyDuration(milliseconds, box) {
|
||||
if (milliseconds === -1) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const num = Math.round(milliseconds / 100) / 10;
|
||||
if (box) {
|
||||
return `<div class="time">"${num}"</div>`;
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Cue;
|
||||
+76
-103
@@ -1,6 +1,7 @@
|
||||
const _ = require('lodash');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const Cue = require('./cue');
|
||||
|
||||
exports.defaultName = 'ETC Eos';
|
||||
exports.connectionType = 'osc';
|
||||
@@ -11,17 +12,19 @@ exports.searchOptions = {
|
||||
'ascii'
|
||||
),
|
||||
testPort: 3032,
|
||||
validateResponse (msg, info) {
|
||||
validateResponse(msg, info) {
|
||||
return msg.toString().indexOf('/eos/out');
|
||||
},
|
||||
};
|
||||
exports.defaultPort = 3037;
|
||||
|
||||
exports.defaultPort = 3032;
|
||||
|
||||
exports.ready = function ready(device) {
|
||||
device.send('/eos/get/cuelist/count');
|
||||
device.send('/eos/get/version');
|
||||
device.send('/eos/subscribe', [{ type: 'i', value: 1 }]);
|
||||
const d = device;
|
||||
d.data.EOS = new EOS();
|
||||
|
||||
d.send('/eos/get/cuelist/count');
|
||||
d.send('/eos/get/version');
|
||||
d.send('/eos/subscribe', [{ type: 'i', value: 1 }]);
|
||||
};
|
||||
|
||||
exports.data = function data(device, osc) {
|
||||
@@ -31,151 +34,121 @@ exports.data = function data(device, osc) {
|
||||
|
||||
// console.log(osc.address)
|
||||
|
||||
if (match(p, ['eos','out','show','name'])) {
|
||||
d.data.showName = osc.args[0];
|
||||
d.data.cuelists = {};
|
||||
if (match(p, ['eos', 'out', 'show', 'name'])) {
|
||||
d.data.EOS.showName = osc.args[0];
|
||||
d.data.EOS.cueLists = {};
|
||||
this.deviceInfoUpdate(device, 'defaultName', osc.args[0]);
|
||||
|
||||
|
||||
} else if (match(p, ['eos','out','get','cuelist','count'])) {
|
||||
} else if (match(p, ['eos', 'out', 'get', 'cuelist', 'count'])) {
|
||||
for (let i = 0; i < osc.args[0]; i++) {
|
||||
d.send(`/eos/get/cuelist/index/${i}`);
|
||||
}
|
||||
|
||||
|
||||
} else if (match(p, ['eos','out','get','cuelist','*','list','*','*'])) {
|
||||
d.data.cuelists[p[4]] = {};
|
||||
} else if (
|
||||
match(p, ['eos', 'out', 'get', 'cuelist', '*', 'list', '*', '*'])
|
||||
) {
|
||||
d.data.EOS.cueLists[p[4]] = {};
|
||||
d.send(`/eos/get/cue/${p[4]}/count`);
|
||||
|
||||
|
||||
} else if (match(p, ['eos','out','get','cue','*','count'])) {
|
||||
} else if (match(p, ['eos', 'out', 'get', 'cue', '*', 'count'])) {
|
||||
for (let i = 0; i < osc.args[0]; i++) {
|
||||
device.send(`/eos/get/cue/${p[4]}/index/${i}`);
|
||||
}
|
||||
|
||||
|
||||
} else if (match(p, ['eos','out','get','cue','*','*','*','list','*','*'])) {
|
||||
} else if (
|
||||
match(p, ['eos', 'out', 'get', 'cue', '*', '*', '*', 'list', '*', '*'])
|
||||
) {
|
||||
this.deviceInfoUpdate(device, 'status', 'ok');
|
||||
if (d.data.cuelists[p[4]][p[5]] === undefined) {
|
||||
d.data.cuelists[p[4]][p[5]] = {};
|
||||
if (d.data.EOS.cueLists[p[4]][p[5]] === undefined) {
|
||||
d.data.EOS.cueLists[p[4]][p[5]] = {};
|
||||
}
|
||||
d.data.cuelists[p[4]][p[5]][p[6]] = {
|
||||
uid: osc.args[1],
|
||||
label: osc.args[2],
|
||||
uptimeduration: osc.args[3],
|
||||
uptimedelay: osc.args[4],
|
||||
downtimeduration: osc.args[5],
|
||||
downtimedelay: osc.args[6],
|
||||
focustimeduration: osc.args[7],
|
||||
focustimedelay: osc.args[8],
|
||||
colortimeduration: osc.args[9],
|
||||
colortimedelay: osc.args[10],
|
||||
beamtimeduration: osc.args[11],
|
||||
beamtimedelay: osc.args[12],
|
||||
mark: osc.args[16],
|
||||
block: osc.args[17],
|
||||
assert: osc.args[18],
|
||||
follow: osc.args[20],
|
||||
hang: osc.args[21],
|
||||
partcount: osc.args[26],
|
||||
scene: osc.args[28],
|
||||
duration: Math.max(
|
||||
osc.args[3],
|
||||
osc.args[5],
|
||||
osc.args[7],
|
||||
osc.args[9],
|
||||
osc.args[11]
|
||||
),
|
||||
};
|
||||
d.data.EOS.cueLists[p[4]][p[5]][p[6]] = new Cue(osc.args);
|
||||
|
||||
device.update("cueData", {
|
||||
cue: device.data.cuelists[p[4]][p[5]],
|
||||
device.update('cueData', {
|
||||
cue: device.data.EOS.cueLists[p[4]][p[5]],
|
||||
cueNumber: p[5],
|
||||
uid: osc.args[1]
|
||||
uid: osc.args[1],
|
||||
});
|
||||
|
||||
|
||||
} else if (match(p, ['eos','out','get','cue','*','*'])) {
|
||||
} else if (match(p, ['eos', 'out', 'get', 'cue', '*', '*'])) {
|
||||
// There's no OSC notification of the deletion of a part. It just tells you to update the parent cue and remaining children.
|
||||
// So: we should fetch all the parts of a cue somehow every time there's an update to a cue.
|
||||
delete d.data.cuelists[p[4]][p[5]];
|
||||
delete d.data.EOS.cueLists[p[4]][p[5]];
|
||||
d.draw();
|
||||
|
||||
|
||||
} else if (match(p, ['eos','out','get','cue','*','*','*','actions','list','*','*'])) {
|
||||
} else if (
|
||||
match(p, [
|
||||
'eos',
|
||||
'out',
|
||||
'get',
|
||||
'cue',
|
||||
'*',
|
||||
'*',
|
||||
'*',
|
||||
'actions',
|
||||
'list',
|
||||
'*',
|
||||
'*',
|
||||
])
|
||||
) {
|
||||
if (osc.args.length === 3) {
|
||||
d.data.cuelists[p[4]][p[5]][0].extlinks = osc.args[2];
|
||||
d.data.EOS.cueLists[p[4]][p[5]][0].extLinks = osc.args[2];
|
||||
}
|
||||
|
||||
|
||||
} else if (match(p, ['eos','out','event','cue','*','*','fire'])) {
|
||||
d.data.activeCue = p[5];
|
||||
} else if (match(p, ['eos', 'out', 'event', 'cue', '*', '*', 'fire'])) {
|
||||
d.data.EOS.activeCue = p[5];
|
||||
d.draw();
|
||||
d.update("activeCue", {uid: device.data.cuelists[p[4]][p[5]][0].uid});
|
||||
|
||||
|
||||
} else if (match(p, ['eos','out','notify','cue','*','*','*','*'])) {
|
||||
d.update('activeCue', { uid: device.data.EOS.cueLists[p[4]][p[5]][0].uid });
|
||||
} else if (match(p, ['eos', 'out', 'notify', 'cue', '*', '*', '*', '*'])) {
|
||||
const cueList = p[4];
|
||||
const cueNumber = osc.args[1];
|
||||
|
||||
d.send(`/eos/get/cue/${cueList}/${cueNumber}`);
|
||||
|
||||
|
||||
} else if (match(p, ['eos','out','get','version'])) {
|
||||
d.data.version = osc.args[0];
|
||||
|
||||
|
||||
} else if (match(p, ['eos', 'out', 'get', 'version'])) {
|
||||
d.data.EOS.version = osc.args[0];
|
||||
} else {
|
||||
// console.log(osc);
|
||||
|
||||
}
|
||||
// console.log(p)
|
||||
};
|
||||
|
||||
const cueTemplate = _.template(
|
||||
fs.readFileSync(path.join(__dirname, `cue.ejs`))
|
||||
);
|
||||
|
||||
const cueTemplate = _.template(fs.readFileSync(path.join(__dirname, `cue.ejs`)));
|
||||
|
||||
exports.update = function update(device, doc, updateType, data){
|
||||
|
||||
if(updateType === "cueData"){
|
||||
exports.update = function update(device, doc, updateType, data) {
|
||||
if (updateType === 'cueData') {
|
||||
const $elem = doc.getElementById(data.uid);
|
||||
|
||||
if($elem){
|
||||
if ($elem) {
|
||||
$elem.outerHTML = cueTemplate({
|
||||
q: data.cue,
|
||||
cueNumber: data.cueNumber,
|
||||
isActive: false
|
||||
isActive: false,
|
||||
});
|
||||
|
||||
}else{
|
||||
} else {
|
||||
device.draw();
|
||||
|
||||
}
|
||||
|
||||
}else if(updateType === "activeCue"){
|
||||
} else if (updateType === 'activeCue') {
|
||||
const $elem = doc.getElementById(data.uid);
|
||||
$elem.scrollIntoView({behavior: "smooth", block: "center"});
|
||||
|
||||
$elem.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
exports.heartbeat = function heartbeat(device) {
|
||||
device.send('/eos/ping');
|
||||
};
|
||||
|
||||
|
||||
function match(osc, array){
|
||||
function match(osc, array) {
|
||||
let out = true;
|
||||
if(osc.length !== array.length){
|
||||
if (osc.length !== array.length) {
|
||||
return false;
|
||||
}
|
||||
array.forEach((m, i)=> {
|
||||
if(osc[i] !== m && m !== "*"){
|
||||
array.forEach((m, i) => {
|
||||
if (osc[i] !== m && m !== '*') {
|
||||
out = false;
|
||||
}
|
||||
});
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
class EOS {
|
||||
constructor() {
|
||||
this.version = '';
|
||||
this.showName = '';
|
||||
this.cueLists = {};
|
||||
this.activeCue = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
%>
|
||||
|
||||
|
||||
<% for(var i in data.cuelists){ %>
|
||||
<% for(var i in data.EOS.cueLists){ %>
|
||||
<strong>List <%= i %></strong>
|
||||
<table cellspacing="0">
|
||||
<tr>
|
||||
@@ -29,16 +29,16 @@
|
||||
<th width="10px" class="hide-medium">Ext Links</th>
|
||||
</tr>
|
||||
|
||||
<% var cues = Object.keys(data.cuelists[i]).sort(function(a, b){return Number(a)-Number(b)}) %>
|
||||
<% var cues = Object.keys(data.EOS.cueLists[i]).sort(function(a, b){return Number(a)-Number(b)}) %>
|
||||
|
||||
<% for(var j=0; j<cues.length; j++){ %>
|
||||
<% var q = data.cuelists[i][cues[j]] %>
|
||||
<% var q = data.EOS.cueLists[i][cues[j]] %>
|
||||
|
||||
<%= cueTemplate({
|
||||
q: q,
|
||||
cues: cues,
|
||||
cueNumber: cues[j],
|
||||
isActive: (cues[j]==data.activeCue+"")
|
||||
isActive: (cues[j]==data.EOS.activeCue+"")
|
||||
}) %>
|
||||
|
||||
<% } %>
|
||||
|
||||
Reference in New Issue
Block a user