mirror of
https://github.com/stagehacks/Cue-View.git
synced 2026-08-10 08:13:38 +00:00
cf1874a29b
commit38962ff052Merge:d6cc11f57324c8Author: sparks-alec <sparks.alec@gmail.com> Date: Sun Jun 11 20:54:13 2023 -0400 Merge pull request #108 from stagehacks/qlab-refactor Qlab refactor commit57324c82e9Author: sparks-alec <sparks.alec@gmail.com> Date: Sun Jun 11 15:31:34 2023 -0400 add .draw() to make sure troubleshooting info is displayed commitbf06ec7f3aAuthor: sparks-alec <sparks.alec@gmail.com> Date: Sun Jun 11 15:20:32 2023 -0400 remove debugging mark commit382dc8a0feAuthor: sparks-alec <sparks.alec@gmail.com> Date: Sun Jun 11 15:18:55 2023 -0400 make playhead a tad smaller commit0444d3976eAuthor: sparks-alec <sparks.alec@gmail.com> Date: Sun Jun 11 15:18:39 2023 -0400 improved cueList data structure magic commitc61b189634Author: Joel Wetzell <jwetzell@yahoo.com> Date: Tue May 30 17:38:44 2023 -0500 update /chidren endpoint for qlab 4 commit09ceb01963Author: sparks-alec <sparks.alec@gmail.com> Date: Mon May 29 16:27:46 2023 -0400 failing to remove a full /cueLists update ideally when an /update message is received for a Group cue, we should just get the new list of children cues and stick that into the data.workspaces tree in the right spot. commitaf1094d3cdAuthor: sparks-alec <sparks.alec@gmail.com> Date: Mon May 29 16:24:54 2023 -0400 remove full draws when Elapsed progress updates commitc0d8c58e90Merge:6d69bacaec2effAuthor: sparks-alec <sparks.alec@gmail.com> Date: Mon May 29 13:53:19 2023 -0400 Merge branch 'qlab-refactor' of https://github.com/stagehacks/Cue-View into qlab-refactor commit6d69bac639Author: sparks-alec <sparks.alec@gmail.com> Date: Mon May 29 13:53:17 2023 -0400 set version for all workspaces commitdbb7064385Author: sparks-alec <sparks.alec@gmail.com> Date: Mon May 29 13:52:58 2023 -0400 helpful text if no workspace is open commitaec2effee1Author: Joel Wetzell <jwetzell@yahoo.com> Date: Mon May 29 08:33:15 2023 -0500 update playback/display for QLab 4 compatibility commit454e794d4cAuthor: sparks-alec <sparks.alec@gmail.com> Date: Mon May 29 05:11:58 2023 -0400 add playhead information overlay commit55ede73f22Author: sparks-alec <sparks.alec@gmail.com> Date: Mon May 29 04:07:17 2023 -0400 remove bullet if tile doesn't have a cue number commit76d8f5e736Author: sparks-alec <sparks.alec@gmail.com> Date: Mon May 29 03:57:04 2023 -0400 tidy up commitbd9894c596Author: sparks-alec <sparks.alec@gmail.com> Date: Mon May 29 03:56:45 2023 -0400 prevent error when many cues are made in QLab commit77549aff56Author: sparks-alec <sparks.alec@gmail.com> Date: Mon May 29 03:38:25 2023 -0400 improve resiliency when passcode is incorrect commita237841a3aAuthor: sparks-alec <sparks.alec@gmail.com> Date: Mon May 29 01:14:44 2023 -0400 update cart styles for QLab 5 commit0364924f24Author: sparks-alec <sparks.alec@gmail.com> Date: Mon May 29 01:14:32 2023 -0400 add carts! commitd7508c1e22Author: sparks-alec <sparks.alec@gmail.com> Date: Mon May 29 01:13:43 2023 -0400 add source img commit4cf68d3a07Author: sparks-alec <sparks.alec@gmail.com> Date: Sun May 28 07:14:44 2023 -0400 bugfix error when no playbackPos commit03ad8f9682Author: sparks-alec <sparks.alec@gmail.com> Date: Sun May 28 07:06:57 2023 -0400 refactor QLab commitf273dab45dAuthor: sparks-alec <sparks.alec@gmail.com> Date: Sun May 28 07:06:18 2023 -0400 update styles for QLab 5 commitd6cc11f97dMerge:d5cec875503ac9Author: Joel Wetzell <jwetzell@yahoo.com> Date: Mon May 22 11:31:37 2023 -0500 Merge pull request #100 from stagehacks/dependabot/npm_and_yarn/eslint-8.41.0 Bump eslint from 8.40.0 to 8.41.0 commit5503ac9888Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon May 22 10:02:34 2023 +0000 Bump eslint from 8.40.0 to 8.41.0 Bumps [eslint](https://github.com/eslint/eslint) from 8.40.0 to 8.41.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.40.0...v8.41.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> commitd5cec8799aAuthor: Joel Wetzell <jwetzell@cait.org> Date: Wed May 10 16:30:05 2023 -0500 fix for mac notarization commit39d95bb87fMerge:dbadb6d3e9b433Author: Joel Wetzell <jwetzell@yahoo.com> Date: Wed May 10 15:21:55 2023 -0500 Merge pull request #97 from stagehacks/dependabot/npm_and_yarn/electron-builder-24.4.0 Bump electron-builder from 24.2.0 to 24.4.0 commit3e9b433056Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed May 10 20:13:01 2023 +0000 Bump electron-builder from 24.2.0 to 24.4.0 Bumps [electron-builder](https://github.com/electron-userland/electron-builder/tree/HEAD/packages/electron-builder) from 24.2.0 to 24.4.0. - [Release notes](https://github.com/electron-userland/electron-builder/releases) - [Changelog](https://github.com/electron-userland/electron-builder/blob/master/packages/electron-builder/CHANGELOG.md) - [Commits](https://github.com/electron-userland/electron-builder/commits/v24.4.0/packages/electron-builder) --- updated-dependencies: - dependency-name: electron-builder dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> commitdbadb6d1adMerge:de7c2675f2967aAuthor: Joel Wetzell <jwetzell@yahoo.com> Date: Wed May 10 15:11:26 2023 -0500 Merge pull request #96 from stagehacks/dependabot/npm_and_yarn/eslint-8.40.0 Bump eslint from 8.38.0 to 8.40.0 commitde7c2674bdMerge:b617369711eaafAuthor: Joel Wetzell <jwetzell@yahoo.com> Date: Wed May 10 15:09:36 2023 -0500 Merge pull request #92 from stagehacks/dependabot/npm_and_yarn/prettier-2.8.8 Bump prettier from 2.8.7 to 2.8.8 commit5f2967afaeAuthor: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon May 8 10:03:22 2023 +0000 Bump eslint from 8.38.0 to 8.40.0 Bumps [eslint](https://github.com/eslint/eslint) from 8.38.0 to 8.40.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.38.0...v8.40.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> commit711eaaf69eAuthor: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Apr 24 10:03:33 2023 +0000 Bump prettier from 2.8.7 to 2.8.8 Bumps [prettier](https://github.com/prettier/prettier) from 2.8.7 to 2.8.8. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.8.7...2.8.8) --- updated-dependencies: - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> commitb6173695ceMerge:41384cba91c67aAuthor: Joel Wetzell <jwetzell@yahoo.com> Date: Mon Apr 10 11:19:13 2023 -0500 Merge pull request #88 from stagehacks/dependabot/npm_and_yarn/minimatch-and-electron-builder-3.1.2 Bump minimatch and electron-builder commita91c67a323Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Apr 10 16:10:51 2023 +0000 Bump minimatch and electron-builder Bumps [minimatch](https://github.com/isaacs/minimatch) to 3.1.2 and updates ancestor dependency [electron-builder](https://github.com/electron-userland/electron-builder/tree/HEAD/packages/electron-builder). These dependencies need to be updated together. Updates `minimatch` from 3.0.4 to 3.1.2 - [Release notes](https://github.com/isaacs/minimatch/releases) - [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md) - [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2) Updates `electron-builder` from 23.6.0 to 24.2.0 - [Release notes](https://github.com/electron-userland/electron-builder/releases) - [Changelog](https://github.com/electron-userland/electron-builder/blob/master/packages/electron-builder/CHANGELOG.md) - [Commits](https://github.com/electron-userland/electron-builder/commits/v24.2.0/packages/electron-builder) --- updated-dependencies: - dependency-name: minimatch dependency-type: indirect - dependency-name: electron-builder dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com> commit41384cb66cMerge:7769ad97dc37a7Author: Joel Wetzell <jwetzell@yahoo.com> Date: Mon Apr 10 11:10:05 2023 -0500 Merge pull request #87 from stagehacks/dependabot/npm_and_yarn/eslint-8.38.0 Bump eslint from 8.37.0 to 8.38.0 commit7dc37a7fcbAuthor: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Apr 10 10:03:19 2023 +0000 Bump eslint from 8.37.0 to 8.38.0 Bumps [eslint](https://github.com/eslint/eslint) from 8.37.0 to 8.38.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.37.0...v8.38.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> commit7769ad9059Merge:159da19a8d8092Author: Joel Wetzell <jwetzell@yahoo.com> Date: Tue Apr 4 11:46:35 2023 -0500 Merge pull request #85 from stagehacks/dependabot/npm_and_yarn/eslint-8.37.0 Bump eslint from 8.36.0 to 8.37.0 commit159da195d3Merge:90e06ca88ad920Author: Joel Wetzell <jwetzell@yahoo.com> Date: Tue Apr 4 10:51:36 2023 -0500 Merge pull request #78 from stagehacks/plugin-atem This has passed tests and has been cleaned up, send it! commita8d8092e65Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Apr 3 10:04:27 2023 +0000 Bump eslint from 8.36.0 to 8.37.0 Bumps [eslint](https://github.com/eslint/eslint) from 8.36.0 to 8.37.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.36.0...v8.37.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> commit88ad9207e2Merge:bd2b19037a3fdeAuthor: Joel Wetzell <jwetzell@yahoo.com> Date: Wed Mar 29 06:55:00 2023 -0500 Merge branch 'plugin-atem' of github.com:stagehacks/Cue-View into plugin-atem commitbd2b190facMerge:50d836390e06caAuthor: Joel Wetzell <jwetzell@cait.org> Date: Tue Mar 28 13:50:13 2023 -0500 Merge branch 'main' into plugin-atem commit50d8363a4aAuthor: Joel Wetzell <jwetzell@cait.org> Date: Tue Mar 28 13:41:04 2023 -0500 regenerate package-lock using node v18.13.0 commit90e06cab99Merge:98a0c9c3b24dcbAuthor: Joel Wetzell <jwetzell@yahoo.com> Date: Tue Mar 28 07:18:53 2023 -0500 Merge pull request #79 from stagehacks/dependabot/npm_and_yarn/osc-2.4.4 Bump osc from 2.4.3 to 2.4.4 commit98a0c9c31bMerge:5c28a0cf5e8e72Author: Joel Wetzell <jwetzell@yahoo.com> Date: Tue Mar 28 07:18:41 2023 -0500 Merge pull request #81 from stagehacks/dependabot/npm_and_yarn/eslint-config-prettier-8.8.0 Bump eslint-config-prettier from 8.7.0 to 8.8.0 commit5c28a0c6b3Merge:b314735095d7fbAuthor: Joel Wetzell <jwetzell@yahoo.com> Date: Tue Mar 28 07:18:31 2023 -0500 Merge pull request #83 from stagehacks/dependabot/npm_and_yarn/prettier-2.8.7 Bump prettier from 2.8.4 to 2.8.7 commit095d7fb89fAuthor: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Mar 27 10:05:23 2023 +0000 Bump prettier from 2.8.4 to 2.8.7 Bumps [prettier](https://github.com/prettier/prettier) from 2.8.4 to 2.8.7. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.8.4...2.8.7) --- updated-dependencies: - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> commitf5e8e729e8Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Mar 27 10:04:15 2023 +0000 Bump eslint-config-prettier from 8.7.0 to 8.8.0 Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 8.7.0 to 8.8.0. - [Release notes](https://github.com/prettier/eslint-config-prettier/releases) - [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/eslint-config-prettier/compare/v8.7.0...v8.8.0) --- updated-dependencies: - dependency-name: eslint-config-prettier dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> commit3b24dcb063Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Mar 20 10:08:41 2023 +0000 Bump osc from 2.4.3 to 2.4.4 Bumps [osc](https://github.com/colinbdclark/osc.js) from 2.4.3 to 2.4.4. - [Release notes](https://github.com/colinbdclark/osc.js/releases) - [Commits](https://github.com/colinbdclark/osc.js/compare/2.4.3...2.4.4) --- updated-dependencies: - dependency-name: osc dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
388 lines
13 KiB
JavaScript
388 lines
13 KiB
JavaScript
const _ = require('lodash');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
exports.config = {
|
|
defaultName: 'QLab',
|
|
connectionType: 'osc',
|
|
defaultPort: 53000,
|
|
mayChangePort: true,
|
|
heartbeatInterval: 100,
|
|
heartbeatTimeout: 5000,
|
|
searchOptions: {
|
|
type: 'Bonjour',
|
|
bonjourName: 'qlab',
|
|
},
|
|
fields: [
|
|
{
|
|
key: 'passcode',
|
|
label: 'Pass',
|
|
type: 'textinput',
|
|
value: '',
|
|
action(device) {
|
|
device.send('/workspaces');
|
|
},
|
|
},
|
|
],
|
|
};
|
|
|
|
const valuesForKeysString =
|
|
'["uniqueID","number","name","listName","isBroken","isRunning","isLoaded","isFlagged",' +
|
|
'"type","children","preWait","postWait","duration","colorName","continueMode",' +
|
|
'"mode","parent","cartRows","cartColumns","cartPosition","displayName","preWaitElapsed",' +
|
|
'"actionElapsed","postWaitElapsed","isPaused","currentCueTarget","isRunning","armed","notes"]';
|
|
|
|
exports.ready = function ready(_device) {
|
|
const device = _device;
|
|
device.send(`/version`);
|
|
device.send('/workspaces');
|
|
device.data.workspaces = {};
|
|
device.data.cueKeys = {};
|
|
device.data.version = '';
|
|
device.data.lastElapsedMessage = 0;
|
|
device.data.ticks = 0;
|
|
|
|
device.templates = {
|
|
cue: _.template(fs.readFileSync(path.join(__dirname, `cue.ejs`))),
|
|
tile: _.template(fs.readFileSync(path.join(__dirname, `tile.ejs`))),
|
|
cart: _.template(fs.readFileSync(path.join(__dirname, `cart.ejs`))),
|
|
cuelist: _.template(fs.readFileSync(path.join(__dirname, `cuelist.ejs`))),
|
|
};
|
|
};
|
|
|
|
exports.data = function data(_device, oscData) {
|
|
const device = _device;
|
|
|
|
const msgAddr = oscData.address.split('/');
|
|
msgAddr.shift();
|
|
|
|
let json = [];
|
|
try {
|
|
json = JSON.parse(oscData.args[0]);
|
|
} catch (err) {
|
|
// a handful of messages don't respond with JSON
|
|
}
|
|
|
|
if (Object.keys(json).length > 0) {
|
|
if (json.status === 'denied') {
|
|
if (device.data.workspaces[json.workspace_id]) {
|
|
device.data.workspaces[json.workspace_id].permission = 'denied';
|
|
}
|
|
return;
|
|
}
|
|
if (json.status === 'error') {
|
|
device.send('/workspaces');
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (oscData.address === '/reply/workspaces') {
|
|
for (let i = 0; i < json.data.length; i++) {
|
|
device.data.workspaces[json.data[i].uniqueID] = {
|
|
version: json.data[i].version,
|
|
displayName: json.data[i].displayName,
|
|
port: json.data[i].port,
|
|
udpReplyPort: json.data[i].udpReplyPort,
|
|
cueLists: [],
|
|
selected: [],
|
|
};
|
|
device.data.version = json.data[i].version;
|
|
device.data.workspaces[json.data[i].uniqueID].permission = 'ok';
|
|
device.send(`/workspace/${json.data[i].uniqueID}/connect`, device.fields.passcode);
|
|
}
|
|
|
|
this.deviceInfoUpdate(device, 'status', 'ok');
|
|
device.draw();
|
|
} else if (/reply\/workspace\/.*\/connect/.test(oscData.address)) {
|
|
if (json.data === 'badpass') {
|
|
device.data.workspaces[json.workspace_id].permission = 'badpass';
|
|
} else {
|
|
device.data.workspaces[json.workspace_id].permission = 'ok';
|
|
device.send(`/workspace/${msgAddr[2]}/cueLists`);
|
|
device.send(`/workspace/${msgAddr[2]}/updates`, [{ type: 'i', value: 1 }]);
|
|
}
|
|
} else if (/reply\/workspace\/.*\/cueLists/.test(oscData.address)) {
|
|
insertChildCues(device, device.data.workspaces[msgAddr[2]].cueLists, json.data, '[root group of cue lists]');
|
|
} else if (/reply\/cue_id\/.*\/valuesForKeys/.test(oscData.address)) {
|
|
const keyValues = json.data;
|
|
let cue = device.data.cueKeys[msgAddr[2]];
|
|
|
|
if (cue === undefined) {
|
|
device.data.cueKeys[msgAddr[2]] = {};
|
|
cue = device.data.cueKeys[msgAddr[2]];
|
|
}
|
|
cue.uniqueID = keyValues.uniqueID;
|
|
cue.number = keyValues.number;
|
|
cue.listName = keyValues.listName;
|
|
cue.isBroken = keyValues.isBroken;
|
|
cue.isRunning = keyValues.isRunning;
|
|
cue.isLoaded = keyValues.isLoaded;
|
|
cue.isFlagged = keyValues.isFlagged;
|
|
cue.type = keyValues.type;
|
|
cue.cues = keyValues.children;
|
|
cue.preWait = keyValues.preWait;
|
|
cue.postWait = keyValues.postWait;
|
|
cue.duration = keyValues.duration;
|
|
cue.colorName = keyValues.colorName;
|
|
cue.continueMode = keyValues.continueMode;
|
|
cue.mode = keyValues.mode;
|
|
cue.parent = keyValues.parent;
|
|
cue.cartRows = keyValues.cartRows;
|
|
cue.cartColumns = keyValues.cartColumns;
|
|
cue.cartPosition = keyValues.cartPosition;
|
|
cue.displayName = keyValues.displayName;
|
|
cue.preWaitElapsed = keyValues.preWaitElapsed;
|
|
cue.actionElapsed = keyValues.actionElapsed;
|
|
cue.postWaitElapsed = keyValues.postWaitElapsed;
|
|
cue.isPaused = keyValues.isPaused;
|
|
cue.currentCueTarget = keyValues.currentCueTarget;
|
|
cue.armed = keyValues.armed;
|
|
cue.notes = keyValues.notes;
|
|
|
|
if (keyValues.isRunning) {
|
|
device.data.lastElapsedMessage = device.data.ticks;
|
|
}
|
|
|
|
if (cue.parent !== '[root group of cue lists]') {
|
|
cue.parent = device.data.cueKeys[cue.parent];
|
|
}
|
|
|
|
if (cue.type === 'Cue List' || cue.type === 'Group' || cue.type === 'Cart') {
|
|
if (device.data.cueKeys[msgAddr[2]].cueInWorkspace && cue.cues) {
|
|
insertChildCues(
|
|
device,
|
|
device.data.cueKeys[msgAddr[2]].cueInWorkspace.cues,
|
|
[...keyValues.children],
|
|
device.data.cueKeys[msgAddr[2]].cueInWorkspace
|
|
);
|
|
}
|
|
device.draw();
|
|
}
|
|
|
|
if (cue.type !== 'Cue List' && cue.type !== 'Cart') {
|
|
device.update('updateCueRow', { cue, workspace: device.data.workspaces[json.workspace_id] });
|
|
}
|
|
} else if (/reply\/cue_id\/(.*)\/(.*)Elapsed/.test(oscData.address)) {
|
|
const workspace = device.data.workspaces[json.workspace_id];
|
|
let cueID;
|
|
let keyName;
|
|
device.data.lastElapsedMessage = device.data.ticks;
|
|
|
|
if (workspace?.version.startsWith('5.')) {
|
|
const addrParts = json.address.split('/');
|
|
cueID = addrParts[4];
|
|
keyName = addrParts[5];
|
|
} else {
|
|
const addrParts = json.address.split('/');
|
|
cueID = addrParts[2];
|
|
keyName = addrParts[3];
|
|
}
|
|
|
|
device.data.cueKeys[cueID][keyName] = json.data;
|
|
|
|
device.update('updateCueRow', { cue: device.data.cueKeys[cueID], workspace });
|
|
} else if (/reply\/workspace\/.*\/selectedCues/.test(oscData.address)) {
|
|
const workspace = device.data.workspaces[msgAddr[2]];
|
|
if (!workspace) {
|
|
return;
|
|
}
|
|
workspace.selected = [];
|
|
for (let i = 0; i < json.data.length; i++) {
|
|
workspace.selected.push(json.data[i].uniqueID);
|
|
}
|
|
device.update('updatePlaybackAndSelected', { workspace: device.data.workspaces[json.workspace_id] });
|
|
} else if (/update\/workspace\/.*\/cue_id\/.*/.test(oscData.address)) {
|
|
device.send(`/cue_id/${msgAddr[4]}/valuesForKeys`, [{ type: 's', value: valuesForKeysString }]);
|
|
} else if (/update\/workspace\/.*\/cueList\/.*\/playbackPosition/.test(oscData.address)) {
|
|
const workspace = device.data.workspaces[msgAddr[2]];
|
|
if (workspace) {
|
|
workspace.playbackPosition = oscData.args[0];
|
|
device.update('updatePlaybackAndSelected', { workspace: device.data.workspaces[msgAddr[2]] });
|
|
}
|
|
} else if (/update\/workspace\/.*\/dashboard/.test(oscData.address)) {
|
|
device.send(`/workspace/${msgAddr[2]}/selectedCues`);
|
|
device.send(`/cue_id/active/preWaitElapsed`);
|
|
}
|
|
};
|
|
|
|
exports.update = function update(device, _doc, updateType, data) {
|
|
const doc = _doc;
|
|
if (updateType === 'updateCueRow') {
|
|
const $elem = doc.getElementById(data.cue.uniqueID);
|
|
if ($elem) {
|
|
if (data.cue.parent.type === 'Cart') {
|
|
$elem.outerHTML = device.templates.tile({
|
|
allCues: device.data.cueKeys,
|
|
cue: data.cue,
|
|
workspace: data.workspace,
|
|
});
|
|
} else {
|
|
$elem.outerHTML = device.templates.cue({
|
|
allCues: device.data.cueKeys,
|
|
cue: data.cue,
|
|
workspace: data.workspace,
|
|
});
|
|
}
|
|
}
|
|
} else if (updateType === 'updatePlaybackAndSelected') {
|
|
Array.from(doc.querySelectorAll('.selected')).forEach(($el) => {
|
|
$el.classList.remove('selected');
|
|
});
|
|
Array.from(doc.querySelectorAll('.playback-position')).forEach(($el) => {
|
|
$el.classList.remove('playback-position');
|
|
});
|
|
|
|
for (let i = 0; i < data.workspace.selected.length; i++) {
|
|
const $elem = doc.getElementById(data.workspace.selected[i]);
|
|
if ($elem) {
|
|
$elem.classList.add('selected');
|
|
}
|
|
}
|
|
|
|
const $playheadInfo = doc.getElementById('playhead-information');
|
|
const $playheadName = doc.getElementById('playhead-name');
|
|
const $playheadNotes = doc.getElementById('playhead-notes');
|
|
|
|
if (data.workspace.playbackPosition) {
|
|
const $cueRow = doc.getElementById(data.workspace.playbackPosition);
|
|
if ($cueRow) {
|
|
$cueRow.classList.add('playback-position');
|
|
$cueRow.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
}
|
|
|
|
const cue = device.data.cueKeys[data.workspace.playbackPosition];
|
|
if (cue && $playheadName) {
|
|
$playheadName.setAttribute('class', `playhead-name cartColor-${cue.colorName} playhead-disarmed`);
|
|
$playheadInfo.classList.add('playhead-active');
|
|
if (cue.number) {
|
|
$playheadName.innerHTML = `${cue.number} • ${cue.displayName}`;
|
|
} else {
|
|
$playheadName.innerHTML = cue.displayName;
|
|
}
|
|
if (cue.notes) {
|
|
$playheadNotes.innerHTML = cue.notes;
|
|
} else {
|
|
$playheadNotes.innerHTML = '<span style="color:#5C5C5C">Notes</span>';
|
|
}
|
|
if (!cue.armed) {
|
|
$playheadName.classList.add('playhead-disarmed');
|
|
} else {
|
|
$playheadName.classList.remove('playhead-disarmed');
|
|
}
|
|
}
|
|
} else {
|
|
$playheadName.setAttribute('class', `playhead-name`);
|
|
$playheadName.innerHTML = '<span style="color:#747574">[no cue on standby]</span>';
|
|
$playheadNotes.innerHTML = '';
|
|
$playheadInfo.classList.remove('playhead-active');
|
|
}
|
|
}
|
|
};
|
|
|
|
exports.heartbeat = function heartbeat(_device) {
|
|
const device = _device;
|
|
device.data.ticks++;
|
|
if (device.data.ticks % 10 === 0) {
|
|
device.send(`/thump`);
|
|
}
|
|
if (device.data.ticks - device.data.lastElapsedMessage < 5) {
|
|
device.send(`/cue_id/active/preWaitElapsed`);
|
|
device.send(`/cue_id/active/postWaitElapsed`);
|
|
device.send(`/cue_id/active/actionElapsed`);
|
|
}
|
|
};
|
|
|
|
function insertChildCues(_device, _oldCues, newCues, _parent) {
|
|
const device = _device;
|
|
const newIDs = _.keyBy(newCues, 'uniqueID');
|
|
const oldCues = _oldCues;
|
|
const parent = _parent;
|
|
|
|
if (!oldCues) {
|
|
return;
|
|
}
|
|
|
|
for (let i = 0; i < oldCues.length; i++) {
|
|
const oldCue = oldCues[i];
|
|
|
|
if (!newIDs[oldCue.uniqueID]) {
|
|
oldCues.splice(i, 1);
|
|
i--;
|
|
}
|
|
|
|
const indexOfOldCueInNew = _.findIndex(newCues, (o) => o.uniqueID === oldCue.uniqueID);
|
|
|
|
if (indexOfOldCueInNew >= 0) {
|
|
const newCue = newCues[indexOfOldCueInNew];
|
|
oldCues[i].armed = newCue.armed;
|
|
oldCues[i].colorName = newCue.colorName;
|
|
oldCues[i].colorNameLive = newCue['colorName/live'];
|
|
|
|
oldCues[i].flagged = newCue.flagged;
|
|
oldCues[i].listName = newCue.listName;
|
|
oldCues[i].name = newCue.name;
|
|
oldCues[i].number = newCue.number;
|
|
oldCues[i].type = newCue.type;
|
|
oldCues[i].sortIndex = indexOfOldCueInNew;
|
|
oldCues[i].parent = parent;
|
|
|
|
newCue.used = true;
|
|
|
|
let keys = device.data.cueKeys[oldCues[i].uniqueID];
|
|
if (!keys) {
|
|
device.data.cueKeys[oldCues[i].uniqueID] = {};
|
|
keys = device.data.cueKeys[oldCues[i].uniqueID];
|
|
}
|
|
|
|
keys.cueInWorkspace = oldCues[i];
|
|
|
|
if (oldCues[i].type === 'Group' || oldCues[i].type === 'Cue List' || oldCues[i].type === 'Cart') {
|
|
insertChildCues(device, oldCues[i].cues, newCue.cues, oldCues[i]);
|
|
}
|
|
}
|
|
}
|
|
for (let i = 0; i < newCues.length; i++) {
|
|
const newCue = newCues[i];
|
|
if (newCue.used !== true) {
|
|
const newIndex = oldCues.push({
|
|
armed: newCue.armed,
|
|
colorName: newCue.colorName,
|
|
colorNameLive: newCue['colorName/live'],
|
|
flagged: newCue.flagged,
|
|
listName: newCue.listName,
|
|
name: newCue.name,
|
|
number: newCue.number,
|
|
type: newCue.type,
|
|
uniqueID: newCue.uniqueID,
|
|
sortIndex: i,
|
|
parent,
|
|
});
|
|
|
|
const freshCue = oldCues[newIndex - 1];
|
|
|
|
let keys = device.data.cueKeys[freshCue.uniqueID];
|
|
if (!keys) {
|
|
device.data.cueKeys[freshCue.uniqueID] = {};
|
|
keys = device.data.cueKeys[freshCue.uniqueID];
|
|
}
|
|
|
|
if (freshCue.parent === '[root group of cue lists]') {
|
|
keys.parentKeys = [];
|
|
} else {
|
|
keys.parentKeys = [...device.data.cueKeys[freshCue.parent.uniqueID].parentKeys];
|
|
keys.parentKeys.push(device.data.cueKeys[freshCue.parent.uniqueID]);
|
|
}
|
|
|
|
device.send(`/cue_id/${newCue.uniqueID}/valuesForKeys`, [{ type: 's', value: valuesForKeysString }]);
|
|
|
|
keys.cueInWorkspace = freshCue;
|
|
|
|
if (freshCue.type === 'Group' || freshCue.type === 'Cue List' || oldCues[i].type === 'Cart') {
|
|
freshCue.cues = [];
|
|
insertChildCues(device, freshCue.cues, newCue.cues, freshCue);
|
|
}
|
|
}
|
|
}
|
|
oldCues.sort((a, b) => a.sortIndex - b.sortIndex);
|
|
}
|