@@ -66,25 +66,19 @@ function generateTimelineVersions(
6666 }
6767}
6868
69- export async function updateStudioTimeline (
69+ /**
70+ * Generate timeline objects for a studio (when no playlist is active)
71+ */
72+ export async function getStudioTimeline (
7073 context : JobContext ,
7174 playoutModel : StudioPlayoutModel | PlayoutModel
72- ) : Promise < void > {
73- const span = context . startSpan ( 'updateStudioTimeline' )
74- logger . debug ( 'updateStudioTimeline running...' )
75+ ) : Promise < {
76+ objs : Array < TimelineObjRundown >
77+ versions : TimelineCompleteGenerationVersions
78+ timingContext : undefined
79+ regenerateTimelineToken : undefined
80+ } > {
7581 const studio = context . studio
76- // Ensure there isn't a playlist active, as that should be using a different function call
77- if ( isModelForStudio ( playoutModel ) ) {
78- const activePlaylists = playoutModel . getActiveRundownPlaylists ( )
79- if ( activePlaylists . length > 0 ) {
80- throw new Error ( `Studio has an active playlist` )
81- }
82- } else {
83- if ( playoutModel . playlist . activationId ) {
84- throw new Error ( `Studio has an active playlist` )
85- }
86- }
87-
8882 let baselineObjects : TimelineObjRundown [ ] = [ ]
8983 let studioBaseline : BlueprintResultBaseline | undefined
9084
@@ -118,22 +112,38 @@ export async function updateStudioTimeline(
118112 studioBlueprint ?. blueprint ?. blueprintVersion ?? '-'
119113 )
120114
121- flattenAndProcessTimelineObjects ( context , baselineObjects )
122-
123- // Future: We should handle any 'now' objects that are at the root of this timeline
124- preserveOrReplaceNowTimesInObjects ( playoutModel , baselineObjects )
125-
126- if ( playoutModel . isMultiGatewayMode ) {
127- logAnyRemainingNowTimes ( context , baselineObjects )
115+ if ( studioBaseline ) {
116+ updateBaselineExpectedPackagesOnStudio ( context , playoutModel , studioBaseline )
128117 }
129118
130- const timelineHash = playoutModel . setTimeline ( baselineObjects , versions , undefined ) . timelineHash
119+ return {
120+ objs : baselineObjects ,
121+ versions,
122+ timingContext : undefined ,
123+ regenerateTimelineToken : undefined ,
124+ }
125+ }
131126
132- if ( studioBaseline ) {
133- updateBaselineExpectedPackagesOnStudio ( context , playoutModel , studioBaseline )
127+ export async function updateStudioTimeline (
128+ context : JobContext ,
129+ playoutModel : StudioPlayoutModel | PlayoutModel
130+ ) : Promise < void > {
131+ const span = context . startSpan ( 'updateStudioTimeline' )
132+ logger . debug ( 'updateStudioTimeline: marking studio as needing timeline update' )
133+ // Ensure there isn't a playlist active, as that should be using a different function call
134+ if ( isModelForStudio ( playoutModel ) ) {
135+ const activePlaylists = playoutModel . getActiveRundownPlaylists ( )
136+ if ( activePlaylists . length > 0 ) {
137+ throw new Error ( `Studio has an active playlist` )
138+ }
139+ } else {
140+ if ( playoutModel . playlist . activationId ) {
141+ throw new Error ( `Studio has an active playlist` )
142+ }
134143 }
135144
136- logger . verbose ( `updateStudioTimeline done, hash: "${ timelineHash } "` )
145+ playoutModel . markTimelineNeedsUpdate ( )
146+
137147 if ( span ) span . end ( )
138148}
139149
0 commit comments