Skip to content

Commit 712f7ce

Browse files
committed
wip: move studio settings types to blueprint accessible, and generate in applyConfig
1 parent 731a092 commit 712f7ce

File tree

6 files changed

+85
-71
lines changed

6 files changed

+85
-71
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ import type {
2727
StudioRouteSet,
2828
StudioRouteSetExclusivityGroup,
2929
} from '@sofie-automation/shared-lib/dist/core/model/StudioRouteSet'
30-
import { StudioPackageContainer } from '@sofie-automation/shared-lib/dist/core/model/PackageContainer'
30+
import type { StudioPackageContainer } from '@sofie-automation/shared-lib/dist/core/model/PackageContainer'
31+
import type { IStudioSettings } from '@sofie-automation/shared-lib/dist/core/model/StudioSettings'
3132

3233
export interface StudioBlueprintManifest<TRawConfig = IBlueprintConfig, TProcessedConfig = unknown>
3334
extends BlueprintManifestBase {
@@ -142,6 +143,8 @@ export interface BlueprintResultApplyStudioConfig {
142143
routeSetExclusivityGroups?: Record<string, StudioRouteSetExclusivityGroup>
143144
/** Package Containers */
144145
packageContainers?: Record<string, StudioPackageContainer>
146+
147+
studioSettings?: IStudioSettings
145148
}
146149

147150
export interface IStudioConfigPreset<TConfig = IBlueprintConfig> {

packages/blueprints-integration/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ export { JSONSchema } from '@sofie-automation/shared-lib/dist/lib/JSONSchemaType
2828
export * from '@sofie-automation/shared-lib/dist/lib/JSONBlob'
2929
export * from '@sofie-automation/shared-lib/dist/lib/JSONSchemaUtil'
3030
export * from '@sofie-automation/shared-lib/dist/core/model/StudioRouteSet'
31+
export * from '@sofie-automation/shared-lib/dist/core/model/StudioSettings'

packages/corelib/src/dataModel/RundownPlaylist.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import {
1111
RundownId,
1212
} from './Ids'
1313
import { RundownPlaylistNote } from './Notes'
14+
import { ForceQuickLoopAutoNext } from '@sofie-automation/shared-lib/dist/core/model/StudioSettings'
15+
16+
export { ForceQuickLoopAutoNext }
1417

1518
/** Details of an ab-session requested by the blueprints in onTimelineGenerate */
1619
export interface ABSessionInfo {
@@ -80,15 +83,6 @@ export type QuickLoopMarker =
8083
| QuickLoopRundownMarker
8184
| QuickLoopPlaylistMarker
8285

83-
export enum ForceQuickLoopAutoNext {
84-
/** Parts will auto-next only when explicitly set by the NRCS/blueprints */
85-
DISABLED = 'disabled',
86-
/** Parts will auto-next when the expected duration is set and within range */
87-
ENABLED_WHEN_VALID_DURATION = 'enabled_when_valid_duration',
88-
/** All parts will auto-next. If expected duration is undefined or low, the default display duration will be used */
89-
ENABLED_FORCING_MIN_DURATION = 'enabled_forcing_min_duration',
90-
}
91-
9286
export interface QuickLoopProps {
9387
/** The Start marker */
9488
start?: QuickLoopMarker

packages/corelib/src/dataModel/Studio.ts

Lines changed: 2 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { ObjectWithOverrides } from '../settings/objectWithOverrides'
33
import { StudioId, OrganizationId, BlueprintId, ShowStyleBaseId, MappingsHash, PeripheralDeviceId } from './Ids'
44
import { BlueprintHash, LastBlueprintConfig } from './Blueprint'
55
import { MappingsExt, MappingExt } from '@sofie-automation/shared-lib/dist/core/model/Timeline'
6-
import { ForceQuickLoopAutoNext } from './RundownPlaylist'
76
import {
87
ResultingMappingRoute,
98
RouteMapping,
@@ -15,8 +14,9 @@ import {
1514
StudioAbPlayerDisabling,
1615
} from '@sofie-automation/shared-lib/dist/core/model/StudioRouteSet'
1716
import { StudioPackageContainer } from '@sofie-automation/shared-lib/dist/core/model/PackageContainer'
17+
import { IStudioSettings } from '@sofie-automation/shared-lib/dist/core/model/StudioSettings'
1818

19-
export { MappingsExt, MappingExt, MappingsHash }
19+
export { MappingsExt, MappingExt, MappingsHash, IStudioSettings }
2020

2121
// RouteSet functions has been moved to shared-lib:
2222
// So we need to re-export them here:
@@ -32,64 +32,6 @@ export {
3232
StudioPackageContainer,
3333
}
3434

35-
export interface IStudioSettings {
36-
/** The framerate (frames per second) used to convert internal timing information (in milliseconds)
37-
* into timecodes and timecode-like strings and interpret timecode user input
38-
* Default: 25
39-
*/
40-
frameRate: number
41-
42-
/** URL to endpoint where media preview are exposed */
43-
mediaPreviewsUrl: string // (former media_previews_url in config)
44-
/** URLs for slack webhook to send evaluations */
45-
slackEvaluationUrls?: string // (former slack_evaluation in config)
46-
47-
/** Media Resolutions supported by the studio for media playback */
48-
supportedMediaFormats?: string // (former mediaResolutions in config)
49-
/** Audio Stream Formats supported by the studio for media playback */
50-
supportedAudioStreams?: string // (former audioStreams in config)
51-
52-
/** Should the play from anywhere feature be enabled in this studio */
53-
enablePlayFromAnywhere?: boolean
54-
55-
/**
56-
* If set, forces the multi-playout-gateway mode (aka set "now"-time right away)
57-
* for single playout-gateways setups
58-
*/
59-
forceMultiGatewayMode?: boolean
60-
61-
/** How much extra delay to add to the Now-time (used for the "multi-playout-gateway" feature) .
62-
* A higher value adds delays in playout, but reduces the risk of missed frames. */
63-
multiGatewayNowSafeLatency?: number
64-
65-
/** Allow resets while a rundown is on-air */
66-
allowRundownResetOnAir?: boolean
67-
68-
/** Preserve unsynced segments psoition in the rundown, relative to the other segments */
69-
preserveOrphanedSegmentPositionInRundown?: boolean
70-
71-
/**
72-
* The minimum amount of time, in milliseconds, that must pass after a take before another take may be performed.
73-
* Default: 1000
74-
*/
75-
minimumTakeSpan: number
76-
77-
/** Whether to allow adlib testing mode, before a Part is playing in a Playlist */
78-
allowAdlibTestingSegment?: boolean
79-
80-
/** Should QuickLoop context menu options be available to the users. It does not affect Playlist loop enabled by the NRCS. */
81-
enableQuickLoop?: boolean
82-
83-
/** If and how to force auto-nexting in a looping Playlist */
84-
forceQuickLoopAutoNext?: ForceQuickLoopAutoNext
85-
86-
/**
87-
* The duration to apply on too short Parts Within QuickLoop when ForceQuickLoopAutoNext.ENABLED_FORCING_MIN_DURATION is selected
88-
* Default: 3000
89-
*/
90-
fallbackPartDuration?: number
91-
}
92-
9335
export type StudioLight = Omit<DBStudio, 'mappingsWithOverrides' | 'blueprintConfigWithOverrides'>
9436

9537
/** A set of available layer groups in a given installation */
@@ -123,7 +65,6 @@ export interface DBStudio {
12365
blueprintConfigWithOverrides: ObjectWithOverrides<IBlueprintConfig>
12466

12567
settingsWithOverrides: ObjectWithOverrides<IStudioSettings>
126-
// settings: IStudioSettings
12768

12869
_rundownVersionHash: string
12970

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
BlueprintMapping,
33
BlueprintMappings,
4+
IStudioSettings,
45
JSONBlobParse,
56
StudioRouteBehavior,
67
TSR,
@@ -26,6 +27,7 @@ import { compileCoreConfigValues } from '../blueprints/config'
2627
import { CommonContext } from '../blueprints/context'
2728
import { JobContext } from '../jobs'
2829
import { FixUpBlueprintConfigContext } from '@sofie-automation/corelib/dist/fixUpBlueprintConfig/context'
30+
import { DEFAULT_MINIMUM_TAKE_SPAN } from '@sofie-automation/shared-lib/dist/core/constants'
2931

3032
/**
3133
* Run the Blueprint applyConfig for the studio
@@ -109,8 +111,15 @@ export async function handleBlueprintUpgradeForStudio(context: JobContext, _data
109111
])
110112
)
111113

114+
const studioSettings: IStudioSettings = result.studioSettings ?? {
115+
frameRate: 25,
116+
mediaPreviewsUrl: '',
117+
minimumTakeSpan: DEFAULT_MINIMUM_TAKE_SPAN,
118+
}
119+
112120
await context.directCollections.Studios.update(context.studioId, {
113121
$set: {
122+
'settingsWithOverrides.defaults': studioSettings,
114123
'mappingsWithOverrides.defaults': translateMappings(result.mappings),
115124
'peripheralDeviceSettings.playoutDevices.defaults': playoutDevices,
116125
'peripheralDeviceSettings.ingestDevices.defaults': ingestDevices,
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
export enum ForceQuickLoopAutoNext {
2+
/** Parts will auto-next only when explicitly set by the NRCS/blueprints */
3+
DISABLED = 'disabled',
4+
/** Parts will auto-next when the expected duration is set and within range */
5+
ENABLED_WHEN_VALID_DURATION = 'enabled_when_valid_duration',
6+
/** All parts will auto-next. If expected duration is undefined or low, the default display duration will be used */
7+
ENABLED_FORCING_MIN_DURATION = 'enabled_forcing_min_duration',
8+
}
9+
10+
export interface IStudioSettings {
11+
/** The framerate (frames per second) used to convert internal timing information (in milliseconds)
12+
* into timecodes and timecode-like strings and interpret timecode user input
13+
* Default: 25
14+
*/
15+
frameRate: number
16+
17+
/** URL to endpoint where media preview are exposed */
18+
mediaPreviewsUrl: string // (former media_previews_url in config)
19+
/** URLs for slack webhook to send evaluations */
20+
slackEvaluationUrls?: string // (former slack_evaluation in config)
21+
22+
/** Media Resolutions supported by the studio for media playback */
23+
supportedMediaFormats?: string // (former mediaResolutions in config)
24+
/** Audio Stream Formats supported by the studio for media playback */
25+
supportedAudioStreams?: string // (former audioStreams in config)
26+
27+
/** Should the play from anywhere feature be enabled in this studio */
28+
enablePlayFromAnywhere?: boolean
29+
30+
/**
31+
* If set, forces the multi-playout-gateway mode (aka set "now"-time right away)
32+
* for single playout-gateways setups
33+
*/
34+
forceMultiGatewayMode?: boolean
35+
36+
/** How much extra delay to add to the Now-time (used for the "multi-playout-gateway" feature).
37+
* A higher value adds delays in playout, but reduces the risk of missed frames. */
38+
multiGatewayNowSafeLatency?: number
39+
40+
/** Allow resets while a rundown is on-air */
41+
allowRundownResetOnAir?: boolean
42+
43+
/** Preserve unsynced segments position in the rundown, relative to the other segments */
44+
preserveOrphanedSegmentPositionInRundown?: boolean
45+
46+
/**
47+
* The minimum amount of time, in milliseconds, that must pass after a take before another take may be performed.
48+
* Default: 1000
49+
*/
50+
minimumTakeSpan: number
51+
52+
/** Whether to allow adlib testing mode, before a Part is playing in a Playlist */
53+
allowAdlibTestingSegment?: boolean
54+
55+
/** Should QuickLoop context menu options be available to the users. It does not affect Playlist loop enabled by the NRCS. */
56+
enableQuickLoop?: boolean
57+
58+
/** If and how to force auto-nexting in a looping Playlist */
59+
forceQuickLoopAutoNext?: ForceQuickLoopAutoNext
60+
61+
/**
62+
* The duration to apply on too short Parts Within QuickLoop when ForceQuickLoopAutoNext.ENABLED_FORCING_MIN_DURATION is selected
63+
* Default: 3000
64+
*/
65+
fallbackPartDuration?: number
66+
}

0 commit comments

Comments
 (0)