Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Ours
const nodecg = require('./util/nodecg-api-context').get();
let foregroundFileName = '';
let currentFrame = 0;
let durationFrames = 0;
let fileMayHaveRestarted = false;
let updateFilesInterval;
let ignoreForegroundUntilNextPlay = false;
const log = new nodecg.Logger(`${nodecg.bundleName}:caspar`);
const currentRun = nodecg.Replicant('currentRun');
const files = nodecg.Replicant('caspar:files', {persistent: false});
const connected = nodecg.Replicant('caspar:connected');
const connection = new CasparCG({
host: nodecg.bundleConfig.casparcg.host,
port: nodecg.bundleConfig.casparcg.port,
onConnected() {
connected.value = true;
log.info('Connected.');
clearInterval(updateFilesInterval);
updateFiles();
updateFilesInterval = setInterval(updateFiles, 60000);
if (nodecg.bundleConfig.casparcg.lockSecret) {
connection.lock(1, CasparEnum.Lock.ACQUIRE, nodecg.bundleConfig.casparcg.lockSecret).then(() => {
log.info('Lock acquired.');
}).catch(e => {
log.error('Failed to acquire lock:', e);
connected.value = false;
});
const CasparCG = require("casparcg-connection");
const debounce = require("lodash.debounce");
// Ours
const nodecgApiContext = require("./util/nodecg-api-context");
let foregroundFileName = '';
let currentFrame = 0;
let durationFrames = 0;
let fileMayHaveRestarted = false;
let updateFilesInterval;
let ignoreForegroundUntilNextPlay = false;
const nodecg = nodecgApiContext.get();
const log = new nodecg.Logger(`${nodecg.bundleName}:caspar`);
const currentRun = nodecg.Replicant('currentRun');
const files = nodecg.Replicant('caspar:files', { persistent: false });
const connected = nodecg.Replicant('caspar:connected');
const connection = new CasparCG.CasparCG({
host: nodecg.bundleConfig.casparcg.host,
port: nodecg.bundleConfig.casparcg.port,
onConnected() {
connected.value = true;
log.info('Connected.');
clearInterval(updateFilesInterval);
updateFiles();
updateFilesInterval = setInterval(updateFiles, 30000);
if (nodecg.bundleConfig.casparcg.lockSecret) {
connection.lock(1, CasparCG.Enum.Lock.ACQUIRE, nodecg.bundleConfig.casparcg.lockSecret).then(() => {
log.info('Lock acquired.');
}).catch(e => {
log.error('Failed to acquire lock:', e);
connected.value = false;
});
}
const debounce = require('lodash.debounce');
// Ours
const nodecg = require('./util/nodecg-api-context').get();
let foregroundFileName = '';
let currentFrame = 0;
let durationFrames = 0;
let fileMayHaveRestarted = false;
let updateFilesInterval;
const log = new nodecg.Logger(`${nodecg.bundleName}:caspar`);
const currentRun = nodecg.Replicant('currentRun');
const files = nodecg.Replicant('caspar:files', {persistent: false});
const connected = nodecg.Replicant('caspar:connected');
const connection = new CasparCG({
host: nodecg.bundleConfig.casparcg.host,
port: nodecg.bundleConfig.casparcg.port,
onConnected() {
connected.value = true;
log.info('Connected.');
clearInterval(updateFilesInterval);
updateFiles();
updateFilesInterval = setInterval(updateFiles, 60000);
connection.lock(1, CasparEnum.Lock.ACQUIRE, nodecg.bundleConfig.casparcg.lockSecret).then(() => {
log.info('Lock acquired.');
}).catch(e => {
log.error('Failed to acquire lock:', e);
connected.value = false;
});
},
// Ours
import * as nodecgApiContext from './util/nodecg-api-context';
let foregroundFileName = '';
let currentFrame = 0;
let durationFrames = 0;
let fileMayHaveRestarted = false;
let updateFilesInterval: NodeJS.Timer;
let ignoreForegroundUntilNextPlay = false;
const nodecg = nodecgApiContext.get();
const log = new nodecg.Logger(`${nodecg.bundleName}:caspar`);
const currentRun = nodecg.Replicant('currentRun');
const files = nodecg.Replicant('caspar:files', {persistent: false});
const connected = nodecg.Replicant('caspar:connected');
const connection = new CasparCG.CasparCG({
host: nodecg.bundleConfig.casparcg.host,
port: nodecg.bundleConfig.casparcg.port,
onConnected() {
connected.value = true;
log.info('Connected.');
clearInterval(updateFilesInterval);
updateFiles();
updateFilesInterval = setInterval(updateFiles, 30000);
if (nodecg.bundleConfig.casparcg.lockSecret) {
connection.lock(1, CasparCG.Enum.Lock.ACQUIRE, nodecg.bundleConfig.casparcg.lockSecret).then(() => {
log.info('Lock acquired.');
}).catch(e => {
log.error('Failed to acquire lock:', e);
connected.value = false;
});
constructor() {
//Binds:
this.connectLog = this.connectLog.bind(this);
this.startTimerControlledServices = this.startTimerControlledServices.bind(this);
//PubSub:
this.pubsub = new PubSub();
//Setup AMCP Connection:
this.ccgConnection = new CasparCG(
{
host: DEFAULTS.CCG_HOST,
port: DEFAULTS.CCG_AMCP_PORT,
autoConnect: true,
}
);
//Define vars:
this.configFile = readCasparCgConfigFile();
this.ccgNumberOfChannels = this.configFile.configuration.channels.channel.length || 1;
this.ccgChannel = generateCcgDataStructure(this.ccgNumberOfChannels);
//Setup folder watchers :
mediaFolderWatchSetup(this.configFile.configuration.paths['media-path']._text);
dataFolderWatchSetup(this.configFile.configuration.paths['data-path']._text);
templateFolderWatchSetup(this.configFile.configuration.paths['template-path']._text);