diff --git a/meteor/client/lib/__tests__/rundown.test.ts b/meteor/client/lib/__tests__/rundown.test.ts index 4a000a1449..87fbca6fa2 100644 --- a/meteor/client/lib/__tests__/rundown.test.ts +++ b/meteor/client/lib/__tests__/rundown.test.ts @@ -53,7 +53,6 @@ describe('client/lib/rundown', () => { [], new Map(), parts.map((part) => part._id), - new Map(), currentPartInstance, nextPartInstance ) @@ -115,7 +114,6 @@ describe('client/lib/rundown', () => { [], new Map(), parts.map((part) => part._id), - new Map(), currentPartInstance, nextPartInstance ) @@ -201,7 +199,6 @@ describe('client/lib/rundown', () => { [], new Map(), parts.map((part) => part._id), - new Map(), currentPartInstance, nextPartInstance ) @@ -364,7 +361,6 @@ describe('client/lib/rundown', () => { [], new Map(), parts.map((part) => part._id), - new Map(), currentPartInstance, nextPartInstance ) diff --git a/meteor/client/lib/__tests__/rundownTiming.test.ts b/meteor/client/lib/__tests__/rundownTiming.test.ts index 74b59fbf89..a36aa68f77 100644 --- a/meteor/client/lib/__tests__/rundownTiming.test.ts +++ b/meteor/client/lib/__tests__/rundownTiming.test.ts @@ -5,9 +5,8 @@ import { DBSegment } from '../../../lib/collections/Segments' import { DBRundown } from '../../../lib/collections/Rundowns' import { literal, protectString } from '../../../lib/lib' import { RundownTimingCalculator, RundownTimingContext } from '../rundownTiming' -import { IBlueprintPieceType, PlaylistTimingType } from '@sofie-automation/blueprints-integration' +import { PlaylistTimingType } from '@sofie-automation/blueprints-integration' import { PartId, RundownId, SegmentId } from '@sofie-automation/corelib/dist/dataModel/Ids' -import { CalculateTimingsPiece } from '@sofie-automation/corelib/dist/playout/timings' const DEFAULT_DURATION = 0 const DEFAULT_NONZERO_DURATION = 4000 @@ -112,7 +111,6 @@ describe('rundown Timing Calculator', () => { undefined, parts, partInstancesMap, - new Map(), segmentsMap, DEFAULT_DURATION, [] @@ -175,7 +173,6 @@ describe('rundown Timing Calculator', () => { undefined, parts, partInstancesMap, - new Map(), segmentsMap, DEFAULT_DURATION, [] @@ -277,7 +274,6 @@ describe('rundown Timing Calculator', () => { undefined, parts, partInstancesMap, - new Map(), segmentsMap, DEFAULT_DURATION, [] @@ -381,7 +377,6 @@ describe('rundown Timing Calculator', () => { undefined, parts, partInstancesMap, - new Map(), segmentsMap, DEFAULT_DURATION, [] @@ -509,7 +504,6 @@ describe('rundown Timing Calculator', () => { undefined, parts, partInstancesMap, - new Map(), segmentsMap, DEFAULT_DURATION, [] @@ -612,7 +606,6 @@ describe('rundown Timing Calculator', () => { undefined, parts, partInstancesMap, - new Map(), segmentsMap, DEFAULT_NONZERO_DURATION, [] @@ -743,7 +736,6 @@ describe('rundown Timing Calculator', () => { undefined, parts, partInstancesMap, - new Map(), segmentsMap, DEFAULT_NONZERO_DURATION, [] @@ -868,7 +860,6 @@ describe('rundown Timing Calculator', () => { undefined, parts, partInstancesMap, - new Map(), segmentsMap, DEFAULT_DURATION, [] @@ -943,127 +934,6 @@ describe('rundown Timing Calculator', () => { ) }) - it('Adds Piece preroll to Part durations', () => { - const timing = new RundownTimingCalculator() - const playlist: RundownPlaylist = makeMockPlaylist() - playlist.timing = { - type: 'forward-time' as any, - expectedStart: 0, - expectedDuration: 40000, - } - const rundownId = 'rundown1' - const segmentId1 = 'segment1' - const segmentId2 = 'segment2' - const segmentsMap: Map = new Map() - segmentsMap.set(protectString(segmentId1), makeMockSegment(segmentId1, 0, rundownId)) - segmentsMap.set(protectString(segmentId2), makeMockSegment(segmentId2, 0, rundownId)) - const parts: Part[] = [] - parts.push(makeMockPart('part1', 0, rundownId, segmentId1, { expectedDuration: 1000 })) - parts.push(makeMockPart('part2', 0, rundownId, segmentId1, { expectedDuration: 1000 })) - parts.push(makeMockPart('part3', 0, rundownId, segmentId2, { expectedDuration: 1000 })) - parts.push(makeMockPart('part4', 0, rundownId, segmentId2, { expectedDuration: 1000 })) - const piecesMap: Map = new Map() - piecesMap.set(protectString('part1'), [ - literal({ - enable: { - start: 0, - }, - prerollDuration: 5000, - pieceType: IBlueprintPieceType.Normal, - }), - ]) - piecesMap.set(protectString('part2'), [ - literal({ - enable: { - start: 0, - }, - prerollDuration: 240, - pieceType: IBlueprintPieceType.Normal, - }), - ]) - const partInstancesMap: Map = new Map() - const rundown = makeMockRundown(rundownId, playlist) - const rundowns = [rundown] - const result = timing.updateDurations( - 0, - false, - playlist, - rundowns, - undefined, - parts, - partInstancesMap, - piecesMap, - segmentsMap, - DEFAULT_DURATION, - [] - ) - expect(result).toEqual( - literal({ - isLowResolution: false, - asDisplayedPlaylistDuration: 9240, - asPlayedPlaylistDuration: 9240, - currentPartInstanceId: null, - currentPartWillAutoNext: false, - currentTime: 0, - rundownExpectedDurations: { - [rundownId]: 9240, - }, - rundownAsPlayedDurations: { - [rundownId]: 9240, - }, - partCountdown: { - part1: 0, - part2: 6000, - part3: 7240, - part4: 8240, - }, - partDisplayDurations: { - part1: 6000, - part2: 1240, - part3: 1000, - part4: 1000, - }, - partDisplayStartsAt: { - part1: 0, - part2: 6000, - part3: 7240, - part4: 8240, - }, - partDurations: { - part1: 6000, - part2: 1240, - part3: 1000, - part4: 1000, - }, - partExpectedDurations: { - part1: 6000, - part2: 1240, - part3: 1000, - part4: 1000, - }, - partPlayed: { - part1: 0, - part2: 0, - part3: 0, - part4: 0, - }, - partStartsAt: { - part1: 0, - part2: 6000, - part3: 7240, - part4: 8240, - }, - remainingPlaylistDuration: 9240, - totalPlaylistDuration: 9240, - breakIsLastRundown: undefined, - remainingTimeOnCurrentPart: undefined, - rundownsBeforeNextBreak: undefined, - segmentBudgetDurations: {}, - segmentStartedPlayback: {}, - }) - ) - }) - it('Back-time: Can find the next expectedStart rundown anchor when it is in a future segment', () => { const timing = new RundownTimingCalculator() const playlist: RundownPlaylist = makeMockPlaylist() @@ -1140,7 +1010,6 @@ describe('rundown Timing Calculator', () => { rundown, parts, partInstancesMap, - new Map(), segmentsMap, DEFAULT_DURATION, [] @@ -1289,7 +1158,6 @@ describe('rundown Timing Calculator', () => { rundown, parts, partInstancesMap, - new Map(), segmentsMap, DEFAULT_DURATION, [] @@ -1444,7 +1312,6 @@ describe('rundown Timing Calculator', () => { rundown, parts, partInstancesMap, - new Map(), segmentsMap, DEFAULT_DURATION, [] @@ -1593,7 +1460,6 @@ describe('rundown Timing Calculator', () => { rundown, parts, partInstancesMap, - new Map(), segmentsMap, DEFAULT_DURATION, [] @@ -1742,7 +1608,6 @@ describe('rundown Timing Calculator', () => { rundown, parts, partInstancesMap, - new Map(), segmentsMap, DEFAULT_DURATION, [] @@ -1897,7 +1762,6 @@ describe('rundown Timing Calculator', () => { rundown, parts, partInstancesMap, - new Map(), segmentsMap, DEFAULT_DURATION, [] diff --git a/meteor/client/lib/rundown.ts b/meteor/client/lib/rundown.ts index bc52c61166..0eb58e3043 100644 --- a/meteor/client/lib/rundown.ts +++ b/meteor/client/lib/rundown.ts @@ -36,10 +36,7 @@ import { FindOptions } from '../../lib/collections/lib' import { getShowHiddenSourceLayers } from './localStorage' import { Rundown } from '../../lib/collections/Rundowns' import { IStudioSettings } from '@sofie-automation/corelib/dist/dataModel/Studio' -import { - calculatePartInstanceExpectedDurationWithPreroll, - CalculateTimingsPiece, -} from '@sofie-automation/corelib/dist/playout/timings' +import { calculatePartInstanceExpectedDurationWithPreroll } from '@sofie-automation/corelib/dist/playout/timings' import { AdLibPieceUi } from './shelf' import { UIShowStyleBase } from '../../lib/api/showStyles' import { PartId, PieceId, RundownId, SegmentId, ShowStyleBaseId } from '@sofie-automation/corelib/dist/dataModel/Ids' @@ -59,17 +56,14 @@ export namespace RundownUtils { export function getSegmentDuration( parts: Array, - pieces: Map, + // pieces: Map, display?: boolean ): number { return parts.reduce((memo, part) => { return ( memo + (part.instance.timings?.duration || - calculatePartInstanceExpectedDurationWithPreroll( - part.instance, - pieces.get(part.instance.part._id) ?? [] - ) || + calculatePartInstanceExpectedDurationWithPreroll(part.instance) || part.renderedDuration || (display ? Settings.defaultDisplayDuration : 0)) ) @@ -205,7 +199,6 @@ export namespace RundownUtils { scrollLeft: number, scrollWidth: number, part: PartUi, - pieces: CalculateTimingsPiece[], partStartsAt: number | undefined, partDuration: number | undefined, piece?: PieceUi @@ -225,7 +218,7 @@ export namespace RundownUtils { ? part.instance.timings.duration + (part.instance.timings?.playOffset || 0) : (partDuration || part.renderedDuration || - calculatePartInstanceExpectedDurationWithPreroll(part.instance, pieces) || + calculatePartInstanceExpectedDurationWithPreroll(part.instance) || 0) - (piece.renderedInPoint || 0))) : part.instance.timings?.duration !== undefined ? part.instance.timings.duration + (part.instance.timings?.playOffset || 0) @@ -299,7 +292,6 @@ export namespace RundownUtils { rundownsBeforeThisInPlaylist: RundownId[], rundownsToShowstyles: Map, orderedAllPartIds: PartId[], - pieces: Map, currentPartInstance: PartInstance | undefined, nextPartInstance: PartInstance | undefined, pieceInstanceSimulation = false, @@ -430,10 +422,7 @@ export namespace RundownUtils { partsE = segmentInfo.partInstances.map((partInstance, itIndex) => { const partTimeline: SuperTimeline.TimelineObject[] = [] - const partExpectedDuration = calculatePartInstanceExpectedDurationWithPreroll( - partInstance, - pieces.get(partInstance.part._id) ?? [] - ) + const partExpectedDuration = calculatePartInstanceExpectedDurationWithPreroll(partInstance) // extend objects to match the Extended interface const partE = literal({ diff --git a/meteor/client/lib/rundownTiming.ts b/meteor/client/lib/rundownTiming.ts index 28f8430925..5fb0747e0d 100644 --- a/meteor/client/lib/rundownTiming.ts +++ b/meteor/client/lib/rundownTiming.ts @@ -14,10 +14,7 @@ import { PartId, PartInstanceId, SegmentId } from '@sofie-automation/corelib/dist/dataModel/Ids' import { literal } from '@sofie-automation/corelib/dist/lib' import { PlaylistTiming } from '@sofie-automation/corelib/dist/playout/rundownTiming' -import { - calculatePartInstanceExpectedDurationWithPreroll, - CalculateTimingsPiece, -} from '@sofie-automation/corelib/dist/playout/timings' +import { calculatePartInstanceExpectedDurationWithPreroll } from '@sofie-automation/corelib/dist/playout/timings' import { protectString, unprotectString } from '@sofie-automation/corelib/dist/protectedString' import { findPartInstanceInMapOrWrapToTemporary, @@ -99,7 +96,6 @@ export class RundownTimingCalculator { currentRundown: Rundown | undefined, parts: Part[], partInstancesMap: Map, - pieces: Map, segmentsMap: Map, /** Fallback duration for Parts that have no as-played duration of their own. */ defaultDuration: number = Settings.defaultDisplayDuration, @@ -173,7 +169,6 @@ export class RundownTimingCalculator { parts.forEach((origPart, itIndex) => { const partInstance = this.getPartInstanceOrGetCachedTemp(partInstancesMap, origPart) - const piecesForPart = pieces.get(partInstance.part._id) ?? [] if (partInstance.segmentId !== lastSegmentId) { this.untimedSegments.add(partInstance.segmentId) @@ -216,8 +211,7 @@ export class RundownTimingCalculator { // if the Part is using budgetDuration, this budget is calculated when going through all the segments // in the Rundown (see further down) if (!segmentUsesBudget && !partIsUntimed) { - totalRundownDuration += - calculatePartInstanceExpectedDurationWithPreroll(partInstance, piecesForPart) || 0 + totalRundownDuration += calculatePartInstanceExpectedDurationWithPreroll(partInstance) || 0 } const lastStartedPlayback = partInstance.timings?.plannedStartedPlayback @@ -231,7 +225,7 @@ export class RundownTimingCalculator { let displayDurationFromGroup = 0 partExpectedDuration = - calculatePartInstanceExpectedDurationWithPreroll(partInstance, piecesForPart) || + calculatePartInstanceExpectedDurationWithPreroll(partInstance) || partInstance.timings?.duration || 0 @@ -254,7 +248,7 @@ export class RundownTimingCalculator { ) { this.displayDurationGroups[partInstance.part.displayDurationGroup] = (this.displayDurationGroups[partInstance.part.displayDurationGroup] || 0) + - (calculatePartInstanceExpectedDurationWithPreroll(partInstance, piecesForPart) || 0) + (calculatePartInstanceExpectedDurationWithPreroll(partInstance) || 0) displayDurationFromGroup = partInstance.part.displayDuration || Math.max( @@ -278,9 +272,7 @@ export class RundownTimingCalculator { : undefined) partDuration = Math.max( - duration || - calculatePartInstanceExpectedDurationWithPreroll(partInstance, piecesForPart) || - 0, + duration || calculatePartInstanceExpectedDurationWithPreroll(partInstance) || 0, now - lastStartedPlayback ) - playOffset // because displayDurationGroups have no actual timing on them, we need to have a copy of the @@ -290,7 +282,7 @@ export class RundownTimingCalculator { duration || (memberOfDisplayDurationGroup ? displayDurationFromGroup - : calculatePartInstanceExpectedDurationWithPreroll(partInstance, piecesForPart)) || + : calculatePartInstanceExpectedDurationWithPreroll(partInstance)) || defaultDuration partDisplayDuration = Math.max(partDisplayDurationNoPlayback, now - lastStartedPlayback) this.partPlayed[unprotectString(partInstance.part._id)] = now - lastStartedPlayback @@ -312,7 +304,7 @@ export class RundownTimingCalculator { (duration || (memberOfDisplayDurationGroup ? displayDurationFromGroup - : calculatePartInstanceExpectedDurationWithPreroll(partInstance, piecesForPart)) || + : calculatePartInstanceExpectedDurationWithPreroll(partInstance)) || 0) - (now - lastStartedPlayback) ) @@ -320,7 +312,7 @@ export class RundownTimingCalculator { } else { partDuration = (partInstance.timings?.duration || - calculatePartInstanceExpectedDurationWithPreroll(partInstance, piecesForPart) || + calculatePartInstanceExpectedDurationWithPreroll(partInstance) || 0) - playOffset partDisplayDurationNoPlayback = Math.max( 0, @@ -328,7 +320,7 @@ export class RundownTimingCalculator { displayDurationFromGroup || ensureMinimumDefaultDurationIfNotAuto( partInstance, - calculatePartInstanceExpectedDurationWithPreroll(partInstance, piecesForPart), + calculatePartInstanceExpectedDurationWithPreroll(partInstance), defaultDuration ) ) @@ -352,7 +344,7 @@ export class RundownTimingCalculator { valToAddToAsPlayedDuration = partInstance.timings.duration } else if (partCounts) { valToAddToAsPlayedDuration = - calculatePartInstanceExpectedDurationWithPreroll(partInstance, piecesForPart) || 0 + calculatePartInstanceExpectedDurationWithPreroll(partInstance) || 0 } asPlayedRundownDuration += valToAddToAsPlayedDuration @@ -389,15 +381,15 @@ export class RundownTimingCalculator { memberOfDisplayDurationGroup ? Math.max( partExpectedDuration, - calculatePartInstanceExpectedDurationWithPreroll(partInstance, piecesForPart) || 0 + calculatePartInstanceExpectedDurationWithPreroll(partInstance) || 0 ) - : calculatePartInstanceExpectedDurationWithPreroll(partInstance, piecesForPart) || 0, + : calculatePartInstanceExpectedDurationWithPreroll(partInstance) || 0, now - lastStartedPlayback ) } else { asDisplayedRundownDuration += partInstance.timings?.duration || - calculatePartInstanceExpectedDurationWithPreroll(partInstance, piecesForPart) || + calculatePartInstanceExpectedDurationWithPreroll(partInstance) || 0 } @@ -441,12 +433,12 @@ export class RundownTimingCalculator { waitDuration = partInstance.timings?.duration || partDisplayDuration || - calculatePartInstanceExpectedDurationWithPreroll(partInstance, piecesForPart) || + calculatePartInstanceExpectedDurationWithPreroll(partInstance) || 0 } else { waitDuration = partInstance.timings?.duration || - calculatePartInstanceExpectedDurationWithPreroll(partInstance, piecesForPart) || + calculatePartInstanceExpectedDurationWithPreroll(partInstance) || 0 } if (segmentUsesBudget) { @@ -470,8 +462,7 @@ export class RundownTimingCalculator { // this needs to use partInstance.part.expectedDuration as opposed to partExpectedDuration, because // partExpectedDuration is affected by displayGroups, and if it hasn't played yet then it shouldn't // add any duration to the "remaining" time pool - remainingRundownDuration += - calculatePartInstanceExpectedDurationWithPreroll(partInstance, piecesForPart) || 0 + remainingRundownDuration += calculatePartInstanceExpectedDurationWithPreroll(partInstance) || 0 // item is onAir right now, and it's is currently shorter than expectedDuration } else if ( lastStartedPlayback && @@ -603,13 +594,12 @@ export class RundownTimingCalculator { if (currentAIndex >= 0) { const currentLivePart = parts[currentAIndex] const currentLivePartInstance = findPartInstanceInMapOrWrapToTemporary(partInstancesMap, currentLivePart) - const piecesForPart = pieces.get(currentLivePartInstance.part._id) ?? [] const lastStartedPlayback = currentLivePartInstance.timings?.plannedStartedPlayback let onAirPartDuration = currentLivePartInstance.timings?.duration || - calculatePartInstanceExpectedDurationWithPreroll(currentLivePartInstance, piecesForPart) || + calculatePartInstanceExpectedDurationWithPreroll(currentLivePartInstance) || 0 if ( currentLivePart.displayDurationGroup && diff --git a/meteor/client/ui/ClockView/PresenterScreen.tsx b/meteor/client/ui/ClockView/PresenterScreen.tsx index 835ccf3fc7..d16bd23d02 100644 --- a/meteor/client/ui/ClockView/PresenterScreen.tsx +++ b/meteor/client/ui/ClockView/PresenterScreen.tsx @@ -21,7 +21,6 @@ import { PieceCountdownContainer } from '../PieceIcons/PieceCountdown' import { PlaylistTiming } from '@sofie-automation/corelib/dist/playout/rundownTiming' import { DashboardLayout, RundownLayoutBase, RundownLayoutPresenterView } from '../../../lib/collections/RundownLayouts' import { - PartId, RundownId, RundownLayoutId, RundownPlaylistId, @@ -40,7 +39,6 @@ import { UIShowStyleBases, UIStudios } from '../Collections' import { UIStudio } from '../../../lib/api/studios' import { PieceInstances, RundownLayouts, RundownPlaylists, Rundowns, ShowStyleVariants } from '../../collections' import { RundownPlaylistCollectionUtil } from '../../../lib/collections/rundownPlaylistUtil' -import { Piece } from '@sofie-automation/corelib/dist/dataModel/Piece' interface SegmentUi extends DBSegment { items: Array @@ -63,7 +61,6 @@ export interface RundownOverviewTrackedProps { playlist?: RundownPlaylist rundowns: Rundown[] segments: Array - pieces: Map currentSegment: SegmentUi | undefined currentPartInstance: PartUi | undefined nextSegment: SegmentUi | undefined @@ -86,7 +83,6 @@ function getShowStyleBaseIdSegmentPartUi( segments: Segment[] parts: Part[] }, - pieces: Map, rundownsToShowstyles: Map, currentPartInstance: PartInstance | undefined, nextPartInstance: PartInstance | undefined @@ -137,7 +133,6 @@ function getShowStyleBaseIdSegmentPartUi( rundownOrder.slice(0, rundownIndex), rundownsToShowstyles, orderedSegmentsAndParts.parts.map((part) => part._id), - pieces, currentPartInstance, nextPartInstance, true, @@ -179,7 +174,6 @@ export const getPresenterScreenReactive = (props: RundownOverviewProps): Rundown }, }) const segments: Array = [] - let pieces: Map = new Map() let showStyleBaseIds: ShowStyleBaseId[] = [] let rundowns: Rundown[] = [] let rundownIds: RundownId[] = [] @@ -201,7 +195,6 @@ export const getPresenterScreenReactive = (props: RundownOverviewProps): Rundown if (playlist) { rundowns = RundownPlaylistCollectionUtil.getRundownsOrdered(playlist) const orderedSegmentsAndParts = RundownPlaylistCollectionUtil.getSegmentsAndPartsSync(playlist) - pieces = RundownPlaylistCollectionUtil.getPiecesForParts(orderedSegmentsAndParts.parts.map((p) => p._id)) rundownIds = rundowns.map((rundown) => rundown._id) const rundownsToShowstyles: Map = new Map() for (const rundown of rundowns) { @@ -233,7 +226,6 @@ export const getPresenterScreenReactive = (props: RundownOverviewProps): Rundown currentPartInstance, playlist, orderedSegmentsAndParts, - pieces, rundownsToShowstyles, currentPartInstance, nextPartInstance @@ -251,7 +243,6 @@ export const getPresenterScreenReactive = (props: RundownOverviewProps): Rundown nextPartInstance, playlist, orderedSegmentsAndParts, - pieces, rundownsToShowstyles, currentPartInstance, nextPartInstance @@ -265,7 +256,6 @@ export const getPresenterScreenReactive = (props: RundownOverviewProps): Rundown return { studio, segments, - pieces, playlist, rundowns, showStyleBaseIds, @@ -425,7 +415,7 @@ export class PresenterScreenBase extends MeteorReactComponent< } private renderDefaultLayout() { - const { playlist, segments, pieces, currentShowStyleBaseId, nextShowStyleBaseId, playlistId } = this.props + const { playlist, segments, currentShowStyleBaseId, nextShowStyleBaseId, playlistId } = this.props if (playlist && playlistId && segments) { const currentPart = this.props.currentPartInstance @@ -477,10 +467,7 @@ export class PresenterScreenBase extends MeteorReactComponent< showStyleBaseId={currentShowStyleBaseId} rundownIds={this.props.rundownIds} partAutoNext={currentPart.instance.part.autoNext || false} - partExpectedDuration={calculatePartInstanceExpectedDurationWithPreroll( - currentPart.instance, - pieces.get(currentPart.partId) ?? [] - )} + partExpectedDuration={calculatePartInstanceExpectedDurationWithPreroll(currentPart.instance)} partStartedPlayback={currentPart.instance.timings?.plannedStartedPlayback} playlistActivationId={this.props.playlist?.activationId} /> diff --git a/meteor/client/ui/RundownView/RundownTiming/RundownTimingProvider.tsx b/meteor/client/ui/RundownView/RundownTiming/RundownTimingProvider.tsx index 5f9d1aa180..76a5d1e5ff 100644 --- a/meteor/client/ui/RundownView/RundownTiming/RundownTimingProvider.tsx +++ b/meteor/client/ui/RundownView/RundownTiming/RundownTimingProvider.tsx @@ -14,8 +14,6 @@ import { RundownTimingCalculator, RundownTimingContext } from '../../../lib/rund import { PartId, SegmentId } from '@sofie-automation/corelib/dist/dataModel/Ids' import { PartInstances } from '../../../collections' import { RundownPlaylistCollectionUtil } from '../../../../lib/collections/rundownPlaylistUtil' -import { Piece } from '@sofie-automation/corelib/dist/dataModel/Piece' -import { CalculateTimingsPiece } from '@sofie-automation/corelib/dist/playout/timings' const TIMING_DEFAULT_REFRESH_INTERVAL = 1000 / 60 // the interval for high-resolution events (timeupdateHR) const LOW_RESOLUTION_TIMING_DECIMATOR = 15 @@ -49,7 +47,6 @@ interface IRundownTimingProviderTrackedProps { currentRundown: Rundown | undefined parts: Array partInstancesMap: Map - pieces: Map segmentEntryPartInstances: PartInstance[] segments: DBSegment[] segmentsMap: Map @@ -70,7 +67,6 @@ export const RundownTimingProvider = withTracker< let parts: Array = [] let segments: Array = [] const partInstancesMap = new Map() - let pieces: Map = new Map() let currentRundown: Rundown | undefined const segmentEntryPartInstances: PartInstance[] = [] if (props.playlist) { @@ -151,8 +147,6 @@ export const RundownTimingProvider = withTracker< } } }) - - pieces = RundownPlaylistCollectionUtil.getPiecesForParts(parts.map((p) => p._id)) } const segmentsMap = new Map(segments.map((segment) => [segment._id, segment])) @@ -162,7 +156,6 @@ export const RundownTimingProvider = withTracker< currentRundown, parts, partInstancesMap, - pieces, segmentEntryPartInstances, segments, segmentsMap, @@ -299,16 +292,8 @@ export const RundownTimingProvider = withTracker< } updateDurations(now: number, isSynced: boolean) { - const { - playlist, - rundowns, - currentRundown, - parts, - partInstancesMap, - pieces, - segmentsMap, - segmentEntryPartInstances, - } = this.props + const { playlist, rundowns, currentRundown, parts, partInstancesMap, segmentsMap, segmentEntryPartInstances } = + this.props const updatedDurations = this.timingCalculator.updateDurations( now, isSynced, @@ -317,7 +302,6 @@ export const RundownTimingProvider = withTracker< currentRundown, parts, partInstancesMap, - pieces, segmentsMap, this.props.defaultDuration, segmentEntryPartInstances diff --git a/meteor/client/ui/RundownView/RundownTiming/SegmentDuration.tsx b/meteor/client/ui/RundownView/RundownTiming/SegmentDuration.tsx index cc42683560..f802e2ac13 100644 --- a/meteor/client/ui/RundownView/RundownTiming/SegmentDuration.tsx +++ b/meteor/client/ui/RundownView/RundownTiming/SegmentDuration.tsx @@ -4,16 +4,12 @@ import { withTiming, WithTiming } from './withTiming' import { unprotectString } from '../../../../lib/lib' import { RundownUtils } from '../../../lib/rundown' import { PartUi } from '../../SegmentTimeline/SegmentTimelineContainer' -import { - calculatePartInstanceExpectedDurationWithPreroll, - CalculateTimingsPiece, -} from '@sofie-automation/corelib/dist/playout/timings' -import { PartId, SegmentId } from '@sofie-automation/corelib/dist/dataModel/Ids' +import { calculatePartInstanceExpectedDurationWithPreroll } from '@sofie-automation/corelib/dist/playout/timings' +import { SegmentId } from '@sofie-automation/corelib/dist/dataModel/Ids' interface ISegmentDurationProps { segmentId: SegmentId parts: PartUi[] - pieces: Map label?: ReactNode className?: string /** If set, the timer will display just the played out duration */ @@ -49,7 +45,7 @@ export const SegmentDuration = withTiming()(function budget += part.instance.orphaned || part.instance.part.untimed ? 0 - : calculatePartInstanceExpectedDurationWithPreroll(part.instance, props.pieces.get(part.partId) ?? []) || 0 + : calculatePartInstanceExpectedDurationWithPreroll(part.instance) || 0 }) } props.parts.forEach((part) => { diff --git a/meteor/client/ui/SegmentContainer/withResolvedSegment.ts b/meteor/client/ui/SegmentContainer/withResolvedSegment.ts index d8a4024bf7..a0a790c83a 100644 --- a/meteor/client/ui/SegmentContainer/withResolvedSegment.ts +++ b/meteor/client/ui/SegmentContainer/withResolvedSegment.ts @@ -35,7 +35,6 @@ import { } from '@sofie-automation/corelib/dist/dataModel/Ids' import { PieceInstances, Segments } from '../../collections' import { RundownPlaylistCollectionUtil } from '../../../lib/collections/rundownPlaylistUtil' -import { CalculateTimingsPiece } from '@sofie-automation/corelib/dist/playout/timings' import { ReadonlyDeep } from 'type-fest' import { PieceContentStatusObj } from '../../../lib/mediaObjects' @@ -107,7 +106,6 @@ export interface SegmentNoteCounts { export interface ITrackedProps { segmentui: SegmentUi | undefined parts: Array - pieces: Map segmentNoteCounts: SegmentNoteCounts hasRemoteItems: boolean hasGuestItems: boolean @@ -208,15 +206,6 @@ export function withResolvedSegment( ) const rundownOrder = RundownPlaylistCollectionUtil.getRundownOrderedIDs(props.playlist) - const pieces = memoizedIsolatedAutorun( - (orderedParts) => { - return RundownPlaylistCollectionUtil.getPiecesForParts(orderedParts, { - fields: { enable: 1, prerollDuration: 1, postrollDuration: 1, pieceType: 1 }, - }) - }, - 'playlist.getPiecesForParts', - orderedAllPartIds - ) const rundownIndex = rundownOrder.indexOf(segment.rundownId) const o = RundownUtils.getResolvedSegment( @@ -228,7 +217,6 @@ export function withResolvedSegment( rundownOrder.slice(0, rundownIndex), props.rundownsToShowstyles, orderedAllPartIds, - pieces, currentPartInstance, nextPartInstance, true, @@ -297,7 +285,6 @@ export function withResolvedSegment( return { segmentui: o.segmentExtended, parts: o.parts, - pieces, segmentNoteCounts, hasAlreadyPlayed: o.hasAlreadyPlayed, hasRemoteItems: o.hasRemoteItems, diff --git a/meteor/client/ui/SegmentList/SegmentList.tsx b/meteor/client/ui/SegmentList/SegmentList.tsx index f7b64d3004..cc055868be 100644 --- a/meteor/client/ui/SegmentList/SegmentList.tsx +++ b/meteor/client/ui/SegmentList/SegmentList.tsx @@ -14,11 +14,10 @@ import { SegmentViewMode } from '../SegmentContainer/SegmentViewModes' import { SegmentListHeader } from './SegmentListHeader' import { useInView } from 'react-intersection-observer' import { getHeaderHeight } from '../../lib/viewPort' -import { PartId, SegmentId } from '@sofie-automation/corelib/dist/dataModel/Ids' +import { SegmentId } from '@sofie-automation/corelib/dist/dataModel/Ids' import { NoteSeverity } from '@sofie-automation/blueprints-integration' import { UIStudio } from '../../../lib/api/studios' import { RundownHoldState } from '@sofie-automation/corelib/dist/dataModel/RundownPlaylist' -import { CalculateTimingsPiece } from '@sofie-automation/corelib/dist/playout/timings' interface IProps { id: string @@ -34,7 +33,6 @@ interface IProps { playlist: RundownPlaylist studio: UIStudio parts: Array - pieces: Map segmentNoteCounts: SegmentNoteCounts fixedSegmentDuration: boolean @@ -224,7 +222,6 @@ const SegmentListInner = React.forwardRef(function Segme isDetached={isHeaderDetached} isDetachedStick={isHeaderDetachedStick} parts={props.parts} - pieces={props.pieces} segment={props.segment} playlist={props.playlist} studio={props.studio} diff --git a/meteor/client/ui/SegmentList/SegmentListContainer.tsx b/meteor/client/ui/SegmentList/SegmentListContainer.tsx index 7e9509abd8..dac90a1495 100644 --- a/meteor/client/ui/SegmentList/SegmentListContainer.tsx +++ b/meteor/client/ui/SegmentList/SegmentListContainer.tsx @@ -223,7 +223,6 @@ export const SegmentListContainer = withResolvedSegment(function Segment key={unprotectString(props.segmentui._id)} segment={props.segmentui} parts={props.parts} - pieces={props.pieces} playlist={props.playlist} studio={props.studio} currentPartWillAutoNext={currentPartWillAutoNext} diff --git a/meteor/client/ui/SegmentList/SegmentListHeader.tsx b/meteor/client/ui/SegmentList/SegmentListHeader.tsx index 86dd606339..105564e70d 100644 --- a/meteor/client/ui/SegmentList/SegmentListHeader.tsx +++ b/meteor/client/ui/SegmentList/SegmentListHeader.tsx @@ -16,7 +16,6 @@ import { IContextMenuContext } from '../RundownView' import { NoteSeverity } from '@sofie-automation/blueprints-integration' import { CriticalIconSmall, WarningIconSmall } from '../../lib/ui/icons/notifications' import { UIStudio } from '../../../lib/api/studios' -import { CalculateTimingsPiece } from '@sofie-automation/corelib/dist/playout/timings' import { SegmentTimeAnchorTime } from '../RundownView/RundownTiming/SegmentTimeAnchorTime' export function SegmentListHeader({ @@ -24,7 +23,6 @@ export function SegmentListHeader({ isDetachedStick, segment, parts, - pieces, playlist, studio, highlight, @@ -47,7 +45,6 @@ export function SegmentListHeader({ playlist: RundownPlaylist studio: UIStudio parts: Array - pieces: Map segmentNoteCounts: SegmentNoteCounts highlight: boolean isLiveSegment: boolean @@ -107,7 +104,6 @@ export function SegmentListHeader({ {t('Duration')}} fixed={fixedSegmentDuration} /> diff --git a/meteor/client/ui/SegmentStoryboard/SegmentStoryboard.tsx b/meteor/client/ui/SegmentStoryboard/SegmentStoryboard.tsx index 9200b44c45..a855882fca 100644 --- a/meteor/client/ui/SegmentStoryboard/SegmentStoryboard.tsx +++ b/meteor/client/ui/SegmentStoryboard/SegmentStoryboard.tsx @@ -34,7 +34,6 @@ import { SwitchViewModeButton } from '../SegmentContainer/SwitchViewModeButton' import { UIStudio } from '../../../lib/api/studios' import { PartId, SegmentId } from '@sofie-automation/corelib/dist/dataModel/Ids' import { RundownHoldState } from '@sofie-automation/corelib/dist/dataModel/RundownPlaylist' -import { CalculateTimingsPiece } from '@sofie-automation/corelib/dist/playout/timings' import { SegmentTimeAnchorTime } from '../RundownView/RundownTiming/SegmentTimeAnchorTime' import { logger } from '../../../lib/logging' @@ -45,7 +44,6 @@ interface IProps { playlist: RundownPlaylist studio: UIStudio parts: Array - pieces: Map segmentNoteCounts: SegmentNoteCounts // timeScale: number // maxTimeScale: number @@ -616,7 +614,6 @@ export const SegmentStoryboard = React.memo( {t('Duration')}} fixed={props.fixedSegmentDuration} /> diff --git a/meteor/client/ui/SegmentStoryboard/SegmentStoryboardContainer.tsx b/meteor/client/ui/SegmentStoryboard/SegmentStoryboardContainer.tsx index 21bf080e8a..30797a43b7 100644 --- a/meteor/client/ui/SegmentStoryboard/SegmentStoryboardContainer.tsx +++ b/meteor/client/ui/SegmentStoryboard/SegmentStoryboardContainer.tsx @@ -236,7 +236,6 @@ export const SegmentStoryboardContainer = withResolvedSegment(function S segment={props.segmentui} studio={props.studio} parts={props.parts} - pieces={props.pieces} segmentNoteCounts={props.segmentNoteCounts} onItemClick={props.onPieceClick} onItemDoubleClick={props.onPieceDoubleClick} diff --git a/meteor/client/ui/SegmentTimeline/Parts/FlattenedSourceLayers.tsx b/meteor/client/ui/SegmentTimeline/Parts/FlattenedSourceLayers.tsx index 62b37ea0af..132c90a189 100644 --- a/meteor/client/ui/SegmentTimeline/Parts/FlattenedSourceLayers.tsx +++ b/meteor/client/ui/SegmentTimeline/Parts/FlattenedSourceLayers.tsx @@ -1,4 +1,4 @@ -import React, { useMemo } from 'react' +import React from 'react' import * as _ from 'underscore' import { unprotectString } from '../../../../lib/lib' import { ISourceLayerUi } from '../SegmentTimelineContainer' @@ -6,7 +6,6 @@ import { ContextMenuTrigger } from '@jstarpl/react-contextmenu' import { SourceLayerItemContainer } from '../SourceLayerItemContainer' import { ISourceLayerPropsBase, useMouseContext } from './SourceLayer' import { ISourceLayerExtended } from '../../../../lib/Rundown' -import { PieceInstancePiece } from '@sofie-automation/corelib/dist/dataModel/PieceInstance' interface IFlattenedSourceLayerProps extends ISourceLayerPropsBase { layers: ISourceLayerUi[] @@ -16,17 +15,6 @@ interface IFlattenedSourceLayerProps extends ISourceLayerPropsBase { export function FlattenedSourceLayers(props: IFlattenedSourceLayerProps): JSX.Element { const { getPartContext, onMouseUp } = useMouseContext(props) - const piecesForLayers = useMemo(() => { - const piecesForLayers: Map = new Map() - for (const layer of props.layers) { - piecesForLayers.set( - layer._id, - layer.pieces.map((p) => p.instance.piece) - ) - } - return piecesForLayers - }, [props.layers]) - return ( void collapsedOutputs: { @@ -198,7 +196,6 @@ export class SegmentTimelinePartClass extends React.Component - pieces: Map segmentNoteCounts: SegmentNoteCounts timeScale: number maxTimeScale: number @@ -180,7 +178,7 @@ const SegmentTimelineZoom = class SegmentTimelineZoom extends React.Component< total += duration }) } else { - total = RundownUtils.getSegmentDuration(this.props.parts, this.props.pieces, true) + total = RundownUtils.getSegmentDuration(this.props.parts, true) } return total } @@ -604,7 +602,7 @@ export class SegmentTimelineClass extends React.Component{t('Duration')}} fixed={this.props.fixedSegmentDuration} /> @@ -1155,7 +1148,6 @@ export class SegmentTimelineClass extends React.Component followingPart: PartUi | undefined segment: SegmentUi @@ -93,7 +89,6 @@ export const SegmentTimelinePartHoverPreview = ({ isLastInSegment={isLastInSegment && !followingPart && parts.length - 1 === index} isAfterLastValidInSegmentAndItsLive={false} part={part} - pieces={pieces.get(part.partId) ?? []} isPreview={true} isBudgetGap={false} showDurationSourceLayers={showDurationSourceLayers} @@ -126,7 +121,6 @@ export const SegmentTimelinePartHoverPreview = ({ isLastInSegment={false} isAfterLastValidInSegmentAndItsLive={false} part={followingPart} - pieces={pieces.get(followingPart.partId) ?? []} isPreview={true} cropDuration={followingPartPreviewDuration} isBudgetGap={false} diff --git a/meteor/client/ui/SegmentTimeline/SmallParts/SegmentTimelineSmallPartFlag.tsx b/meteor/client/ui/SegmentTimeline/SmallParts/SegmentTimelineSmallPartFlag.tsx index 9ab2f1e567..40cc838e4f 100644 --- a/meteor/client/ui/SegmentTimeline/SmallParts/SegmentTimelineSmallPartFlag.tsx +++ b/meteor/client/ui/SegmentTimeline/SmallParts/SegmentTimelineSmallPartFlag.tsx @@ -8,7 +8,6 @@ import { RundownPlaylist } from '../../../../lib/collections/RundownPlaylists' import { SegmentTimelinePartHoverPreview } from './SegmentTimelinePartHoverPreview' import RundownViewEventBus, { RundownViewEvents } from '../../../../lib/api/triggers/RundownViewEventBus' import { UIStudio } from '../../../../lib/api/studios' -import { CalculateTimingsPiece } from '@sofie-automation/corelib/dist/playout/timings' import { PartId } from '@sofie-automation/corelib/dist/dataModel/Ids' import { TimingDataResolution, TimingTickResolution, withTiming } from '../../RundownView/RundownTiming/withTiming' import { SegmentTimelinePartClass } from '../Parts/SegmentTimelinePart' @@ -16,7 +15,6 @@ import { SegmentTimelinePartClass } from '../Parts/SegmentTimelinePart' export const SegmentTimelineSmallPartFlag = withTiming< { parts: [PartUi, number, number][] - pieces: Map followingPart: PartUi | undefined firstPartInSegmentId: PartId sourceLayers: { @@ -54,7 +52,6 @@ export const SegmentTimelineSmallPartFlag = withTiming< }))( ({ parts, - pieces, followingPart, sourceLayers, timeToPixelRatio, @@ -190,7 +187,6 @@ export const SegmentTimelineSmallPartFlag = withTiming< showMiniInspector={isHover} followingPart={followingPart} parts={parts.map(([part]) => part)} - pieces={pieces} segment={segment} playlist={playlist} liveLineHistorySize={liveLineHistorySize} diff --git a/meteor/client/ui/SegmentTimeline/SourceLayerItem.tsx b/meteor/client/ui/SegmentTimeline/SourceLayerItem.tsx index ab64e8fdb4..84a0f67fe3 100644 --- a/meteor/client/ui/SegmentTimeline/SourceLayerItem.tsx +++ b/meteor/client/ui/SegmentTimeline/SourceLayerItem.tsx @@ -19,7 +19,6 @@ import { pieceUiClassNames } from '../../lib/ui/pieceUiClassNames' import { SourceDurationLabelAlignment } from './Renderers/CustomLayerItemRenderer' import { TransitionSourceRenderer } from './Renderers/TransitionSourceRenderer' import { UIStudio } from '../../../lib/api/studios' -import { CalculateTimingsPiece } from '@sofie-automation/corelib/dist/playout/timings' const LEFT_RIGHT_ANCHOR_SPACER = 15 const MARGINAL_ANCHORED_WIDTH = 5 @@ -38,8 +37,6 @@ export interface ISourceLayerItemProps { partExpectedDuration: number /** The piece being rendered in this layer */ piece: PieceUi - /** Pieces belonging to the Part */ - pieces: CalculateTimingsPiece[] /** Scaling factor for this segment */ timeScale: number /** Whether this part is live */ @@ -657,7 +654,6 @@ export const SourceLayerItem = withTranslation()( this.props.scrollLeft, this.props.scrollWidth, this.props.part, - this.props.pieces, this.props.partStartsAt, this.props.partDuration, this.props.piece diff --git a/meteor/client/ui/SegmentTimeline/TimelineGrid.tsx b/meteor/client/ui/SegmentTimeline/TimelineGrid.tsx index 7354e8f288..4f36a05c49 100644 --- a/meteor/client/ui/SegmentTimeline/TimelineGrid.tsx +++ b/meteor/client/ui/SegmentTimeline/TimelineGrid.tsx @@ -11,8 +11,7 @@ import { getCurrentTime } from '../../../lib/lib' import { RundownTiming } from '../RundownView/RundownTiming/RundownTiming' import { SegmentTimelinePartClass } from './Parts/SegmentTimelinePart' import { RundownTimingContext } from '../../lib/rundownTiming' -import { PartId, PartInstanceId } from '@sofie-automation/corelib/dist/dataModel/Ids' -import { CalculateTimingsPiece } from '@sofie-automation/corelib/dist/playout/timings' +import { PartInstanceId } from '@sofie-automation/corelib/dist/dataModel/Ids' // We're cheating a little: Fontface declare class FontFace { @@ -41,7 +40,6 @@ interface ITimelineGridProps { scrollLeft: number isLiveSegment: boolean partInstances: PartUi[] - pieces: Map currentPartInstanceId: PartInstanceId | null onResize: (size: number[]) => void } @@ -332,7 +330,7 @@ export class TimelineGrid extends React.Component { total += duration }) } else { - total = RundownUtils.getSegmentDuration(this.props.partInstances, this.props.pieces, true) + total = RundownUtils.getSegmentDuration(this.props.partInstances, true) } return total } diff --git a/meteor/client/ui/Shelf/SegmentTimingPanel.tsx b/meteor/client/ui/Shelf/SegmentTimingPanel.tsx index 660db2808e..455a3a1769 100644 --- a/meteor/client/ui/Shelf/SegmentTimingPanel.tsx +++ b/meteor/client/ui/Shelf/SegmentTimingPanel.tsx @@ -23,7 +23,6 @@ import { getIsFilterActive } from '../../lib/rundownLayouts' import { UIShowStyleBase } from '../../../lib/api/showStyles' import { PartId, RundownPlaylistId } from '@sofie-automation/corelib/dist/dataModel/Ids' import { RundownPlaylistCollectionUtil } from '../../../lib/collections/rundownPlaylistUtil' -import { CalculateTimingsPiece } from '@sofie-automation/corelib/dist/playout/timings' interface ISegmentTimingPanelProps { visible?: boolean @@ -36,7 +35,6 @@ interface ISegmentTimingPanelProps { interface ISegmentTimingPanelTrackedProps { liveSegment?: Segment parts?: PartExtended[] - pieces?: Map active: boolean } @@ -68,11 +66,10 @@ class SegmentTimingPanelInner extends MeteorReactComponent< {panel.timingType === 'count_down' ? t('Segment Count Down') : t('Segment Count Up')} )} - {this.props.active && this.props.liveSegment && this.props.parts && this.props.pieces && ( + {this.props.active && this.props.liveSegment && this.props.parts && ( @@ -144,7 +141,6 @@ export const SegmentTimingPanel = translateWithTracker< const rundowns = RundownPlaylistCollectionUtil.getRundownsOrdered(props.playlist) const rundown = rundowns.find((r) => r._id === liveSegment.rundownId) const segmentIndex = orderedSegmentsAndParts.segments.findIndex((s) => s._id === liveSegment._id) - const pieces = RundownPlaylistCollectionUtil.getPiecesForParts(orderedAllPartIds) if (!rundown) return { active } @@ -162,7 +158,6 @@ export const SegmentTimingPanel = translateWithTracker< rundownOrder.slice(0, rundownIndex), rundownsToShowstyles, orderedAllPartIds, - pieces, currentPartInstance, nextPartInstance, true, diff --git a/packages/corelib/src/playout/timings.ts b/packages/corelib/src/playout/timings.ts index 991415e280..cd04fb0f9a 100644 --- a/packages/corelib/src/playout/timings.ts +++ b/packages/corelib/src/playout/timings.ts @@ -176,15 +176,15 @@ export function calculatePartExpectedDurationWithPreroll( } export function calculatePartInstanceExpectedDurationWithPreroll( - partInstance: Pick, - pieces: CalculateTimingsPiece[] + partInstance: Pick + // pieces: CalculateTimingsPiece[] ): number | undefined { if (partInstance.part.expectedDuration === undefined) return undefined if (partInstance.partPlayoutTimings) { return calculateExpectedDurationWithPreroll(partInstance.part.expectedDuration, partInstance.partPlayoutTimings) } else { - const timings = calculatePartTimings(undefined, {}, [], partInstance.part, pieces) + const timings = calculatePartTimings(undefined, {}, [], partInstance.part, []) // TODO: Piece timings should be taken into account return calculateExpectedDurationWithPreroll( partInstance.part.expectedDurationWithPreroll ?? partInstance.part.expectedDuration,