Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
validate: () => {
let device = PeripheralDevices.findOne({type: PeripheralDeviceAPI.DeviceType.PLAYOUT})
if (!device) return 'Playout-gateway not found'
let settings = device.settings || {devices: {}} as PlayoutDeviceSettings
let casparcg0 = settings.devices['casparcg0'] as PlayoutDeviceSettingsDeviceCasparCG
if (!casparcg0) return '"casparcg0" missing'
// @ts-ignore
if (!casparcg0.options) casparcg0.options = {}
if (casparcg0.type !== PlayoutDeviceType.CASPARCG) return 'Type is not "CASPARCG"'
if (!casparcg0.options.host) return 'Host is not set'
if (!casparcg0.options.launcherHost) return 'Launcher host is not set'
return false
},
migrate: () => {
migrate: () => {
let device = PeripheralDevices.findOne({type: PeripheralDeviceAPI.DeviceType.PLAYOUT})
if (device) {
// Set some default values:
let casparcg1 = device.settings && device.settings.devices['casparcg1']
if (!casparcg1) {
logger.info(`Migration: Add PeripheralDevice.settings to ${device._id}: casparcg1`)
PeripheralDevices.update(device._id, {$set: {
'settings.devices.casparcg1': {
type: PlayoutDeviceType.CASPARCG,
options: {
host: '127.0.0.1',
port: 5250,
launcherHost: '127.0.0.1',
launcherPort: 8010, // todo: change this
}
}
}})
}
}
},
input: [{
migrate: () => {
let device = PeripheralDevices.findOne({type: PeripheralDeviceAPI.DeviceType.PLAYOUT})
if (device) {
// Set some default values:
let http0 = device.settings && device.settings.devices['http0']
if (!http0) {
logger.info(`Migration: Add PeripheralDevice.settings to ${device._id}: http0`)
PeripheralDevices.update(device._id, {$set: {
'settings.devices.http0': {
type: PlayoutDeviceType.HTTPSEND,
options: {
host: '',
port: 9910,
}
}
}})
}
}
},
input: [{
})),
ensureStudioConfig('sources_kam_ptz', '1:ptz0'),
ensureDeviceVersion('ensureVersion.mosDevice', PeripheralDeviceAPI.DeviceType.MOSDEVICE, '_process', '0.1.1')
])
// 0.18.0: Release 4
addMigrationSteps( '0.18.0', [
removeMapping('nora_permanent_klokke'),
removeMapping('nora_permanent_logo'),
ensureMapping('nora_primary_klokke', literal({
device: PlayoutDeviceType.HTTPSEND,
deviceId: 'http0',
lookahead: LookaheadMode.NONE,
})),
ensureMapping('nora_primary_logo', literal({
device: PlayoutDeviceType.HTTPSEND,
deviceId: 'http0',
lookahead: LookaheadMode.NONE,
})),
removeMapping('casparcg_cg_permanent'),
{
id: 'mapping.casparcg_player_wipe.lookahead',
canBeRunAutomatically: true,
validate: () => {
let studio = StudioInstallations.findOne()
if (!studio) return 'Studio not found'
let dbMapping = studio.mappings['casparcg_player_wipe']
if (!dbMapping) return false
if (dbMapping.lookahead !== LookaheadMode.PRELOAD) return `Mapping "casparcg_player_wipe" wrong lookahead mode`
ensureMapping('ptz0_speed', literal({
device: PlayoutDeviceType.PANASONIC_PTZ,
deviceId: 'ptz0',
mappingType: MappingPanasonicPtzType.PRESET_SPEED,
lookahead: LookaheadMode.NONE,
})),
ensureStudioConfig('sources_kam_ptz', '1:ptz0'),
ensureDeviceVersion('ensureVersion.mosDevice', PeripheralDeviceAPI.DeviceType.MOSDEVICE, '_process', '0.1.1')
])
// 0.18.0: Release 4
addMigrationSteps( '0.18.0', [
removeMapping('nora_permanent_klokke'),
removeMapping('nora_permanent_logo'),
ensureMapping('nora_primary_klokke', literal({
device: PlayoutDeviceType.HTTPSEND,
deviceId: 'http0',
lookahead: LookaheadMode.NONE,
})),
ensureMapping('nora_primary_logo', literal({
device: PlayoutDeviceType.HTTPSEND,
deviceId: 'http0',
lookahead: LookaheadMode.NONE,
})),
removeMapping('casparcg_cg_permanent'),
{
id: 'mapping.casparcg_player_wipe.lookahead',
canBeRunAutomatically: true,
validate: () => {
let studio = StudioInstallations.findOne()
if (!studio) return 'Studio not found'
'settings.devices.lawo0': ((pd['settings'] || {})['devices'] || {})['lawo0'] || {
type: PlayoutDeviceType.LAWO,
options: {
host: '160.67.96.51',
port: 9000,
sourcesPath: 'Sapphire.Sources',
rampMotorFunctionPath: '1.5.2'
}
},
'settings.devices.abstract0': ((pd['settings'] || {})['devices'] || {})['abstract0'] || {
type: PlayoutDeviceType.ABSTRACT,
options: {
}
},
'settings.devices.http0': ((pd['settings'] || {})['devices'] || {})['http0'] || {
type: PlayoutDeviceType.HTTPSEND,
options: {
}
},
'settings.devices.hyperdeck0': ((pd['settings'] || {})['devices'] || {})['hyperdeck0'] || {
type: PlayoutDeviceType.HYPERDECK,
options: {
host: '160.67.87.53',
port: 9993
}
},
}})
// PeripheralDevices.update(pd._id, {$set: {
// mappings: mappings
// }})
})
_.each(((PeripheralDevices.findOne('initDBPlayoutDeviceParent') || {})['settings'] || {}).devices, (device, key) => {
sourcesPath: 'Sapphire.Sources',
rampMotorFunctionPath: '1.5.2'
}
},
'settings.devices.abstract0': ((pd['settings'] || {})['devices'] || {})['abstract0'] || {
type: PlayoutDeviceType.ABSTRACT,
options: {
}
},
'settings.devices.http0': ((pd['settings'] || {})['devices'] || {})['http0'] || {
type: PlayoutDeviceType.HTTPSEND,
options: {
}
},
'settings.devices.hyperdeck0': ((pd['settings'] || {})['devices'] || {})['hyperdeck0'] || {
type: PlayoutDeviceType.HYPERDECK,
options: {
host: '160.67.87.53',
port: 9993
}
},
}})
// PeripheralDevices.update(pd._id, {$set: {
// mappings: mappings
// }})
})
_.each(((PeripheralDevices.findOne('initDBPlayoutDeviceParent') || {})['settings'] || {}).devices, (device, key) => {
validate: () => {
let device = PeripheralDevices.findOne({type: PeripheralDeviceAPI.DeviceType.PLAYOUT})
if (!device) return 'Playout-gateway not found'
let settings = device.settings || {devices: {}} as PlayoutDeviceSettings
let hyperdeck0 = settings.devices['hyperdeck0'] as PlayoutDeviceSettingsDeviceHyperdeck
if (!hyperdeck0) return '"hyperdeck0" missing'
// @ts-ignore
if (!hyperdeck0.options) hyperdeck0.options = {}
if (hyperdeck0.type !== PlayoutDeviceType.HYPERDECK) return 'Type is not "HYPERDECK"'
if (!hyperdeck0.options.host) return 'Host is not set'
if (!hyperdeck0.options.port) return 'Port is not set'
return false
},
migrate: () => {
migrate: () => {
let device = PeripheralDevices.findOne({type: PeripheralDeviceAPI.DeviceType.PLAYOUT})
if (device) {
// Set some default values:
let hyperdeck0 = device.settings && device.settings.devices['hyperdeck0']
if (!hyperdeck0) {
logger.info(`Migration: Add PeripheralDevice.settings to ${device._id}: hyperdeck0`)
PeripheralDevices.update(device._id, {$set: {
'settings.devices.hyperdeck0': {
type: PlayoutDeviceType.HYPERDECK,
options: {
host: '',
port: 9993,
}
}
}})
}
}
},
input: [{
validate: () => {
let device = PeripheralDevices.findOne({type: PeripheralDeviceAPI.DeviceType.PLAYOUT})
if (!device) return 'Playout-gateway not found'
let settings = device.settings || {devices: {}} as PlayoutDeviceSettings
let ptz0 = settings.devices['ptz0'] as PlayoutDeviceSettingsDevicePanasonicPTZ
if (!ptz0) return '"ptz0" missing'
// @ts-ignore
if (!ptz0.options) ptz0.options = {}
if (ptz0.type !== PlayoutDeviceType.PANASONIC_PTZ) return 'Type is not "PANASONIC_PTZ"'
// let cameraDevices = ptz0.options.cameraDevices
return false
},
migrate: () => {