Skip to content

Commit 64e7ca6

Browse files
committed
chore: add expected duration to all part types
1 parent 05b66a3 commit 64e7ca6

File tree

12 files changed

+54
-6
lines changed

12 files changed

+54
-6
lines changed

packages/live-status-gateway-api/api/components/part/extendedPartStatus/extendedPartStatus-example.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ invalidReason:
1212
pieces:
1313
- $ref: '../../piece/extendedPieceStatus/extendedPieceStatus-example.yaml'
1414
floated: false
15+
expectedDuration: 200

packages/live-status-gateway-api/api/components/part/extendedPartStatus/extendedPartStatus.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ $defs:
3434
floated:
3535
description: When the NRCS informs us that the producer marked the part as floated, we can prevent the user from TAKE'ing and NEXT'ing it, but still have it visible and allow manipulation
3636
type: boolean
37+
expectedDuration:
38+
description: Expected duration of the part, in milliseconds
39+
type: number
3740
pieces:
3841
description: All pieces in this part
3942
type: array

packages/live-status-gateway-api/api/components/part/partStatus/partStatus-example.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ pieces:
44
- $ref: '../../piece/pieceStatus/pieceStatus.yaml#/$defs/pieceStatus/examples/0'
55
publicData:
66
partType: 'intro'
7+
expectedDuration: 200

packages/live-status-gateway-api/api/components/part/partStatus/partStatus.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ $defs:
1515
type: array
1616
items:
1717
$ref: '../../piece/pieceStatus/pieceStatus.yaml#/$defs/pieceStatus'
18+
expectedDuration:
19+
description: Expected duration of the part, in milliseconds
20+
type: number
1821
publicData:
1922
description: Optional arbitrary data
2023
required: [id, name, segmentId, pieces]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
startMs: 1600000060000
22
durationMs: 1600000075000
33
lifespan: part-only
4+
isAbsolute: true

packages/live-status-gateway-api/api/components/timing/pieceTiming/pieceTiming.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ $defs:
1010
durationMs:
1111
description: The duration of the piece (milliseconds).
1212
type: number
13+
isAbsolute:
14+
description: Some pieces can be timed to be absolute (using wall time) rather than relative to the part
15+
type: boolean
1316
lifespan:
1417
$ref: '../pieceLifespan/pieceLifespan.yaml'
1518
required: [startMs, lifespan]

packages/live-status-gateway-api/scripts/generate-schema-types.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ if (!asyncApiDoc.document) {
6767
const filteredDiagnostics = asyncApiDoc.diagnostics.filter((d) => d.code !== 'asyncapi-latest-version')
6868

6969
console.error('No document was produced from the asyncapi parser')
70-
console.error(JSON.stringify(asyncApiDoc.diagnostics))
70+
console.error(JSON.stringify(asyncApiDoc.diagnostics, null, 2))
7171

7272
// eslint-disable-next-line n/no-process-exit
7373
process.exit(5)

packages/live-status-gateway-api/src/generated/asyncapi.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,9 @@ channels:
444444
- camera
445445
publicData:
446446
switcherSource: 1
447+
expectedDuration:
448+
description: Expected duration of the part, in milliseconds
449+
type: number
447450
publicData:
448451
description: Optional arbitrary data
449452
required:
@@ -458,6 +461,7 @@ channels:
458461
- *a13
459462
publicData: &a16
460463
partType: intro
464+
expectedDuration: 200
461465
id: H5CBGYjThrMSmaYvRaa5FVKJIzk_
462466
name: Intro
463467
autoNext: false
@@ -505,6 +509,7 @@ channels:
505509
segmentId: n1mOVd5_K5tt4sfk6HYfTuwumGQ_
506510
pieces: *a15
507511
publicData: *a16
512+
expectedDuration: 200
508513
id: H5CBGYjThrMSmaYvRaa5FVKJIzk_
509514
name: Intro
510515
autoNext: false
@@ -937,6 +942,9 @@ channels:
937942
but still have it visible and
938943
allow manipulation
939944
type: boolean
945+
expectedDuration:
946+
description: Expected duration of the part, in milliseconds
947+
type: number
940948
pieces:
941949
description: All pieces in this part
942950
type: array
@@ -987,6 +995,11 @@ channels:
987995
durationMs:
988996
description: The duration of the piece (milliseconds).
989997
type: number
998+
isAbsolute:
999+
description: Some pieces can be timed to be absolute (using wall time) rather
1000+
than relative to the
1001+
part
1002+
type: boolean
9901003
lifespan:
9911004
type: string
9921005
title: PieceLifespan
@@ -1006,6 +1019,7 @@ channels:
10061019
startMs: 1600000060000
10071020
durationMs: 1600000075000
10081021
lifespan: part-only
1022+
isAbsolute: true
10091023
required:
10101024
- id
10111025
- name

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ interface CurrentPartStatus {
210210
* All pieces in this part
211211
*/
212212
pieces: PieceStatus[]
213+
/**
214+
* Expected duration of the part, in milliseconds
215+
*/
216+
expectedDuration?: number
213217
/**
214218
* Optional arbitrary data
215219
*/
@@ -357,6 +361,10 @@ interface PartStatus {
357361
* All pieces in this part
358362
*/
359363
pieces: PieceStatus[]
364+
/**
365+
* Expected duration of the part, in milliseconds
366+
*/
367+
expectedDuration?: number
360368
/**
361369
* Optional arbitrary data
362370
*/
@@ -627,6 +635,10 @@ interface ExtendedPartStatus {
627635
* When the NRCS informs us that the producer marked the part as floated, we can prevent the user from TAKE'ing and NEXT'ing it, but still have it visible and allow manipulation
628636
*/
629637
floated?: boolean
638+
/**
639+
* Expected duration of the part, in milliseconds
640+
*/
641+
expectedDuration?: number
630642
/**
631643
* All pieces in this part
632644
*/
@@ -708,6 +720,10 @@ interface PieceTiming {
708720
* The duration of the piece (milliseconds).
709721
*/
710722
durationMs?: number
723+
/**
724+
* Some pieces can be timed to be absolute (using wall time) rather than relative to the part
725+
*/
726+
isAbsolute?: boolean
711727
/**
712728
* Whether and how the piece is infinite
713729
*/

packages/live-status-gateway/src/topics/helpers/part/partStatus.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
PartStatus,
77
} from '@sofie-automation/live-status-gateway-api'
88
import { literal, unprotectString } from '@sofie-automation/server-core-integration'
9-
import { calculateCurrentPartTiming } from '../partTiming.js'
9+
import { calculateCurrentPartInstanceTiming } from '../partTiming.js'
1010
import { toExtendedPieceStatus, toPieceStatus } from '../pieceStatus.js'
1111
import { ExtendedPlaylistStatusCache, PlaylistStatusCache } from '../playlist/playlistStatus.js'
1212
import { interpollateTranslation } from '@sofie-automation/corelib/dist/TranslatableMessage'
@@ -20,7 +20,10 @@ export function toCurrentPartStatus(cache: PlaylistStatusCache, part: DBPart | n
2020

2121
return literal<CurrentPartStatus>({
2222
...base,
23-
timing: calculateCurrentPartTiming(cache.currentPartInstance, cache.partInstancesInCurrentSegment ?? []),
23+
timing: calculateCurrentPartInstanceTiming(
24+
cache.currentPartInstance,
25+
cache.partInstancesInCurrentSegment ?? []
26+
),
2427
})
2528
}
2629

@@ -30,14 +33,15 @@ export function toPartStatus(
3033
): PartStatus | null {
3134
if (!part) return null
3235

33-
const base = {
36+
const base = literal<PartStatus>({
3437
id: unprotectString(part._id),
3538
name: part.title,
3639
autoNext: part.autoNext ?? false,
3740
segmentId: unprotectString(part.segmentId),
3841
pieces: (pieceInstancesInCurrentPartInstance ?? []).map((piece) => toPieceStatus(piece, showStyleBaseExt)),
3942
publicData: part.publicData,
40-
}
43+
expectedDuration: part.expectedDuration,
44+
})
4145

4246
return literal<PartStatus>(base)
4347
}
@@ -64,6 +68,7 @@ export function toExtendedPartStatus(
6468
toExtendedPieceStatus(piece, showStyleBaseExt)
6569
),
6670
publicData: part.publicData,
71+
expectedDuration: part.expectedDuration,
6772
})
6873
}
6974

0 commit comments

Comments
 (0)