Skip to content

Commit f8a1d75

Browse files
authored
Merge pull request Sofie-Automation#1298 from bbc/upstream/chore-add-lsg-playlist-timing
2 parents a6e9a9b + 6ef01f1 commit f8a1d75

File tree

3 files changed

+61
-1
lines changed

3 files changed

+61
-1
lines changed

packages/live-status-gateway/api/schemas/activePlaylist.yaml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,32 @@ $defs:
2929
$ref: '#/$defs/part'
3030
publicData:
3131
description: Optional arbitrary data
32-
required: [event, id, name, rundownIds, currentPart, currentSegment, nextPart]
32+
timing:
33+
description: Timing information about the active playlist
34+
type: object
35+
properties:
36+
timingMode:
37+
description: 'Timing mode for the playlist.'
38+
type: string
39+
enum:
40+
- none
41+
- forward-time
42+
- back-time
43+
startedPlayback:
44+
description: Unix timestamp of when the playlist started (milliseconds)
45+
type: number
46+
expectedStart:
47+
description: Unix timestamp of when the playlist is expected to start (milliseconds). Required when the timingMode is set to forward-time.
48+
type: number
49+
expectedDurationMs:
50+
description: Duration of the playlist in ms
51+
type: number
52+
expectedEnd:
53+
description: Unix timestamp of when the playlist is expected to end (milliseconds) Required when the timingMode is set to back-time.
54+
type: number
55+
required: [timingMode]
56+
additionalProperties: false
57+
required: [event, id, name, rundownIds, currentPart, currentSegment, nextPart, timing]
3358
additionalProperties: false
3459
examples:
3560
- event: activePlaylist
@@ -44,6 +69,10 @@ $defs:
4469
$ref: '#/$defs/part/examples/0'
4570
publicData:
4671
category: 'Evening News'
72+
timing:
73+
timingMode: 'forward-time'
74+
expectedStart: 1728895750727
75+
expectedDurationMs: 180000
4776
partBase:
4877
type: object
4978
properties:

packages/live-status-gateway/src/topics/__tests__/activePlaylist.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { literal } from '@sofie-automation/corelib/dist/lib'
99
import { DBPartInstance } from '@sofie-automation/corelib/dist/dataModel/PartInstance'
1010
import { PartsHandler } from '../../collections/partsHandler'
1111
import { DBPart } from '@sofie-automation/corelib/dist/dataModel/Part'
12+
import { PlaylistTimingType } from '@sofie-automation/blueprints-integration'
1213

1314
function makeEmptyTestPartInstances(): SelectedPartInstances {
1415
return {
@@ -46,6 +47,9 @@ describe('ActivePlaylistTopic', () => {
4647
currentSegment: null,
4748
rundownIds: unprotectStringArray(playlist.rundownIdsInOrder),
4849
publicData: undefined,
50+
timing: {
51+
timingMode: PlaylistTimingType.None,
52+
},
4953
}
5054

5155
// eslint-disable-next-line @typescript-eslint/unbound-method
@@ -125,6 +129,9 @@ describe('ActivePlaylistTopic', () => {
125129
},
126130
rundownIds: unprotectStringArray(playlist.rundownIdsInOrder),
127131
publicData: { a: 'b' },
132+
timing: {
133+
timingMode: PlaylistTimingType.None,
134+
},
128135
}
129136

130137
// eslint-disable-next-line @typescript-eslint/unbound-method

packages/live-status-gateway/src/topics/activePlaylistTopic.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import _ = require('underscore')
1515
import { PartTiming, calculateCurrentPartTiming } from './helpers/partTiming'
1616
import { SelectedPieceInstances, PieceInstancesHandler, PieceInstanceMin } from '../collections/pieceInstancesHandler'
1717
import { PieceStatus, toPieceStatus } from './helpers/pieceStatus'
18+
import { PlaylistTimingType } from '@sofie-automation/blueprints-integration'
1819

1920
const THROTTLE_PERIOD_MS = 100
2021

@@ -45,6 +46,13 @@ export interface ActivePlaylistStatus {
4546
currentSegment: CurrentSegmentStatus | null
4647
nextPart: PartStatus | null
4748
publicData: unknown
49+
timing: {
50+
timingMode: PlaylistTimingType
51+
startedPlayback?: number
52+
expectedStart?: number
53+
expectedDurationMs?: number
54+
expectedEnd?: number
55+
}
4856
}
4957

5058
export class ActivePlaylistTopic
@@ -141,6 +149,19 @@ export class ActivePlaylistTopic
141149
})
142150
: null,
143151
publicData: this._activePlaylist.publicData,
152+
timing: {
153+
timingMode: this._activePlaylist.timing.type,
154+
startedPlayback: this._activePlaylist.startedPlayback,
155+
expectedDurationMs: this._activePlaylist.timing.expectedDuration,
156+
expectedStart:
157+
this._activePlaylist.timing.type !== PlaylistTimingType.None
158+
? this._activePlaylist.timing.expectedStart
159+
: undefined,
160+
expectedEnd:
161+
this._activePlaylist.timing.type !== PlaylistTimingType.None
162+
? this._activePlaylist.timing.expectedEnd
163+
: undefined,
164+
},
144165
})
145166
: literal<ActivePlaylistStatus>({
146167
event: 'activePlaylist',
@@ -151,6 +172,9 @@ export class ActivePlaylistTopic
151172
currentSegment: null,
152173
nextPart: null,
153174
publicData: undefined,
175+
timing: {
176+
timingMode: PlaylistTimingType.None,
177+
},
154178
})
155179

156180
this.sendMessage(subscribers, message)

0 commit comments

Comments
 (0)