Skip to content

Commit 3f9e1f5

Browse files
committed
wip
1 parent 5450d6e commit 3f9e1f5

File tree

3 files changed

+15
-34
lines changed

3 files changed

+15
-34
lines changed

meteor/server/publications/packageManager/expectedPackages/generate.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { PackageContainerOnPackage, Accessor, AccessorOnPackage } from '@sofie-automation/blueprints-integration'
2-
import { getExpectedPackageId } from '@sofie-automation/corelib/dist/dataModel/ExpectedPackages'
2+
import { getExpectedPackageIdForPieceInstance } from '@sofie-automation/corelib/dist/dataModel/ExpectedPackages'
33
import { PeripheralDeviceId, ExpectedPackageId, PieceInstanceId } from '@sofie-automation/corelib/dist/dataModel/Ids'
44
import { protectString, unprotectString } from '@sofie-automation/corelib/dist/protectedString'
55
import {
@@ -119,7 +119,10 @@ export async function updateCollectionForPieceInstanceIds(
119119
if (!pieceInstanceDoc.piece?.expectedPackages) continue
120120

121121
pieceInstanceDoc.piece.expectedPackages.forEach((expectedPackage, i) => {
122-
const sanitisedPackageId = getExpectedPackageId(pieceInstanceId, expectedPackage._id || '__unnamed' + i)
122+
const sanitisedPackageId = getExpectedPackageIdForPieceInstance(
123+
pieceInstanceId,
124+
expectedPackage._id || '__unnamed' + i
125+
)
123126

124127
// Map the expectedPackages onto their specified layer:
125128
const allDeviceIds = new Set<PeripheralDeviceId>()

meteor/server/publications/pieceContentStatusUI/checkPieceContentStatus.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from '@sofie-automation/blueprints-integration'
1313
import {
1414
ExpectedPackageDBType,
15-
getExpectedPackageId,
15+
getExpectedPackageIdForPieceInstance,
1616
getExpectedPackageIdFromIngestSource,
1717
} from '@sofie-automation/corelib/dist/dataModel/ExpectedPackages'
1818
import {
@@ -657,7 +657,9 @@ async function checkPieceContentExpectedPackageStatus(
657657
]
658658
if (piece.pieceInstanceId) {
659659
// If this is a PieceInstance, try looking up the PieceInstance first
660-
expectedPackageIds.unshift(getExpectedPackageId(piece.pieceInstanceId, expectedPackage._id))
660+
expectedPackageIds.unshift(
661+
getExpectedPackageIdForPieceInstance(piece.pieceInstanceId, expectedPackage._id)
662+
)
661663
}
662664

663665
let warningMessage: ContentMessageLight | null = null

packages/corelib/src/dataModel/ExpectedPackages.ts

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,14 @@ import {
1818
import { ReadonlyDeep } from 'type-fest'
1919

2020
/*
21-
Expected Packages are created from Pieces in the rundown.
21+
Expected Packages are created from Pieces and other content in the rundown.
2222
A "Package" is a generic term for a "thing that can be played", such as media files, audio, graphics etc..
2323
The blueprints generate Pieces with expectedPackages on them.
2424
These are then picked up by a Package Manager who then tries to fullfill the expectations.
2525
Example: An ExpectedPackage could be a "Media file to be present on the location used by a playout device".
2626
The Package Manager will then copy the file to the right place.
2727
*/
2828

29-
// export type ExpectedPackageFromRundown = ExpectedPackageDBFromPiece | ExpectedPackageDBFromAdLibAction
30-
31-
// export type ExpectedPackageFromRundownBaseline =
32-
// | ExpectedPackageDBFromBaselineAdLibAction
33-
// | ExpectedPackageDBFromBaselineAdLibPiece
34-
// | ExpectedPackageDBFromRundownBaselineObjects
35-
36-
// export type ExpectedPackageDBFromBucket = ExpectedPackageDBFromBucketAdLib | ExpectedPackageDBFromBucketAdLibAction
37-
38-
// export type ExpectedPackageDB =
39-
// | ExpectedPackageFromRundown
40-
// | ExpectedPackageDBFromBucket
41-
// | ExpectedPackageFromRundownBaseline
42-
// | ExpectedPackageDBFromStudioBaselineObjects
43-
4429
export enum ExpectedPackageDBType {
4530
PIECE = 'piece',
4631
ADLIB_PIECE = 'adlib_piece',
@@ -53,19 +38,6 @@ export enum ExpectedPackageDBType {
5338
STUDIO_BASELINE_OBJECTS = 'studio_baseline_objects',
5439
}
5540

56-
/*
57-
* What about this new concept. The aim here is to avoid the constant inserting and deleting of expectedPackages during playout, and avoiding duplicate packages with the same content.
58-
* The idea is to have a single expectedPackage for each 'content'.
59-
* Ingest will 'deduplicate' the packages produced by the blueprints, with playout able to reference them with pieceInstanceIds.
60-
*
61-
* During the ingest save phase, it will need to reload the `playoutSources` property, in case it has changed. And if there are uses remaining, it will need to keep the package after clearing the `ingestSources`.
62-
* During playout operations, pieceInstanceIds will be added and removed as needed. If there remains no sources (of either type), then the document can be removed. If an in-progress ingest tried to reclaim it, it will get reinserted.
63-
*
64-
* Playout can then load just the ones referenced by piece instances, and just before it needs to use them (for bluerpint types or something), can ensure that everything needed has been loaded.
65-
* During a take, any packages referenced by the previous(?) partinstance must be removed.
66-
* When doing a reset of the rundown, all playout references must be removed.
67-
* When inserting/removing pieceinstances, the expectedPackages must be updated.
68-
*/
6941
export interface ExpectedPackageDBNew {
7042
_id: ExpectedPackageId // derived from rundownId and hash of `package`
7143

@@ -159,7 +131,11 @@ export type ExpectedPackageIngestSource =
159131
| ExpectedPackageIngestSourceBucket
160132
| ExpectedPackageIngestSourceStudioBaseline
161133

162-
export function getExpectedPackageId(
134+
/**
135+
* Generate the expectedPackageId for the given piece instance.
136+
* Note: This will soon be replaced with a new flow based on the contentVersionHash once shared ownership is implemented.
137+
*/
138+
export function getExpectedPackageIdForPieceInstance(
163139
/** _id of the owner (the piece, adlib etc..) */
164140
ownerId: PieceInstanceId,
165141
// | AdLibActionId

0 commit comments

Comments
 (0)