Skip to content

Commit 97aeb9c

Browse files
committed
chore(lsg): fix lsg RundownPlaylistTiming type
1 parent 6953ff9 commit 97aeb9c

5 files changed

Lines changed: 33 additions & 89 deletions

File tree

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

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -39,31 +39,7 @@ $defs:
3939
description: Optional arbitrary data
4040
timing:
4141
description: Timing information about the active playlist
42-
type: object
43-
title: ActivePlaylistTiming
44-
properties:
45-
timingMode:
46-
description: 'Timing mode for the playlist.'
47-
type: string
48-
title: ActivePlaylistTimingMode
49-
enum:
50-
- none
51-
- forward-time
52-
- back-time
53-
startedPlayback:
54-
description: Unix timestamp of when the playlist started (milliseconds)
55-
type: number
56-
expectedStart:
57-
description: Unix timestamp of when the playlist is expected to start (milliseconds). Required when the timingMode is set to forward-time.
58-
type: number
59-
expectedDurationMs:
60-
description: Duration of the playlist in ms
61-
type: number
62-
expectedEnd:
63-
description: Unix timestamp of when the playlist is expected to end (milliseconds) Required when the timingMode is set to back-time.
64-
type: number
65-
required: [timingMode]
66-
additionalProperties: false
42+
$ref: 'timing/rundownPlaylistTiming.yaml#/$defs/rundownPlaylistTiming'
6743
quickLoop:
6844
description: Information about the current quickLoop, if any
6945
type: object

packages/live-status-gateway-api/src/generated/schema.ts

Lines changed: 14 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ interface ActivePlaylistEvent {
153153
*/
154154
publicData?: any
155155
/**
156-
* Timing information about the active playlist
156+
* Timing information about a playlist or rundown
157157
*/
158-
timing: ActivePlaylistTiming
158+
timing: RundownPlaylistTiming
159159
/**
160160
* Information about the current quickLoop, if any
161161
*/
@@ -336,35 +336,35 @@ interface PartStatus {
336336
}
337337

338338
/**
339-
* Timing information about the active playlist
339+
* Timing information about a playlist or rundown
340340
*/
341-
interface ActivePlaylistTiming {
341+
interface RundownPlaylistTiming {
342342
/**
343-
* Timing mode for the playlist.
343+
* Timing mode for a playlist or rundown.
344344
*/
345-
timingMode: ActivePlaylistTimingMode
345+
timingMode: RundownPlaylistTimingMode
346346
/**
347-
* Unix timestamp of when the playlist started (milliseconds)
347+
* Unix timestamp of when a playlist or rundown started (milliseconds)
348348
*/
349349
startedPlayback?: number
350350
/**
351-
* Unix timestamp of when the playlist is expected to start (milliseconds). Required when the timingMode is set to forward-time.
351+
* Unix timestamp of when a playlist or rundown is expected to start (milliseconds). Required when the timingMode is set to forward-time.
352352
*/
353353
expectedStart?: number
354354
/**
355-
* Duration of the playlist in ms
355+
* Duration of a playlist or rundown in ms
356356
*/
357357
expectedDurationMs?: number
358358
/**
359-
* Unix timestamp of when the playlist is expected to end (milliseconds) Required when the timingMode is set to back-time.
359+
* Unix timestamp of when a playlist or rundown is expected to end (milliseconds) Required when the timingMode is set to back-time.
360360
*/
361361
expectedEnd?: number
362362
}
363363

364364
/**
365-
* Timing mode for the playlist.
365+
* Timing mode for a playlist or rundown.
366366
*/
367-
enum ActivePlaylistTimingMode {
367+
enum RundownPlaylistTimingMode {
368368
NONE = 'none',
369369
FORWARD_MINUS_TIME = 'forward-time',
370370
BACK_MINUS_TIME = 'back-time',
@@ -483,41 +483,6 @@ interface Rundown {
483483
segments: ExtendedSegment[]
484484
}
485485

486-
/**
487-
* Timing information about a playlist or rundown
488-
*/
489-
interface RundownPlaylistTiming {
490-
/**
491-
* Timing mode for a playlist or rundown.
492-
*/
493-
timingMode: RundownPlaylistTimingMode
494-
/**
495-
* Unix timestamp of when a playlist or rundown started (milliseconds)
496-
*/
497-
startedPlayback?: number
498-
/**
499-
* Unix timestamp of when a playlist or rundown is expected to start (milliseconds). Required when the timingMode is set to forward-time.
500-
*/
501-
expectedStart?: number
502-
/**
503-
* Duration of a playlist or rundown in ms
504-
*/
505-
expectedDurationMs?: number
506-
/**
507-
* Unix timestamp of when a playlist or rundown is expected to end (milliseconds) Required when the timingMode is set to back-time.
508-
*/
509-
expectedEnd?: number
510-
}
511-
512-
/**
513-
* Timing mode for a playlist or rundown.
514-
*/
515-
enum RundownPlaylistTimingMode {
516-
NONE = 'none',
517-
FORWARD_MINUS_TIME = 'forward-time',
518-
BACK_MINUS_TIME = 'back-time',
519-
}
520-
521486
interface ExtendedSegment {
522487
/**
523488
* Unique id of the segment
@@ -879,15 +844,13 @@ export {
879844
CurrentSegmentPart,
880845
CurrentSegmentPartTiming,
881846
PartStatus,
882-
ActivePlaylistTiming,
883-
ActivePlaylistTimingMode,
847+
RundownPlaylistTiming,
848+
RundownPlaylistTimingMode,
884849
ActivePlaylistQuickLoop,
885850
QuickLoopMarker,
886851
QuickLoopMarkerType,
887852
ExtendedActivePlaylistEvent,
888853
Rundown,
889-
RundownPlaylistTiming,
890-
RundownPlaylistTimingMode,
891854
ExtendedSegment,
892855
SegmentTiming,
893856
ActivePiecesEvent,

packages/live-status-gateway/src/topics/helpers/playlist/extendedPlaylistStatus.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { DBPart } from '@sofie-automation/corelib/dist/dataModel/Part'
2-
import { ActivePlaylistTimingMode, ExtendedActivePlaylistEvent } from '@sofie-automation/live-status-gateway-api'
2+
import { ExtendedActivePlaylistEvent, RundownPlaylistTimingMode } from '@sofie-automation/live-status-gateway-api'
33
import { literal, unprotectString } from '@sofie-automation/server-core-integration'
44
import { DBSegment } from '@sofie-automation/corelib/dist/dataModel/Segment'
55
import { ExtendedPlaylistStatusCache } from './playlistStatus.js'
@@ -23,7 +23,7 @@ export function toExtendedPlaylistStatus(props: ExtendedPlaylistStatusCache): Ex
2323
id: unprotectString(activePlaylist._id),
2424
externalId: activePlaylist.externalId,
2525
name: activePlaylist.name,
26-
rundownIds: activePlaylist.rundownIdsInOrder.map((r) => unprotectString(r)),
26+
rundowns: activePlaylist.rundownIdsInOrder.map((r) => unprotectString(r)),
2727
currentPart: toCurrentPartStatus(props, currentPart),
2828
currentSegment: toCurrentSegmentStatus({ ...props }, currentPart, currentSegmentParts),
2929
// TODO: add all fields to this object, then add parts to it.
@@ -42,14 +42,14 @@ export function toExtendedPlaylistStatus(props: ExtendedPlaylistStatusCache): Ex
4242
id: null,
4343
externalId: null,
4444
name: '',
45-
rundownIds: [],
45+
rundowns: [],
4646
currentPart: null,
4747
currentSegment: null,
4848
nextPart: null,
4949
quickLoop: undefined,
5050
publicData: undefined,
5151
timing: {
52-
timingMode: ActivePlaylistTimingMode.NONE,
52+
timingMode: RundownPlaylistTimingMode.NONE,
5353
},
5454
})
5555
}

packages/live-status-gateway/src/topics/helpers/playlist/playlistStatus.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { DBPart } from '@sofie-automation/corelib/dist/dataModel/Part'
2-
import { ActivePlaylistEvent, ActivePlaylistTimingMode } from '@sofie-automation/live-status-gateway-api'
2+
import { ActivePlaylistEvent, RundownPlaylistTimingMode } from '@sofie-automation/live-status-gateway-api'
33
import { literal, unprotectString } from '@sofie-automation/server-core-integration'
44
import { DBPartInstance } from '@sofie-automation/corelib/dist/dataModel/PartInstance'
55
import { DBRundownPlaylist } from '@sofie-automation/corelib/dist/dataModel/RundownPlaylist'
@@ -99,7 +99,7 @@ export function toPlaylistStatus(props: PlaylistStatusCache): ActivePlaylistEven
9999
quickLoop: undefined,
100100
publicData: undefined,
101101
timing: {
102-
timingMode: ActivePlaylistTimingMode.NONE,
102+
timingMode: RundownPlaylistTimingMode.NONE,
103103
},
104104
})
105105
}

packages/live-status-gateway/src/topics/helpers/playlist/timing.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
import { PlaylistTimingType, RundownPlaylistTiming } from '@sofie-automation/blueprints-integration'
2-
import { ActivePlaylistTimingMode, ActivePlaylistTiming } from '@sofie-automation/live-status-gateway-api'
2+
import {
3+
RundownPlaylistTiming as RundownPlaylistTimingStatus,
4+
RundownPlaylistTimingMode,
5+
} from '@sofie-automation/live-status-gateway-api'
36
import { assertNever } from '@sofie-automation/server-core-integration'
47

5-
export function translatePlaylistTimingType(type: PlaylistTimingType): ActivePlaylistTimingMode {
8+
export function translatePlaylistTimingType(type: PlaylistTimingType): RundownPlaylistTimingMode {
69
switch (type) {
710
case PlaylistTimingType.None:
8-
return ActivePlaylistTimingMode.NONE
11+
return RundownPlaylistTimingMode.NONE
912
case PlaylistTimingType.BackTime:
10-
return ActivePlaylistTimingMode.BACK_MINUS_TIME
13+
return RundownPlaylistTimingMode.BACK_MINUS_TIME
1114
case PlaylistTimingType.ForwardTime:
12-
return ActivePlaylistTimingMode.FORWARD_MINUS_TIME
15+
return RundownPlaylistTimingMode.FORWARD_MINUS_TIME
1316
default:
1417
assertNever(type)
1518
// Cast and return the value anyway, so that the application works
16-
return type as any as ActivePlaylistTimingMode
19+
return type as any as RundownPlaylistTimingMode
1720
}
1821
}
1922

20-
export function toPlaylistTiming(timing: RundownPlaylistTiming & { startedPlayback?: number }): ActivePlaylistTiming {
23+
export function toPlaylistTiming(
24+
timing: RundownPlaylistTiming & { startedPlayback?: number }
25+
): RundownPlaylistTimingStatus {
2126
const timingMode = translatePlaylistTimingType(timing.type)
2227

2328
const base = {

0 commit comments

Comments
 (0)