Skip to content

Commit f94db28

Browse files
author
Mint de Wit
committed
fix: removing parts/segments with quickloop markers
1 parent 0d1b890 commit f94db28

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

packages/job-worker/src/ingest/commit.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ export async function CommitIngestOperation(
221221
// sync changes to the 'selected' partInstances
222222
await syncChangesToPartInstances(context, playoutModel, ingestModel)
223223

224+
// update the quickloop in case we did any changes to things involving marker
225+
playoutModel.updateQuickLoopState()
226+
224227
playoutModel.deferAfterSave(() => {
225228
// Run in the background, we don't want to hold onto the lock to do this
226229
context

packages/job-worker/src/playout/model/services/QuickLoopService.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ export class QuickLoopService {
6565

6666
this.resetDynamicallyInsertedPartOverrideIfNoLongerNeeded(quickLoopProps)
6767

68+
// remove the marker if it no longer exists inside the rundown
69+
if (quickLoopProps.start && !this.doesMarkerExist(quickLoopProps.start)) delete quickLoopProps.start
70+
if (quickLoopProps.end && !this.doesMarkerExist(quickLoopProps.end)) delete quickLoopProps.end
71+
6872
if (quickLoopProps.start == null || quickLoopProps.end == null) {
6973
quickLoopProps.running = false
7074
} else {
@@ -177,6 +181,27 @@ export class QuickLoopService {
177181
}
178182
}
179183

184+
/**
185+
* Check whether the thing a marker references still exists within the playlist
186+
* @param marker Marker to find
187+
*/
188+
private doesMarkerExist(marker: QuickLoopMarker) {
189+
let found = false
190+
191+
if (marker.type === QuickLoopMarkerType.PART) {
192+
found = !!this.playoutModel.findPart(marker.id)
193+
} else if (marker.type === QuickLoopMarkerType.SEGMENT) {
194+
found = !!this.playoutModel.findSegment(marker.id)
195+
} else if (marker.type === QuickLoopMarkerType.RUNDOWN) {
196+
found = !!this.playoutModel.getRundown(marker.id)
197+
} else {
198+
// we can't lose the playlist so that marker is always valid
199+
found = true
200+
}
201+
202+
return found
203+
}
204+
180205
private findPartPosition(
181206
partInstance: PlayoutPartInstanceModel | null,
182207
rundownIds: RundownId[]

0 commit comments

Comments
 (0)