Skip to content

Commit 1b4fc54

Browse files
committed
fix
1 parent e330668 commit 1b4fc54

File tree

4 files changed

+17
-34
lines changed

4 files changed

+17
-34
lines changed

packages/corelib/src/dataModel/PieceInstance.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ export interface PieceInstance {
3636
rundownId: RundownId
3737
/**
3838
* The part instance this piece belongs to.
39-
* If null, the instance belongs to the rundown itself.
4039
*/
41-
partInstanceId: PartInstanceId | null
40+
partInstanceId: PartInstanceId
4241

4342
/** Whether this PieceInstance is a temprorary wrapping of a Piece */
4443
readonly isTemporary?: boolean

packages/job-worker/src/playout/abPlayback/abSessionHelper.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ export class AbSessionHelper {
108108
}
109109

110110
// We only want to consider sessions already tagged to this partInstance
111-
// nocommit - is this sane for piece instances without a partInstanceId?
112111
const existingSession = sessionsToConsider.find((s) =>
113112
s.partInstanceIds?.includes(pieceInstance.partInstanceId)
114113
)
@@ -195,10 +194,12 @@ export class AbSessionHelper {
195194

196195
// Find an normal partInstance
197196
const partInstanceId = tlObj.partInstanceId
198-
const partInstanceSession = sessionsToConsider.find((s) => s.partInstanceIds?.includes(partInstanceId))
199-
if (partInstanceSession) {
200-
partInstanceSession.keep = true
201-
return partInstanceSession.id
197+
if (partInstanceId) {
198+
const partInstanceSession = sessionsToConsider.find((s) => s.partInstanceIds?.includes(partInstanceId))
199+
if (partInstanceSession) {
200+
partInstanceSession.keep = true
201+
return partInstanceSession.id
202+
}
202203
}
203204

204205
// If it is lookahead, then we run differently

packages/job-worker/src/playout/timings/piecePlayback.ts

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,26 @@ export function onPiecePlaybackStarted(
1616
context: JobContext,
1717
playoutModel: PlayoutModel,
1818
data: {
19-
partInstanceId: PartInstanceId | null
19+
partInstanceId: PartInstanceId
2020
pieceInstanceId: PieceInstanceId
2121
startedPlayback: Time
2222
}
2323
): void {
2424
const playlist = playoutModel.playlist
2525

26-
if (!data.partInstanceId) {
27-
// nocommit - implement for rundown owned
28-
logger.warn(`onPiecePlaybackStarted: Received for a piece without a partInstance`)
26+
if (!playlist.activationId) {
27+
logger.warn(`onPiecePlaybackStarted: Received for inactive RundownPlaylist "${playlist._id}"`)
2928
return
3029
}
3130

3231
const partInstance = playoutModel.getPartInstance(data.partInstanceId)
3332
if (!partInstance) {
34-
if (!playlist.activationId) {
35-
logger.warn(`onPiecePlaybackStarted: Received for inactive RundownPlaylist "${playlist._id}"`)
36-
} else {
37-
throw new Error(`PartInstance "${data.partInstanceId}" in RundownPlaylist "${playlist._id}" not found!`)
38-
}
39-
return
33+
throw new Error(`PartInstance "${data.partInstanceId}" in RundownPlaylist "${playlist._id}" not found!`)
4034
}
4135

4236
const pieceInstance = partInstance.getPieceInstance(data.pieceInstanceId)
4337
if (!pieceInstance) {
44-
if (!playlist.activationId) {
45-
logger.warn(`onPiecePlaybackStarted: Received for inactive RundownPlaylist "${playlist._id}"`)
46-
} else {
47-
throw new Error(`PieceInstance "${data.partInstanceId}" in RundownPlaylist "${playlist._id}" not found!`)
48-
}
49-
return
38+
throw new Error(`PieceInstance "${data.partInstanceId}" in RundownPlaylist "${playlist._id}" not found!`)
5039
}
5140

5241
const isPlaying = !!(
@@ -74,16 +63,15 @@ export function onPiecePlaybackStopped(
7463
context: JobContext,
7564
playoutModel: PlayoutModel,
7665
data: {
77-
partInstanceId: PartInstanceId | null
66+
partInstanceId: PartInstanceId
7867
pieceInstanceId: PieceInstanceId
7968
stoppedPlayback: Time
8069
}
8170
): void {
8271
const playlist = playoutModel.playlist
8372

84-
if (!data.partInstanceId) {
85-
// nocommit - implement for rundown owned
86-
logger.warn(`onPiecePlaybackStopped: Received for a piece without a partInstance`)
73+
if (!playlist.activationId) {
74+
logger.warn(`onPiecePlaybackStopped: Received for inactive RundownPlaylist "${playlist._id}"`)
8775
return
8876
}
8977

@@ -95,12 +83,7 @@ export function onPiecePlaybackStopped(
9583

9684
const pieceInstance = partInstance.getPieceInstance(data.pieceInstanceId)
9785
if (!pieceInstance) {
98-
if (!playlist.activationId) {
99-
logger.warn(`onPiecePlaybackStopped: Received for inactive RundownPlaylist "${playlist._id}"`)
100-
} else {
101-
throw new Error(`PieceInstance "${data.partInstanceId}" in RundownPlaylist "${playlist._id}" not found!`)
102-
}
103-
return
86+
throw new Error(`PieceInstance "${data.partInstanceId}" in RundownPlaylist "${playlist._id}" not found!`)
10487
}
10588

10689
const isPlaying = !!(

packages/shared-lib/src/peripheralDevice/peripheralDeviceAPI.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export interface PartPlaybackCallbackData {
88
}
99
export interface PiecePlaybackCallbackData {
1010
rundownPlaylistId: RundownPlaylistId
11-
partInstanceId: PartInstanceId | null
11+
partInstanceId: PartInstanceId
1212
pieceInstanceId: PieceInstanceId
1313
dynamicallyInserted?: boolean
1414
}

0 commit comments

Comments
 (0)