Skip to content

Commit 81c8dea

Browse files
committed
wip: allow blueprints to define
1 parent 843711a commit 81c8dea

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

packages/blueprints-integration/src/api/studio.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ export interface BlueprintResultApplyStudioConfig {
130130
/** Playout Mappings */
131131
mappings: BlueprintMappings
132132

133+
/** Parent device settings */
134+
parentDevices: Record<string, BlueprintParentDeviceSettings>
133135
/** Playout-gateway subdevices */
134136
playoutDevices: Record<string, TSR.DeviceOptionsAny>
135137
/** Ingest-gateway subdevices, the types here depend on the gateway you use */
@@ -143,6 +145,14 @@ export interface BlueprintResultApplyStudioConfig {
143145
/** Package Containers */
144146
packageContainers?: Record<string, StudioPackageContainer>
145147
}
148+
export interface BlueprintParentDeviceSettings {
149+
/**
150+
* User friendly name for the device
151+
*/
152+
name: string
153+
154+
options: Record<string, any>
155+
}
146156

147157
export interface IStudioConfigPreset<TConfig = IBlueprintConfig> {
148158
name: string

packages/corelib/src/dataModel/Studio.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
StudioAbPlayerDisabling,
1616
} from '@sofie-automation/shared-lib/dist/core/model/StudioRouteSet'
1717
import { StudioPackageContainer } from '@sofie-automation/shared-lib/dist/core/model/PackageContainer'
18-
import { GenericPeripheralDeviceSettings } from '@sofie-automation/shared-lib/dist/core/model/peripheralDevice'
1918

2019
export { MappingsExt, MappingExt, MappingsHash }
2120

@@ -197,5 +196,5 @@ export interface StudioDeviceSettings {
197196
*/
198197
name: string
199198

200-
options: GenericPeripheralDeviceSettings
199+
options: unknown
201200
}

packages/job-worker/src/playout/upgrade.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import {
22
BlueprintMapping,
33
BlueprintMappings,
4+
BlueprintParentDeviceSettings,
45
JSONBlobParse,
56
StudioRouteBehavior,
67
TSR,
78
} from '@sofie-automation/blueprints-integration'
89
import {
910
MappingsExt,
11+
StudioDeviceSettings,
1012
StudioIngestDevice,
1113
StudioInputDevice,
1214
StudioPackageContainer,
@@ -49,6 +51,15 @@ export async function handleBlueprintUpgradeForStudio(context: JobContext, _data
4951
compileCoreConfigValues(context.studio.settings)
5052
)
5153

54+
const parentDevices = Object.fromEntries(
55+
Object.entries<BlueprintParentDeviceSettings>(result.parentDevices ?? {}).map((dev) => [
56+
dev[0],
57+
literal<Complete<StudioDeviceSettings>>({
58+
name: dev[1].name ?? '',
59+
options: dev[1],
60+
}),
61+
])
62+
)
5263
const playoutDevices = Object.fromEntries(
5364
Object.entries<TSR.DeviceOptionsAny>(result.playoutDevices ?? {}).map((dev) => [
5465
dev[0],
@@ -112,6 +123,7 @@ export async function handleBlueprintUpgradeForStudio(context: JobContext, _data
112123
await context.directCollections.Studios.update(context.studioId, {
113124
$set: {
114125
'mappingsWithOverrides.defaults': translateMappings(result.mappings),
126+
'peripheralDeviceSettings.deviceSettings.defaults': parentDevices,
115127
'peripheralDeviceSettings.playoutDevices.defaults': playoutDevices,
116128
'peripheralDeviceSettings.ingestDevices.defaults': ingestDevices,
117129
'peripheralDeviceSettings.inputDevices.defaults': inputDevices,

packages/shared-lib/src/core/model/peripheralDevice.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { TSR } from '../../tsr'
22
import { PeripheralDeviceId, StudioId } from './Ids'
33

4-
export type GenericPeripheralDeviceSettings = Record<string, never>
5-
64
export interface IngestDeviceSecretSettingsStatus {
75
/** OAuth: Set to true when secret value exists */
86
credentials?: boolean

0 commit comments

Comments
 (0)