fasted data updates/draws

This commit is contained in:
sparks-alec
2022-02-07 02:05:29 -05:00
parent 557c051871
commit fae4775c8a
3 changed files with 160 additions and 81 deletions
+83
View File
@@ -0,0 +1,83 @@
<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>
<% } %>
<% if(isActive){ %>
<tr class="active-cue scroll-position">
<% }else{ %>
<tr >
<% } %>
<% if(partNumber!=0){ %>
<td class="num">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;P<%= partNumber %></td>
<% }else{ %>
<td class="num">&nbsp;<%= cueNumber %></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 ? "": "&nbsp;&nbsp;&nbsp;") %>
<%= 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;
}
%>
+65 -4
View File
@@ -1,3 +1,7 @@
let _ = require('lodash');
const fs = require('fs');
exports.defaultName = 'ETC Eos';
exports.connectionType = 'osc';
exports.searchOptions = {
@@ -26,14 +30,20 @@ exports.data = function (device, osc) {
const p = osc.address.split('/');
p.shift();
//console.log(address)
if (p[1] == 'out' && p[2] == 'show' && p[3] == 'name') {
device.data.showName = osc.args[0];
device.data.cuelists = {};
this.deviceInfoUpdate(device, 'defaultName', osc.args[0]);
} else if (osc.address == '/eos/out/get/cuelist/count') {
for (let i = 0; i < osc.args[0]; i++) {
device.send(`/eos/get/cuelist/index/${i}`);
}
} else if (
p[1] == 'out' &&
p[2] == 'get' &&
@@ -42,6 +52,8 @@ exports.data = function (device, osc) {
) {
device.data.cuelists[p[4]] = {};
device.send(`/eos/get/cue/${p[4]}/count`);
} else if (
p[1] == 'out' &&
p[2] == 'get' &&
@@ -51,6 +63,8 @@ exports.data = function (device, osc) {
for (let i = 0; i < osc.args[0]; i++) {
device.send(`/eos/get/cue/${p[4]}/index/${i}`);
}
} else if (
p[1] == 'out' &&
p[2] == 'get' &&
@@ -90,8 +104,13 @@ exports.data = function (device, osc) {
),
};
// console.log(p[4]+" "+p[5]+" "+p[6]+" updated")
device.draw();
device.update("cueData", {
cue: device.data.cuelists[p[4]][p[5]],
cueNumber: p[5],
uid: osc.args[1]
});
} else if (p[1] == 'out' && p[2] == 'get' && p[3] == 'cue' && p.length == 6) {
// console.log("cue "+p[4]+" "+p[5]+" deleted")
@@ -100,6 +119,8 @@ exports.data = function (device, osc) {
delete device.data.cuelists[p[4]][p[5]];
device.draw();
} else if (
p[1] == 'out' &&
p[2] == 'get' &&
@@ -109,23 +130,30 @@ exports.data = function (device, osc) {
if (osc.args.length == 3) {
device.data.cuelists[p[4]][p[5]][0].extlinks = osc.args[2];
}
} else if (
p[1] == 'out' &&
p[2] == 'event' &&
p[3] == 'cue' &&
p[6] == 'fire'
) {
// explore replacing this with /eos/out/active/cue
device.data.activeCue = p[5];
device.draw();
device.update("activeCue", {uid: device.data.cuelists[p[4]][p[5]][0].uid});
} else if (p[1] == 'out' && p[2] == 'notify' && p[3] == 'cue') {
const cueList = p[4];
const listIndex = p[6];
const listCount = p[7];
const cueNumber = osc.args[1];
console.log(cueNumber+" changed")
device.send(`/eos/get/cue/${cueList}/${cueNumber}`);
// console.log("SENT /eos/get/cue/"+cueList+"/"+cueNumber);
} else if (
p[2] == 'cmd' ||
p[2] == 'ping' ||
@@ -134,11 +162,44 @@ exports.data = function (device, osc) {
) {
} else if (p[3] == 'version') {
device.data.version = osc.args[0];
} else {
// console.log(osc);
}
// console.log(p)
};
let cueTemplate = _.template(fs.readFileSync(`./plugins/eos/cue.ejs`));
exports.update = function(device, doc, updateType, data){
if(updateType == "cueData"){
$elem = doc.getElementById(data.uid);
if($elem){
$elem.outerHTML = cueTemplate({
q: data.cue,
cueNumber: data.cueNumber,
isActive: false
});
}else{
device.draw();
}
}else if(updateType == "activeCue"){
$elem = doc.getElementById(data.uid);
$elem.scrollIntoView({behavior: "smooth", block: "center"});
}
}
exports.heartbeat = function (device) {
device.send('/eos/ping');
};
+12 -77
View File
@@ -1,8 +1,13 @@
<header>
<h1><%= listName %></h1>
<h2><%= data.version %></h2>
<h2>Eos <%= data.version %></h2>
</header>
<%
const fs = require('fs');
let cueTemplate = _.template(fs.readFileSync(`./plugins/eos/cue.ejs`));
%>
<% for(var i in data.cuelists){ %>
<strong>List <%= i %></strong>
@@ -28,69 +33,12 @@
<% for(var j=0; j<cues.length; j++){ %>
<% var q = data.cuelists[i][cues[j]] %>
<% for(var partNumber in q){ %>
<% var p = q[partNumber] %>
<% if(p.scene.length>0 && partNumber==0){ %>
<tr>
<td></td>
<td colspan="12" class="scene"><hr><span><%= p.scene %></span></td>
</tr>
<% } %>
<% if(cues[j]==data.activeCue+""){ %>
<tr class="active-cue scroll-position">
<% }else{ %>
<tr>
<% } %>
<% if(partNumber!=0){ %>
<td class="num">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;P<%= partNumber %></td>
<% }else{ %>
<td class="num">&nbsp;<%= cues[j] %></td>
<% } %>
<% if(partNumber!=0 || p.partcount==0){ %>
<!-- Int Up/Int Down -->
<% if(p.uptimeduration == p.downtimeduration || p.downtimeduration==-1){ %>
<td class="black" colspan="2"><%= prettyDuration(p.uptimedelay) || "" %><%= prettyDuration(p.uptimeduration, true) %></td>
<% }else{ %>
<td class="black"><%= prettyDuration(p.uptimedelay) || "" %><%= prettyDuration(p.uptimeduration, true) %></td>
<td class="black "><%= prettyDuration(p.downtimeduration, true) %></td>
<% } %>
<td class="black hide-medium"><%= prettyDuration(p.focustimeduration, true) %></td>
<td class="black hide-medium"><%= prettyDuration(p.colortimeduration, true) %></td>
<td class="black hide-medium"><%= prettyDuration(p.beamtimeduration, true) %></td>
<td class="hide-small"><%= prettyDuration(p.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"><%= p.mark %></td>
<td class="black hide-small"><%= p.block %></td>
<td class="black hide-small"><%= p.assert %></td>
<td class="black hide-small">
<%= (p.follow>=0)? "F"+prettyDuration(p.follow) : "" %>
<%= (p.hang>=0)? "H"+prettyDuration(p.hang) : "" %>
</td>
<td class="black" style="text-align: left">
<%= (partNumber==0 ? "": "&nbsp;&nbsp;&nbsp;") %>
<%= p.label %>
</td>
<td class="black hide-medium"><%= p.extlinks %></td>
</tr>
<% } %>
<%= cueTemplate({
q: q,
cues: cues,
cueNumber: cues[j],
isActive: (cues[j]==data.activeCue+"")
}) %>
<% } %>
</table>
@@ -98,16 +46,3 @@
<% } %>
<%
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;
}
%>