Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import {
} from '@sofie-automation/meteor-lib/dist/collections/ExpectedPackages'
import { getActiveRoutes, getRoutedMappings } from '@sofie-automation/meteor-lib/dist/collections/Studios'
import { ensureHasTrailingSlash, unprotectString } from '../../lib/tempLib'
import { PieceContentStatusObj } from '@sofie-automation/meteor-lib/dist/api/pieceContentStatus'
import { MediaObjects, PackageContainerPackageStatuses, PackageInfos } from '../../collections'
import {
mediaObjectFieldSpecifier,
Expand All @@ -46,6 +45,7 @@ import {
PackageInfoLight,
PieceDependencies,
} from './common'
import { PieceContentStatusObj } from '@sofie-automation/corelib/dist/dataModel/PieceContentStatus'
import { PieceContentStatusMessageFactory, PieceContentStatusMessageRequiredArgs } from './messageFactory'
import { PackageStatusMessage } from '@sofie-automation/shared-lib/dist/packageStatusMessages'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import {
} from '@sofie-automation/corelib/dist/dataModel/Ids'
import { MongoFieldSpecifierOnesStrict } from '@sofie-automation/corelib/dist/mongo'
import { ReadonlyDeep } from 'type-fest'
import { CustomCollectionName, MeteorPubSub } from '@sofie-automation/meteor-lib/dist/api/pubsub'
import { UIPieceContentStatus } from '@sofie-automation/meteor-lib/dist/api/rundownNotifications'
import { UIPieceContentStatus } from '@sofie-automation/corelib/dist/dataModel/PieceContentStatus'
import { DBRundownPlaylist } from '@sofie-automation/corelib/dist/dataModel/RundownPlaylist'
import {
MediaObjects,
Expand Down Expand Up @@ -58,6 +57,8 @@ import { PieceContentStatusStudio } from '../checkPieceContentStatus'
import { check, Match } from 'meteor/check'
import { DBPartInstance } from '@sofie-automation/corelib/dist/dataModel/PartInstance'
import { triggerWriteAccessBecauseNoCheckNecessary } from '../../../security/securityVerify'
import { CorelibPubSub } from '@sofie-automation/corelib/dist/pubsub'
import { CustomCollectionName } from '@sofie-automation/corelib/dist/dataModel/Collections'
import { PieceContentStatusMessageFactory } from '../messageFactory'

interface UIPieceContentStatusesArgs {
Expand Down Expand Up @@ -495,15 +496,15 @@ function updatePartAndSegmentInfoForExistingDocs(
}

meteorCustomPublish(
MeteorPubSub.uiPieceContentStatuses,
CorelibPubSub.uiPieceContentStatuses,
CustomCollectionName.UIPieceContentStatuses,
async function (pub, rundownPlaylistId: RundownPlaylistId | null) {
check(rundownPlaylistId, Match.Maybe(String))

triggerWriteAccessBecauseNoCheckNecessary()

if (!rundownPlaylistId) {
logger.info(`Pub.${CustomCollectionName.UISegmentPartNotes}: Not playlistId`)
logger.info(`Pub.${CustomCollectionName.UIPieceContentStatuses}: Not playlistId`)
return
}

Expand All @@ -513,7 +514,7 @@ meteorCustomPublish(
UIPieceContentStatusesState,
UIPieceContentStatusesUpdateProps
>(
`pub_${MeteorPubSub.uiPieceContentStatuses}_${rundownPlaylistId}`,
`pub_${CorelibPubSub.uiPieceContentStatuses}_${rundownPlaylistId}`,
{ rundownPlaylistId },
setupUIPieceContentStatusesPublicationObservers,
manipulateUIPieceContentStatusesPublicationData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
RundownId,
} from '@sofie-automation/corelib/dist/dataModel/Ids'
import { ReadonlyDeep } from 'type-fest'
import { UIPieceContentStatus } from '@sofie-automation/meteor-lib/dist/api/rundownNotifications'
import { UIPieceContentStatus } from '@sofie-automation/corelib/dist/dataModel/PieceContentStatus'
import { literal, protectString } from '../../../lib/tempLib'
import { CustomPublishCollection } from '../../../lib/customPublication'
import { ContentCache } from './reactiveContentCache'
Expand Down
7 changes: 7 additions & 0 deletions packages/corelib/src/dataModel/Collections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,10 @@ export enum CollectionName {
Workers = 'workers',
WorkerThreads = 'workersThreads',
}

/**
* Ids of possible Custom collections, populated by DDP subscriptions
*/
export enum CustomCollectionName {
UIPieceContentStatuses = 'uiPieceContentStatuses',
}
50 changes: 50 additions & 0 deletions packages/corelib/src/dataModel/PieceContentStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { ITranslatableMessage, PackageInfo } from '@sofie-automation/blueprints-integration'
import { ProtectedString } from '../protectedString'
import {
RundownId,
PartId,
SegmentId,
PieceId,
AdLibActionId,
RundownBaselineAdLibActionId,
PieceInstanceId,
} from './Ids'
import { PieceStatusCode } from './Piece'

export type UIPieceContentStatusId = ProtectedString<'UIPieceContentStatus'>
export interface UIPieceContentStatus {
_id: UIPieceContentStatusId

segmentRank: number
partRank: number

rundownId: RundownId
partId: PartId | undefined
segmentId: SegmentId | undefined

pieceId: PieceId | AdLibActionId | RundownBaselineAdLibActionId | PieceInstanceId
isPieceInstance: boolean

name: string | ITranslatableMessage
segmentName: string | undefined

status: PieceContentStatusObj
}

export interface PieceContentStatusObj {
status: PieceStatusCode
messages: ITranslatableMessage[]

freezes: Array<PackageInfo.Anomaly>
blacks: Array<PackageInfo.Anomaly>
scenes: Array<number>

thumbnailUrl: string | undefined
previewUrl: string | undefined

packageName: string | null

contentDuration: number | undefined

progress: number | undefined
}
17 changes: 16 additions & 1 deletion packages/corelib/src/pubsub.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DBPart } from './dataModel/Part'
import { CollectionName } from './dataModel/Collections'
import { CollectionName, CustomCollectionName } from './dataModel/Collections'
import { MongoQuery } from './mongo'
import { AdLibAction } from './dataModel/AdlibAction'
import { AdLibPiece } from './dataModel/AdLibPiece'
Expand Down Expand Up @@ -37,6 +37,7 @@ import {
} from '@sofie-automation/shared-lib/dist/core/model/Ids'
import { BlueprintId, BucketId, RundownPlaylistActivationId, SegmentId, ShowStyleVariantId } from './dataModel/Ids'
import { PackageInfoDB } from './dataModel/PackageInfos'
import { UIPieceContentStatus } from './dataModel/PieceContentStatus'

/**
* Ids of possible DDP subscriptions for any the UI and gateways accessing the Rundown & RundownPlaylist model.
Expand Down Expand Up @@ -180,6 +181,12 @@ export enum CorelibPubSub {
* Fetch all the PackageInfos owned by a PeripheralDevice
*/
packageInfos = 'packageInfos',

/**
* Fetch the Pieces content-status in the given RundownPlaylist
* If the id is null, nothing will be returned
*/
uiPieceContentStatuses = 'uiPieceContentStatuses',
}

/**
Expand Down Expand Up @@ -317,6 +324,10 @@ export interface CorelibPubSubTypes {
token?: string
) => CollectionName.PackageContainerStatuses
[CorelibPubSub.packageInfos]: (deviceId: PeripheralDeviceId, token?: string) => CollectionName.PackageInfos

[CorelibPubSub.uiPieceContentStatuses]: (
rundownPlaylistId: RundownPlaylistId | null
) => CustomCollectionName.UIPieceContentStatuses
}

export type CorelibPubSubCollections = {
Expand Down Expand Up @@ -347,4 +358,8 @@ export type CorelibPubSubCollections = {
[CollectionName.Studios]: DBStudio
[CollectionName.Timelines]: TimelineComplete
[CollectionName.TimelineDatastore]: DBTimelineDatastoreEntry
} & CorelibPubSubCustomCollections

export type CorelibPubSubCustomCollections = {
[CustomCollectionName.UIPieceContentStatuses]: UIPieceContentStatus
}
7 changes: 7 additions & 0 deletions packages/live-status-gateway/api/asyncapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ channels:
- $ref: '#/components/messages/activePieces'
- $ref: '#/components/messages/segments'
- $ref: '#/components/messages/adLibs'
- $ref: '#/components/messages/packages'
components:
messages:
ping:
Expand Down Expand Up @@ -124,3 +125,9 @@ components:
description: AdLibs in active Playlist
payload:
$ref: './schemas/adLibs.yaml#/$defs/adLibs'
packages:
name: packages
messageId: packages
description: Status of Packages expected by Pieces
payload:
$ref: './schemas/packages.yaml#/$defs/packages'
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $defs:
description: User-presentable name for the active playlist
type: string
rundownIds:
description: The set of rundownIds in the active playlist
description: The set of rundownIds in the active playlist, in order
type: array
items:
type: string
Expand Down
79 changes: 79 additions & 0 deletions packages/live-status-gateway/api/schemas/packages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
title: Packages
description: Packages schema for websocket subscriptions. Packages are assets that need to be prepared by Sofie Package Manager or third-party systems to make AdLibs and Pieces playable.
$defs:
packages:
type: object
properties:
event:
type: string
const: packages
rundownPlaylistId:
description: Unique id of the rundown playlist, or null if no playlist is active
oneOf:
- type: string
- type: 'null'
packages:
description: The Package statuses for this playlist
type: array
items:
$ref: '#/$defs/package'
required: [event, rundownPlaylistId, packages]
additionalProperties: false
examples:
- event: packages
rundownPlaylistId: 'OKAgZmZ0Buc99lE_2uPPSKVbMrQ_'
packages:
$ref: '#/$defs/package/examples'
package:
type: object
properties:
packageName:
description: Name of the package
type: string
status:
type: string
enum:
- unknown
- ok
- source_broken
- source_has_issues
- source_missing
- source_not_ready
- source_not_set
- source_unknown_state
description: |
Status:
* `unknown` - status not determined (yet)
* `ok` - no faults, can be played
* `source_broken` - the source is present, but should not be played due to a technical malfunction (file is broken, camera robotics failed, REMOTE input is just bars, etc.)
* `source_has_issues` - technically it can be played, but some issues with it were detected
* `source_missing` - the source (file, live input) is missing and cannot be played
* `source_not_ready` - can't be played for a non-technical reason (e.g. a placeholder clip with no content)
* `source_not_set` - missing a file path
* `source_unknown_state` - reported, but unrecognized state
rundownId:
description: Id of the Rundown that a Piece (or AdLib) expecting this package belongs to
type: string
partId:
description: Id of the Part that a Piece (or AdLib) expecting this package belongs to. It could be an Id of a Part from the Active Playlist topic, or a Part not exposed otherwise by the LSG.
type: string
segmentId:
description: Id of the Segment that a Piece (or AdLib) expecting this package belongs to
type: string
pieceOrAdLibId:
description: Id of the Piece or AdLib that expects this package. It could be an Id of a Piece from the Active Pieces and Active Playlist topics, or an Id of an AdLib from the AdLibs topic. It could also be an Id of a Piece not exposed otherwise by the LSG, but still relevant, e.g. to summarize the status of packages within a specific Part/Segment.
type: string
thumbnailUrl:
description: URL where the thumbnail can be accessed
type: string
previewUrl:
description: URL where the preview can be accessed
type: string
required: [status, rundownId, pieceOrAdLibId]
additionalProperties: false
examples:
- packageName: 'MV000123.mxf'
status: ok
rundownId: 'y9HauyWkcxQS3XaAOsW40BRLLsI_'
pieceOrAdLibId: 'C6K_yIMuGFUk8X_L9A9_jRT6aq4_'
thumbnailUrl: 'https://package-manager.local/package/MV000123.mov_thumbnail.jpg'
Loading
Loading