mirror of
https://github.com/stagehacks/Cue-View.git
synced 2026-08-09 15:53:38 +00:00
add Cue Carts
This commit is contained in:
@@ -0,0 +1,134 @@
|
||||
<tr class="q-<%= cue.colorName %> q-armed-<%= cue.armed %>" id="<%= cue.uniqueID %>">
|
||||
|
||||
<td></td> <!-- playhead/color indicator -->
|
||||
|
||||
<td><center>
|
||||
<% if(cue.broken){ %>
|
||||
<img src="plugins/qlab/img/status_broken.png" height="18px">
|
||||
|
||||
<% }else if(cue.running){ %>
|
||||
<img src="plugins/qlab/img/status_running.png" height="18px">
|
||||
|
||||
<% }else if(cue.loaded){ %>
|
||||
<img src="plugins/qlab/img/status_loaded.png" height="18px">
|
||||
|
||||
<% }else if(cue.flagged){ %>
|
||||
<img src="plugins/qlab/img/status_flagged.png" height="20px">
|
||||
|
||||
<% }else{ %>
|
||||
|
||||
<% } %>
|
||||
</center></td>
|
||||
|
||||
|
||||
<td><img src="plugins/qlab/img/<%= cue.type.toLowerCase().replace(' ','-') %>.png" height="20px"></td>
|
||||
<td><center><%= cue.number || " " %></center></td>
|
||||
|
||||
|
||||
|
||||
|
||||
<% for(let i=cue.nestedGroupModes.length; i>0; i--){ %>
|
||||
|
||||
<% let test = "" %>
|
||||
|
||||
<% if(cue.type=="Group" && i==1 && cue.cues.length==0){ %>
|
||||
<td class="gMode-<%= cue.nestedGroupModes[i-1] %> gLeft gTop gBot group-arrow"><%= test %></td>
|
||||
|
||||
<% }else if(cue.type=="Group" && i==1){ %>
|
||||
<td class="gMode-<%= cue.nestedGroupModes[i-1] %> gLeft gTop group-arrow"><%= test %></td>
|
||||
|
||||
<% }else if(cue.nestedGroupPosition[i-1]==0 && cue.nestedGroupPosition[i-2]==0){ %>
|
||||
<td class="gMode-<%= cue.nestedGroupModes[i-1] %> gLeft gBot"><%= test %></td>
|
||||
|
||||
<% }else if(i==1 && cue.nestedGroupPosition[i]==0){ %>
|
||||
<td class="gMode-<%= cue.nestedGroupModes[i] %> gBot"><%= test %></td>
|
||||
|
||||
<% }else{ %>
|
||||
<td class="gMode-<%= cue.nestedGroupModes[i-1] %> gLeft"><%= test %></td>
|
||||
|
||||
<% } %>
|
||||
|
||||
<% } %>
|
||||
|
||||
|
||||
|
||||
<!-- end spacer cells -->
|
||||
|
||||
|
||||
<% if(cue.type=="Group"){ %>
|
||||
<% if(cue.cues.length==0){ %>
|
||||
<td id="cue-name" colspan="<%= 11-cue.nestedGroupModes.length %>" class="gMode-<%= cue.groupMode %> gTop gBot gRight"><%= cue.listName %></td>
|
||||
|
||||
<% }else{ %>
|
||||
<td id="cue-name" colspan="<%= 11-cue.nestedGroupModes.length %>" class="gMode-<%= cue.groupMode %> gTop gRight"><%= cue.listName %></td>
|
||||
|
||||
<% } %>
|
||||
|
||||
<% }else if(cue.nestedGroupPosition[1]==0){ %>
|
||||
<td colspan="<%= 11-cue.nestedGroupModes.length %>" class="cue-name gMode-<%= cue.nestedGroupModes[1] %> gBot gRight"><%= cue.listName %></td>
|
||||
|
||||
<% }else{ %>
|
||||
<td colspan="<%= 11-cue.nestedGroupModes.length %>" class="cue-name gMode-<%= cue.nestedGroupModes[1] %> gRight"><%= cue.listName %></td>
|
||||
|
||||
<% } %>
|
||||
|
||||
|
||||
<td class="q-time hide-medium"><%= cue.target %></td>
|
||||
|
||||
|
||||
|
||||
|
||||
<% if(cue.preWait){ %>
|
||||
<td class="q-time hide-small"><%= prettyFormatTime(cue.preWait) %></td>
|
||||
|
||||
<% }else{ %>
|
||||
<td class="q-time q-gray-text hide-small">00:00.00</td>
|
||||
|
||||
<% } %>
|
||||
|
||||
|
||||
|
||||
<% if(cue.duration || (cue.type=="Group" && cue.mode==3)){ %>
|
||||
<td class="q-time hide-medium"><%= prettyFormatTime(cue.duration) %></td>
|
||||
|
||||
<% }else{ %>
|
||||
<td class="hide-medium"></td>
|
||||
|
||||
<% } %>
|
||||
|
||||
|
||||
|
||||
<% if(cue.postWait){ %>
|
||||
<td class="q-time q-gray-text hide-medium"><%= prettyFormatTime(cue.postWait) %></td>
|
||||
|
||||
<% }else{ %>
|
||||
<td class="q-time q-gray-text hide-medium">00:00.00</td>
|
||||
|
||||
<% } %>
|
||||
|
||||
|
||||
|
||||
<% if(cue.continueMode==2){ %>
|
||||
<td class="hide-small"><center><img src="plugins/qlab/img/auto_follow.png" height="20px"></center></td>
|
||||
|
||||
<% }else if(cue.continueMode==1){ %>
|
||||
<td class="hide-small"><center><img src="plugins/qlab/img/auto_continue.png" height="20px"></center></td>
|
||||
|
||||
<% }else{ %>
|
||||
<td class="hide-small"></td>
|
||||
|
||||
<% } %>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
<%
|
||||
function prettyFormatTime(seconds){
|
||||
var startIndex = 14;
|
||||
if(seconds>=3600){
|
||||
startIndex = 11;
|
||||
}
|
||||
var string = new Date(seconds * 1000).toISOString()
|
||||
return string.substring(startIndex, string.length-2)
|
||||
}
|
||||
%>
|
||||
@@ -0,0 +1,54 @@
|
||||
<h3 id="<%= cueList.uniqueID %>"> </h3>
|
||||
|
||||
<table cellspacing="0">
|
||||
<tr>
|
||||
<th width="1px" style="border-left: none; border-right: none;"></th>
|
||||
<th width="20px" style="border-left: none; border-right: none;"></th>
|
||||
<th width="20px" style="border-left: none;"></th>
|
||||
<th width="55px">Number</th>
|
||||
<th width="25px" style="padding: 0px"></th>
|
||||
<th width="25px" class="no-border">Q</th>
|
||||
<th width="25px" class="no-border"></th>
|
||||
<th width="25px" class="no-border"></th>
|
||||
<th width="25px" class="no-border"></th>
|
||||
<th width="25px" class="no-border"></th>
|
||||
<th width="25px" class="no-border"></th>
|
||||
<th width="25px" class="no-border"></th>
|
||||
<th width="25px" class="no-border"></th>
|
||||
<th width="25px" class="no-border"></th>
|
||||
<th class="no-border"></th>
|
||||
<th width="55px" class="hide-medium">Target</th>
|
||||
<th width="80px" class="hide-small"style="border-right: none;">Pre Wait</th>
|
||||
<th width="80px" class="hide-medium" style="border-left: none; border-right: none;">Action</th>
|
||||
<th width="80px" class="hide-medium" style="border-left: none; border-right: none;">Post Wait</th>
|
||||
<th width="20px" class="hide-small" style="border-left: none; border-right: none;">
|
||||
<img src="plugins/qlab/img/auto_continue_stubby.png" height="20px">
|
||||
</th>
|
||||
</tr>
|
||||
<tbody id="">
|
||||
|
||||
<% for(const cue_id in cueList.cues){ %>
|
||||
<%= displayCueRow(cueList.cues[cue_id]) %>
|
||||
<% } %>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<%
|
||||
|
||||
|
||||
|
||||
function displayCueRow(q){
|
||||
let html = "";
|
||||
|
||||
html+= rowTemplate({cue: allCues[q.uniqueID], allCues: allCues});
|
||||
|
||||
if(q.cues){
|
||||
q.cues.forEach(q =>{
|
||||
html+=displayCueRow(q);
|
||||
})
|
||||
}
|
||||
return html;
|
||||
}
|
||||
%>
|
||||
@@ -219,10 +219,19 @@ tr.playback-position .q-gray-text {
|
||||
border-color: #a601c0;
|
||||
background-color: #592d74;
|
||||
}
|
||||
.cartColor-none{
|
||||
border-color: #95929f;
|
||||
background-color: #3b3b3b
|
||||
}
|
||||
.cartBlank{
|
||||
border-color: #1f1f1f;
|
||||
background-color: #1f1f1f;
|
||||
}
|
||||
.cartCueWrapper.playback-position .cartCue{
|
||||
border-color: #88b3db;
|
||||
outline: #88b3db 1px solid;
|
||||
box-shadow: 0px 0px 3px 3px #88b3db, inset 0px 0px 5px #88b3db;
|
||||
}
|
||||
|
||||
|
||||
@media screen and (min-width: 0px) and (max-width: 750px) {
|
||||
|
||||
+90
-258
@@ -1,269 +1,101 @@
|
||||
<% function cueTemplate(cueList, groupModes, depth, workspace){ %>
|
||||
|
||||
<% depth++ %>
|
||||
|
||||
<% for(var c in cueList.cues){ %>
|
||||
|
||||
<% var cue = cueList.cues[c] %>
|
||||
<tr class="q-<%= cue.colorName %> q-armed-<%= cue.armed %> <%if(data.playbackPosition==cue.uniqueID){ %>playback-position scroll-position<% } %>" id="<%= cue.uniqueID %>">
|
||||
|
||||
<td></td> <!-- playhead/color indicator -->
|
||||
|
||||
<td><center>
|
||||
<% if(cue.broken){ %>
|
||||
<img src="plugins/qlab/img/status_broken.png" height="18px">
|
||||
<% }else if(cue.running){ %>
|
||||
<img src="plugins/qlab/img/status_running.png" height="18px">
|
||||
<% }else if(cue.loaded){ %>
|
||||
<img src="plugins/qlab/img/status_loaded.png" height="18px">
|
||||
<% }else if(cue.flagged){ %>
|
||||
<img src="plugins/qlab/img/status_flagged.png" height="20px">
|
||||
<% }else{ %>
|
||||
|
||||
<% } %>
|
||||
</center></td>
|
||||
|
||||
|
||||
<td><img src="plugins/qlab/img/<%= cue.type.toLowerCase() %>.png" height="20px"></td>
|
||||
<td><center><%- cue.number || " " %></center></td>
|
||||
|
||||
<%
|
||||
var nextCueDepth = 0;
|
||||
if(workspace.allCuesOrdered[cue.index+1]!=undefined){
|
||||
nextCueDepth = workspace.allCuesOrdered[cue.index+1].groups.length-1;
|
||||
}
|
||||
|
||||
%>
|
||||
|
||||
|
||||
|
||||
<!-- spacer cells before cue name -->
|
||||
<% for(var i=0; i<depth; i++){ %>
|
||||
|
||||
<% if(i==depth-1 && cue.type=="Group"){ %>
|
||||
|
||||
<% if(cue.cues.length==0){ %>
|
||||
<td width="15px" class="group-arrow gMode-<%= cue.mode %> gLeft gTop gBot"></td>
|
||||
|
||||
<% }else{ %>
|
||||
<td width="15px" class="group-arrow gMode-<%= cue.mode %> gLeft gTop"></td>
|
||||
|
||||
<% } %>
|
||||
|
||||
<% }else if(i<nextCueDepth){ %>
|
||||
<td width="15px" class="gMode-<%= groupModes[i] %> gLeft"></td>
|
||||
|
||||
<% }else if(i>=nextCueDepth && i<depth-1 ){ %>
|
||||
<td width="15px" class="gMode-<%= groupModes[i] %> gLeft gBot"></td>
|
||||
|
||||
<% }else if(i==depth-1 && i>nextCueDepth){ %>
|
||||
<td width="15px" class="gMode-<%= groupModes[groupModes.length-1] %> gBot"></td>
|
||||
|
||||
<% }else{ %>
|
||||
<td width="15px" ></td>
|
||||
|
||||
<% } %>
|
||||
|
||||
<% } %>
|
||||
|
||||
|
||||
|
||||
<!-- cue name -->
|
||||
<% if(cue.type=="Group"){ %>
|
||||
<% if(cue.cues.length==0){ %>
|
||||
<td colspan="<%= 11-depth %>" class="gMode-<%= cue.mode %> gTop gBot gRight"><%= cue.listName %></td>
|
||||
|
||||
<% }else{ %>
|
||||
<td colspan="<%= 11-depth %>" class="gMode-<%= cue.mode %> gTop gRight"><%= cue.listName %></td>
|
||||
|
||||
<% } %>
|
||||
<% }else if(depth>nextCueDepth+1){ %>
|
||||
<td colspan="<%= 11-depth %>" class="gMode-<%= groupModes[groupModes.length-1] %> gBot gRight"><%= cue.listName %></td>
|
||||
|
||||
<% }else if(depth>1){ %>
|
||||
<td colspan="<%= 11-depth %>" class="gMode-<%= groupModes[groupModes.length-1] %> gRight"><%= cue.listName %></td>
|
||||
|
||||
<% }else{ %>
|
||||
<td colspan="<%= 11-depth %>"><%= cue.listName %></td>
|
||||
|
||||
<% } %>
|
||||
|
||||
<td class="q-time hide-medium"><%= cue.target %></td>
|
||||
|
||||
<% if(cue.preWait){ %>
|
||||
<td class="q-time hide-small"><%= prettyFormatTime(cue.preWait) %></td>
|
||||
<% }else{ %>
|
||||
<td class="q-time q-gray-text hide-small">00:00.00</td>
|
||||
<% } %>
|
||||
|
||||
<% if(cue.duration || (cue.type=="Group" && cue.mode==3)){ %>
|
||||
<% %>
|
||||
<td class="q-time hide-medium"><%= prettyFormatTime(cue.duration) %></td>
|
||||
<% }else{ %>
|
||||
<td class="hide-medium"></td>
|
||||
<% } %>
|
||||
|
||||
<% if(cue.postWait){ %>
|
||||
<td class="q-time q-gray-text hide-medium"><%= prettyFormatTime(cue.postWait) %></td>
|
||||
<% }else{ %>
|
||||
<td class="q-time q-gray-text hide-medium">00:00.00</td>
|
||||
<% } %>
|
||||
|
||||
<% if(cue.continueMode==2){ %>
|
||||
<td class="hide-small"><center><img src="plugins/qlab/img/auto_follow.png" height="20px"></center></td>
|
||||
<% }else if(cue.continueMode==1){ %>
|
||||
<td class="hide-small"><center><img src="plugins/qlab/img/auto_continue.png" height="20px"></center></td>
|
||||
<% }else{ %>
|
||||
<td class="hide-small"></td>
|
||||
<% } %>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</tr>
|
||||
<% if(cue.cues){ %>
|
||||
<% groupModes.push(cue.mode) %>
|
||||
<% cueTemplate(cue, groupModes, depth, workspace) %>
|
||||
<% } %>
|
||||
|
||||
<% } %>
|
||||
<% groupModes.pop(); %>
|
||||
<% } %>
|
||||
|
||||
<% function cartTemplate(cueList, groupModes, depth, workspace){ %>
|
||||
|
||||
<% } %>
|
||||
|
||||
<header>
|
||||
<h1><%= listName %></h1>
|
||||
<h2><%= data.version || "" %></h2>
|
||||
<h1><%= listName %></h1>
|
||||
<h2><%= data.version || "" %></h2>
|
||||
</header>
|
||||
|
||||
<%
|
||||
const fs = require('fs');
|
||||
let _ = require('lodash');
|
||||
|
||||
<% for(var i in data.workspaces){ %>
|
||||
<% for(var j in data.workspaces[i].cueLists){ %>
|
||||
<%
|
||||
let cueList = data.workspaces[i].cueLists[j];
|
||||
let width = 100/cueList.cartRows;
|
||||
let height = 600/(cueList.cartColumns+1);
|
||||
%>
|
||||
let cueTemplate = _.template(fs.readFileSync(`./plugins/qlab/cue.ejs`));
|
||||
let tileTemplate = _.template(fs.readFileSync(`./plugins/qlab/tile.ejs`));
|
||||
let cartTemplate = _.template(fs.readFileSync(`./plugins/qlab/cart.ejs`));
|
||||
let listTemplate = _.template(fs.readFileSync(`./plugins/qlab/cuelist.ejs`));
|
||||
|
||||
<h3><%= cueList.listName %> - <%= data.workspaces[i].displayName %></h3>
|
||||
%>
|
||||
|
||||
|
||||
|
||||
<% if(cueList.type=="Cart"){ %>
|
||||
|
||||
<div class="cart">
|
||||
|
||||
<% for(let r=0; r<cueList.cartRows; r++){ %>
|
||||
<% for(let c=0; c<cueList.cartColumns; c++){ %>
|
||||
<div class="cartCueWrapper" style="
|
||||
left: <%= width*c %>%;
|
||||
top: <%=height*r%>px;
|
||||
width: <%=width%>%;
|
||||
height: <%=height%>px;
|
||||
"><div class="cartCue cartBlank"></div></div>
|
||||
<% } %>
|
||||
<% } %>
|
||||
|
||||
|
||||
<% for(var c in cueList.cues){
|
||||
let cue = cueList.cues[c];
|
||||
|
||||
if(!cue.cartPosition){
|
||||
continue;
|
||||
}
|
||||
|
||||
let row = cue.cartPosition[0]-1;
|
||||
let col = cue.cartPosition[1]-1;
|
||||
|
||||
let colPos = width*col;
|
||||
let rowPos = height*row;
|
||||
|
||||
if(col>=cueList.cartColumns || row>=cueList.cartRows){
|
||||
continue;
|
||||
}
|
||||
%>
|
||||
|
||||
<div class="cartCueWrapper " style="
|
||||
left: <%=colPos%>%;
|
||||
top: <%=rowPos%>px;
|
||||
width: <%=width%>%;
|
||||
height: <%=height%>px;
|
||||
">
|
||||
|
||||
<div class="cartCueIcon">
|
||||
<% if(cue.broken){ %>
|
||||
<img src="plugins/qlab/img/status_broken_white.png" height="18px">
|
||||
<% }else if(cue.running){ %>
|
||||
<img src="plugins/qlab/img/pause_circled.png" height="24px">
|
||||
<% }else{ %>
|
||||
<img src="plugins/qlab/img/play_circled.png" height="24px">
|
||||
<% } %>
|
||||
</div>
|
||||
<div class="cartCue cartColor-<%= cue.colorName %>">
|
||||
<p><%= cue.number %> • <%= cue.displayName %></p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<% } %>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<% }else{ %>
|
||||
|
||||
<% cueListOffset = 0 %>
|
||||
<table cellspacing="0">
|
||||
<tr>
|
||||
<th width="1px" style="border-left: none; border-right: none;"></th>
|
||||
<th width="20px" style="border-left: none; border-right: none;"></th>
|
||||
<th width="20px" style="border-left: none;"></th>
|
||||
<th width="55px">Number</th>
|
||||
<th width="25px" style="padding: 0px"></th>
|
||||
<th width="25px" class="no-border">Q</th>
|
||||
<th width="25px" class="no-border"></th>
|
||||
<th width="25px" class="no-border"></th>
|
||||
<th width="25px" class="no-border"></th>
|
||||
<th width="25px" class="no-border"></th>
|
||||
<th width="25px" class="no-border"></th>
|
||||
<th width="25px" class="no-border"></th>
|
||||
<th width="25px" class="no-border"></th>
|
||||
<th width="25px" class="no-border"></th>
|
||||
<th class="no-border"></th>
|
||||
<th width="55px" class="hide-medium">Target</th>
|
||||
<th width="80px" class="hide-small"style="border-right: none;">Pre Wait</th>
|
||||
<th width="80px" class="hide-medium" style="border-left: none; border-right: none;">Action</th>
|
||||
<th width="80px" class="hide-medium" style="border-left: none; border-right: none;">Post Wait</th>
|
||||
<th width="20px" class="hide-small" style="border-left: none; border-right: none;">
|
||||
<img src="plugins/qlab/img/auto_continue_stubby.png" height="20px">
|
||||
</th>
|
||||
</tr>
|
||||
<% cueTemplate(cueList, [], [], data.workspaces[i]); %>
|
||||
</table>
|
||||
|
||||
<% } %>
|
||||
<% } %>
|
||||
|
||||
<% } %>
|
||||
|
||||
|
||||
<%
|
||||
function prettyFormatTime(seconds){
|
||||
var startIndex = 14;
|
||||
if(seconds>=3600){
|
||||
startIndex = 11;
|
||||
}
|
||||
var string = new Date(seconds * 1000).toISOString()
|
||||
return string.substring(startIndex, string.length-2)
|
||||
}
|
||||
for(const workspace_id in data.workspaces){
|
||||
const workspace = data.workspaces[workspace_id];
|
||||
|
||||
for(const cueList_id in workspace.cueLists){
|
||||
const ql = workspace.cueLists[cueList_id];
|
||||
%>
|
||||
|
||||
|
||||
|
||||
<% if(ql.type=="Cue List"){ %>
|
||||
|
||||
<%= listTemplate({cueList: ql, allCues: workspace.cues, rowTemplate: cueTemplate}) %>
|
||||
|
||||
<% }else if(ql.type=="Cart"){ %>
|
||||
|
||||
<%= cartTemplate({cueList: ql, allCues: workspace.cues, tileTemplate: tileTemplate}) %>
|
||||
|
||||
|
||||
<% } %>
|
||||
|
||||
|
||||
|
||||
<% }} %>
|
||||
|
||||
|
||||
|
||||
<script src="node_modules/lodash/core.min.js"></script>
|
||||
|
||||
<script>
|
||||
let cueTemplate = <%= cueTemplate.source %>;
|
||||
let tileTemplate = <%= tileTemplate.source %>;
|
||||
let cartTemplate = <%= cartTemplate.source %>;
|
||||
|
||||
function updateElement(type, data){
|
||||
|
||||
|
||||
if(type=="updateCueData"){
|
||||
$elem = document.getElementById(data.cue.uniqueID);
|
||||
|
||||
if($elem){
|
||||
|
||||
if(data.cue.type=="Cue List"){
|
||||
$elem.outerHTML = '<h3>'+data.workspace.displayName+' - '+data.cue.name+'</h3>';
|
||||
|
||||
}else if(data.cue.type=="Cart"){
|
||||
|
||||
$elem.outerHTML = cartTemplate({cueList: data.cue, allCues: data.workspace.cues});
|
||||
|
||||
}else if(data.cue.cartPosition[0]!=0){
|
||||
$elem.outerHTML = tileTemplate(data);
|
||||
|
||||
}else{
|
||||
$elem.outerHTML = cueTemplate(data);
|
||||
}
|
||||
}
|
||||
|
||||
}else if(type=="updatePlaybackPosition"){
|
||||
|
||||
Array.from(document.getElementsByClassName("playback-position")).forEach(
|
||||
function($elem, index, array) {
|
||||
$elem.classList.remove("playback-position");
|
||||
});
|
||||
|
||||
document.getElementById(data.cue.uniqueID).classList.add("playback-position");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%>
|
||||
+207
-128
@@ -1,3 +1,5 @@
|
||||
let _ = require('lodash');
|
||||
|
||||
exports.defaultName = 'QLab 4';
|
||||
exports.connectionType = 'osc';
|
||||
exports.searchOptions = {
|
||||
@@ -9,153 +11,230 @@ exports.ready = function (device) {
|
||||
device.send('/workspaces');
|
||||
};
|
||||
|
||||
exports.data = function (device, osc) {
|
||||
const address = osc.address;
|
||||
const p = osc.address.split('/');
|
||||
p.shift();
|
||||
exports.data = function (device, oscData) {
|
||||
const address = oscData.address;
|
||||
let osc = oscData.address.split('/');
|
||||
osc.shift();
|
||||
|
||||
let data;
|
||||
|
||||
|
||||
//console.log(address)
|
||||
|
||||
if (osc.address == '/reply/workspaces') {
|
||||
const d = JSON.parse(osc.args[0]).data;
|
||||
device.data.workspaces = {};
|
||||
for (let i = 0; i < d.length; i++) {
|
||||
device.data.workspaces[d[i].uniqueID] = {
|
||||
displayName: d[i].displayName,
|
||||
selectionIsPlayhead: true,
|
||||
};
|
||||
device.data.version = d[i].version;
|
||||
device.send(`/workspace/${d[i].uniqueID}/cueLists`);
|
||||
device.send(`/workspace/${d[i].uniqueID}/updates`, [
|
||||
{ type: 'i', value: 1 },
|
||||
]);
|
||||
device.send(`/cue/playbackPosition/uniqueID`);
|
||||
device.send(`/workspace/${d[i].uniqueID}/selectionIsPlayhead`);
|
||||
}
|
||||
} else if (p[1] == 'workspace' && p[3] == 'cueLists') {
|
||||
const workspace = p[2];
|
||||
const d = JSON.parse(osc.args[0]).data;
|
||||
device.data.workspaces[workspace].cueLists = {};
|
||||
device.data.workspaces[workspace].allCues = {};
|
||||
device.data.workspaces[workspace].allCuesOrdered = [];
|
||||
device.data.lastCueInGroup = {};
|
||||
if(match(osc, ["reply", "version"])){ // heartbeat response
|
||||
|
||||
for (let i in d) {
|
||||
device.data.workspaces[workspace].cueLists[d[i].uniqueID] = d[i];
|
||||
device.data.workspaces[workspace].cueLists[d[i].uniqueID].cues =
|
||||
d[i].cues;
|
||||
this.deviceInfoUpdate(device, 'status', 'ok');
|
||||
|
||||
device.data.workspaces[workspace].allCues[d[i].uniqueID] = d[i];
|
||||
|
||||
if(d[i].type=="Cart"){
|
||||
device.send(`/cue_id/${d[i].uniqueID}/cartColumns`);
|
||||
device.send(`/cue_id/${d[i].uniqueID}/cartRows`);
|
||||
|
||||
}else if(match(osc, ["reply", "workspaces"])){
|
||||
|
||||
let json = JSON.parse(oscData.args[0]);
|
||||
json.data.forEach(wksp => {
|
||||
device.data.workspaces = {};
|
||||
|
||||
device.data.workspaces[wksp.uniqueID] = {
|
||||
uniqueID: wksp.uniqueID,
|
||||
displayName: wksp.displayName,
|
||||
cueLists: {},
|
||||
cues: {}
|
||||
}
|
||||
|
||||
function getMoreCueInfo(group, groups_arg) {
|
||||
const groups = JSON.parse(JSON.stringify(groups_arg));
|
||||
groups.push(group.uniqueID);
|
||||
device.send(`/workspace/${wksp.uniqueID}/connect`);
|
||||
|
||||
for (let cueIndex in group.cues) {
|
||||
const cue = group.cues[cueIndex];
|
||||
//console.log(cue)
|
||||
|
||||
device.data.lastCueInGroup[group.uniqueID] = cue;
|
||||
|
||||
cue.groups = groups;
|
||||
device.send(
|
||||
`/workspace/${workspace}/cue_id/${cue.uniqueID}/valuesForKeys`,
|
||||
[
|
||||
{
|
||||
type: 's',
|
||||
value:
|
||||
'["mode", "parent", "isBroken", "preWait", "duration", "postWait", "continueMode", "cueTargetNumber", "isLoaded", "isRunning", "cartPosition", "displayName"]',
|
||||
},
|
||||
]
|
||||
);
|
||||
cue.index =
|
||||
device.data.workspaces[workspace].allCuesOrdered.push(cue) - 1;
|
||||
|
||||
if (cue.cues) {
|
||||
cue.mode = 0;
|
||||
getMoreCueInfo(cue, groups);
|
||||
}
|
||||
|
||||
device.data.workspaces[workspace].allCues[cue.uniqueID] = cue;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
getMoreCueInfo(d[i], []);
|
||||
});
|
||||
|
||||
|
||||
}else if(match(osc, ["reply", "workspace", "*", "connect"])){
|
||||
|
||||
device.send(`/workspace/${osc[2]}/updates`, [
|
||||
{ type: 'i', value: 1 },
|
||||
]);
|
||||
|
||||
device.send(`/workspace/${osc[2]}/cueLists`);
|
||||
|
||||
|
||||
|
||||
}else if(match(osc, ["reply", "workspace", "*", "cueLists"])){
|
||||
|
||||
this.deviceInfoUpdate(device, 'status', 'ok');
|
||||
|
||||
let workspace = device.data.workspaces[osc[2]];
|
||||
let json = JSON.parse(oscData.args[0]);
|
||||
|
||||
workspace.cueLists = {};
|
||||
workspace.cues = {};
|
||||
|
||||
|
||||
json.data.forEach(ql => {
|
||||
workspace.cueLists[ql.uniqueID] = ql;
|
||||
addChildrenToWorkspace(workspace, ql);
|
||||
});
|
||||
|
||||
device.draw();
|
||||
|
||||
setTimeout(function(){
|
||||
json.data.forEach(ql => {
|
||||
workspace.cueLists[ql.uniqueID] = ql;
|
||||
getValuesForKeys(device, json.workspace_id, ql);
|
||||
});
|
||||
}, 0);
|
||||
|
||||
|
||||
|
||||
}else if(match(osc, ["reply", "cue_id", "*", "children"])){
|
||||
|
||||
let json = JSON.parse(oscData.args[0]);
|
||||
let workspace = device.data.workspaces[json.workspace_id];
|
||||
let cue_id = osc[2];
|
||||
|
||||
workspace.cueLists[cue_id].cues = json.data;
|
||||
addChildrenToWorkspace(workspace, workspace.cueLists[cue_id]);
|
||||
|
||||
device.draw();
|
||||
|
||||
getValuesForKeys(device, json.workspace_id, workspace.cues[cue_id]);
|
||||
|
||||
|
||||
|
||||
}else if(match(osc, ["reply", "cue_id", "*", "valuesForKeys"])){
|
||||
|
||||
let json = JSON.parse(oscData.args[0]);
|
||||
let cueValues = json.data;
|
||||
|
||||
let workspace = device.data.workspaces[json.workspace_id];
|
||||
let cue = workspace.cues[cueValues.uniqueID];
|
||||
|
||||
if(!cue){
|
||||
cue = workspace.cues[cueValues.uniqueID] = {};
|
||||
}
|
||||
|
||||
// console.log(device.data.lastCueInGroup)
|
||||
cue.uniqueID = cueValues.uniqueID;
|
||||
cue.number = cueValues.number;
|
||||
cue.name = cueValues.name;
|
||||
cue.listName = cueValues.listName;
|
||||
cue.displayName = cueValues.displayName;
|
||||
cue.broken = cueValues.isBroken;
|
||||
cue.running = cueValues.isRunning;
|
||||
cue.loaded = cueValues.isLoaded;
|
||||
cue.flagged = cueValues.isFlagged;
|
||||
cue.type = cueValues.type;
|
||||
cue.cues = cueValues.children;
|
||||
cue.preWait = cueValues.preWait;
|
||||
cue.postWait = cueValues.postWait;
|
||||
cue.duration = cueValues.currentDuration;
|
||||
cue.colorName = cueValues.colorName;
|
||||
cue.continueMode = cueValues.continueMode;
|
||||
cue.groupMode = cueValues.mode;
|
||||
cue.parent = cueValues.parent;
|
||||
cue.cartRows = cueValues.cartRows;
|
||||
cue.cartColumns = cueValues.cartColumns;
|
||||
cue.cartPosition = cueValues.cartPosition;
|
||||
|
||||
device.draw();
|
||||
} else if (p[0] == 'update' && p[1] == 'workspace' && p[3] == 'cue_id') {
|
||||
device.send(`/workspace/${p[2]}/cueLists`);
|
||||
} else if (
|
||||
p[0] == 'update' &&
|
||||
p[1] == 'workspace' &&
|
||||
p[5] == 'playbackPosition'
|
||||
) {
|
||||
//console.log('pb move');
|
||||
device.data.playbackPosition = osc.args[0];
|
||||
device.draw();
|
||||
} else if (p[0] == 'reply' && p[1] == 'cue_id') {
|
||||
let nestedGroupModes = [];
|
||||
let nestedGroupPosition = [0];
|
||||
var obj = cue;
|
||||
|
||||
const d = JSON.parse(osc.args[0]);
|
||||
const cueID = p[2];
|
||||
const workspace = d.workspace_id;
|
||||
const cueList = d.data.parent;
|
||||
while(obj.parent!="[root group of cue lists]"){
|
||||
nestedGroupModes.push(obj.groupMode);
|
||||
|
||||
if (p[3] == 'uniqueID') {
|
||||
// response to /cue/playbackPosition/uniqueID
|
||||
device.data.playbackPosition = d.data;
|
||||
let pos = _.findIndex(workspace.cues[obj.parent].cues, {uniqueID: obj.uniqueID});
|
||||
pos= Math.abs(pos-workspace.cues[obj.parent].cues.length)-1;
|
||||
nestedGroupPosition.push(pos)
|
||||
|
||||
} else if (p[3] == 'mode') {
|
||||
device.data.workspaces[workspace].allCues[cueID].mode = d.data;
|
||||
|
||||
} else if (p[3] == 'valuesForKeys') {
|
||||
this.deviceInfoUpdate(device, 'status', 'ok');
|
||||
|
||||
device.data.workspaces[workspace].allCues[cueID].mode = d.data.mode;
|
||||
device.data.workspaces[workspace].allCues[cueID].preWait = d.data.preWait;
|
||||
device.data.workspaces[workspace].allCues[cueID].duration =
|
||||
d.data.duration;
|
||||
device.data.workspaces[workspace].allCues[cueID].postWait =
|
||||
d.data.postWait;
|
||||
device.data.workspaces[workspace].allCues[cueID].continueMode =
|
||||
d.data.continueMode;
|
||||
device.data.workspaces[workspace].allCues[cueID].target =
|
||||
d.data.cueTargetNumber;
|
||||
device.data.workspaces[workspace].allCues[cueID].loaded = d.data.isLoaded;
|
||||
device.data.workspaces[workspace].allCues[cueID].broken = d.data.isBroken;
|
||||
device.data.workspaces[workspace].allCues[cueID].running =
|
||||
d.data.isRunning;
|
||||
device.data.workspaces[workspace].allCues[cueID].cartPosition =
|
||||
d.data.cartPosition;
|
||||
device.data.workspaces[workspace].allCues[cueID].displayName =
|
||||
d.data.displayName;
|
||||
}else if(p[3] == 'cartColumns'){
|
||||
device.data.workspaces[workspace].allCues[cueID].cartColumns = d.data;
|
||||
}else if(p[3] == 'cartRows'){
|
||||
device.data.workspaces[workspace].allCues[cueID].cartRows = d.data;
|
||||
obj = workspace.cues[obj.parent];
|
||||
}
|
||||
device.draw();
|
||||
} else if (p[1] == 'workspace' && p[3] == 'selectionIsPlayhead') {
|
||||
device.data.workspaces[p[2]].selectionIsPlayhead = JSON.parse(
|
||||
osc.args[0]
|
||||
).data;
|
||||
} else {
|
||||
cue.nestedGroupModes = nestedGroupModes;
|
||||
cue.nestedGroupPosition = nestedGroupPosition;
|
||||
|
||||
device.update("updateCueData", {cue: cue, allCues: workspace.cues, workspace: workspace});
|
||||
|
||||
|
||||
|
||||
}else if(match(osc, ["update", "workspace", "*", "cue_id", "*"])){
|
||||
|
||||
let workspace = device.data.workspaces[osc[2]];
|
||||
let cueLists = Object.keys(workspace.cueLists);
|
||||
let cue_id = osc[4];
|
||||
|
||||
if(cueLists.includes(cue_id)){
|
||||
device.send(`/workspace/${workspace.uniqueID}/cue_id/${cue_id}/children`);
|
||||
}
|
||||
|
||||
device.send(`/workspace/${osc[2]}/cue_id/${cue_id}/valuesForKeys`, [
|
||||
{type: 's', value: valuesForKeysString}
|
||||
]);
|
||||
|
||||
|
||||
}else if(match(osc, ["update", "workspace", "*"])){
|
||||
// nothing here yet
|
||||
// occurs when cue lists are reordered or a list is deleted
|
||||
device.send(`/workspace/${osc[2]}/cueLists`);
|
||||
|
||||
|
||||
}else if(match(osc, ["update", "workspace", "*", "dashboard"])){
|
||||
// nothing here yet
|
||||
|
||||
|
||||
}else if(match(osc, ["update", "workspace", "*", "cueList", "*", "playbackPosition"])){
|
||||
|
||||
let workspace = device.data.workspaces[osc[2]];
|
||||
let cue = workspace.cues[oscData.args[0]];
|
||||
|
||||
if(cue) device.update("updatePlaybackPosition", {cue: cue});
|
||||
|
||||
}else{
|
||||
console.log(address)
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
const valuesForKeysString =
|
||||
'["uniqueID","number","name","listName","isBroken","isRunning","isLoaded","isFlagged",'
|
||||
+'"type","children","preWait","postWait","currentDuration","colorName","continueMode",'
|
||||
+'"mode","parent","cartRows","cartColumns","cartPosition","displayName"]';
|
||||
|
||||
function addChildrenToWorkspace(workspace, q){
|
||||
workspace.cues[q.uniqueID] = q;
|
||||
workspace.cues[q.uniqueID].nestedGroupModes = [];
|
||||
workspace.cues[q.uniqueID].nestedGroupPosition = [];
|
||||
|
||||
if(q.cues){
|
||||
q.cues.forEach(q => {
|
||||
addChildrenToWorkspace(workspace, q);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getValuesForKeys(device, workspace_id, q){
|
||||
device.send(`/workspace/${workspace_id}/cue_id/${q.uniqueID}/valuesForKeys`, [
|
||||
{type: 's', value: valuesForKeysString}
|
||||
]);
|
||||
if(q.cues){
|
||||
q.cues.forEach(q => {
|
||||
getValuesForKeys(device, workspace_id, q);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function match(osc, array){
|
||||
let out = true;
|
||||
if(osc.length!=array.length){
|
||||
return false;
|
||||
}
|
||||
array.forEach((match, i)=> {
|
||||
if(osc[i]!=match && match!="*"){
|
||||
out = false;
|
||||
}
|
||||
});
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
exports.heartbeat = function (device) {
|
||||
try {
|
||||
device.send(`/workspace/${Object.keys(device.data.workspaces)[0]}/thump`);
|
||||
} catch (err) {}
|
||||
};
|
||||
device.send(`/version`);
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
<%
|
||||
|
||||
let height = 0;
|
||||
let width = 0;
|
||||
let left = 0;
|
||||
let top = 0;
|
||||
|
||||
|
||||
if(cue.parent){
|
||||
width = 100/allCues[cue.parent].cartColumns;
|
||||
height = 600/allCues[cue.parent].cartRows;
|
||||
|
||||
top = (cue.cartPosition[0]-1)*height;
|
||||
left = (cue.cartPosition[1]-1)*width;
|
||||
}
|
||||
|
||||
%>
|
||||
|
||||
<div id="<%= cue.uniqueID %>" class="cartCueWrapper " style="
|
||||
left: <%= left %>%;
|
||||
top: <%= top %>px;
|
||||
width: <%= width %>%;
|
||||
height: <%= height %>px;
|
||||
">
|
||||
|
||||
<div class="cartCueIcon">
|
||||
<% if(cue.broken){ %>
|
||||
<img src="plugins/qlab/img/status_broken_white.png" height="18px">
|
||||
<% }else if(cue.running){ %>
|
||||
<img src="plugins/qlab/img/pause_circled.png" height="24px">
|
||||
<% }else{ %>
|
||||
<img src="plugins/qlab/img/play_circled.png" height="24px">
|
||||
<% } %>
|
||||
</div>
|
||||
<div class="cartCue cartColor-<%= cue.colorName %>">
|
||||
<p><%= cue.number %> • <%= cue.displayName %></p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user