Skip to content

Commit

Permalink
Merge pull request #214 from tv2/staging
Browse files Browse the repository at this point in the history
Merge staging into master
  • Loading branch information
KvelaGorrrrnio authored Jul 12, 2023
2 parents 987b3a0 + ca2344c commit 6a26995
Show file tree
Hide file tree
Showing 249 changed files with 8,932 additions and 8,253 deletions.
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"printWidth": 120,
"semi": false,
"singleQuote": true,
"useTabs": true
"useTabs": true,
"trailingComma": "none"
}
2 changes: 1 addition & 1 deletion config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = env => {
// versionIntegration = versionIntegration.replace(/[^\d.]/g, '') || '0.0.0'

versionTSRTypes = '1.3.0'
versionIntegration = '46.1.0'
versionIntegration = '46.2.0'

const entrypoints = env.bundle ? GetEntrypointsForBundle(env.bundle) : BlueprintEntrypoints

Expand Down
2 changes: 1 addition & 1 deletion docs/DVE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DVE

To use DVEs, first add the studio settings `ATEM Split Screen Art Fill` and `ATEM Split Screen Art Key`.
To use DVEs, first add the studio settings `Video Switcher Split Screen Art Fill` and `ATEM Split Screen Art Key`. For TriCaster only the Fill source is configurable. The pairing with a Key source may need to be set up in the switcher if the Fill source does not have its alpha channel already embedded.

Then, go to your showstyle settings and add the setting `DVE Styles`. Here you can define all the DVEs for your show.

Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
globals: {
'ts-jest': {
tsconfig: 'tsconfig.json',
tsconfig: 'tsconfig.test.json',
},
},
moduleFileExtensions: [
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tv2-sofie-blueprints-inews",
"version": "1.7.8",
"version": "1.8.2",
"repository": "https://github.com/olzzon/tv2-sofie-blueprints-inews",
"license": "MIT",
"private": true,
Expand Down Expand Up @@ -46,7 +46,7 @@
"jest-resolve": "^24.5.0",
"license-checker": "^25.0.1",
"moment": "^2.29.2",
"prettier": "^1.18.2",
"prettier": "^2.0.0",
"standard-version": "9.1.1",
"ts-jest": "^27.1.3",
"ts-loader": "^6.2.1",
Expand All @@ -60,8 +60,9 @@
"webpack-cli": "^3.1.2"
},
"dependencies": {
"@sofie-automation/blueprints-integration": "npm:@tv2media/[email protected]",
"underscore": "^1.12.1"
"@sofie-automation/blueprints-integration": "npm:@tv2media/[email protected]",
"underscore": "^1.12.1",
"ts-mockito": "^2.6.1"
},
"resolutions": {
"moment": "^2.29.2"
Expand Down
86 changes: 54 additions & 32 deletions src/__mocks__/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,24 @@ import {
PlaylistTimingType,
Time
} from 'blueprints-integration'
import { ITV2ActionExecutionContext, PieceMetaData } from 'tv2-common'
import {
ITV2ActionExecutionContext,
PieceMetaData,
SegmentContext,
TV2StudioConfigBase,
UniformConfig,
VideoSwitcherBase
} from 'tv2-common'
import { NoteType } from 'tv2-constants'
import { defaultShowStyleConfig, defaultStudioConfig } from '../tv2_afvd_showstyle/__tests__/configs'
import { parseConfig as parseShowStyleConfigAFVD } from '../tv2_afvd_showstyle/helpers/config'
import { parseConfig as parseStudioConfigAFVD, StudioConfig } from '../tv2_afvd_studio/helpers/config'
import {
GalleryBlueprintConfig,
GalleryShowStyleConfig,
preprocessConfig as parseShowStyleConfigAFVD
} from '../tv2_afvd_showstyle/helpers/config'
import { preprocessConfig as parseStudioConfigAFVD } from '../tv2_afvd_studio/helpers/config'
import mappingsDefaultsAFVD from '../tv2_afvd_studio/migrations/mappings-defaults'
import { GALLERY_UNIFORM_CONFIG } from '../tv2_afvd_studio/uniformConfig'

export function getHash(str: string): string {
const hash = crypto.createHash('sha1')
Expand All @@ -44,7 +56,7 @@ export function getHash(str: string): string {
.replace(/[\+\/\=]/gi, '_') // remove +/= from strings, because they cause troubles
}

// tslint:disable-next-line: max-classes-per-file
// tslint:disable: max-classes-per-file
export class CommonContext implements ICommonContext {
protected savedNotes: PartNote[] = []
protected notesRundownId?: string
Expand Down Expand Up @@ -104,7 +116,6 @@ export class CommonContext implements ICommonContext {
}
}

// tslint:disable-next-line: max-classes-per-file
export class UserNotesContext extends CommonContext implements IUserNotesContext {
constructor(contextName: string, rundownId?: string, segmentId?: string, partId?: string) {
super(contextName, rundownId, segmentId, partId)
Expand All @@ -122,7 +133,6 @@ export class UserNotesContext extends CommonContext implements IUserNotesContext
}
}

// tslint:disable-next-line: max-classes-per-file
export class StudioContext extends CommonContext implements IStudioContext {
public studioId: string = 'studio0'
public studioConfig: { [key: string]: ConfigItemValue } = {}
Expand Down Expand Up @@ -155,8 +165,7 @@ export class StudioContext extends CommonContext implements IStudioContext {
}
}

// tslint:disable-next-line: max-classes-per-file
export class ShowStyleContext extends StudioContext implements IShowStyleContext, IPackageInfoContext {
export class ShowStyleContextMock extends StudioContext implements IShowStyleContext, IPackageInfoContext {
public studioConfig: { [key: string]: ConfigItemValue } = {}
public showStyleConfig: { [key: string]: ConfigItemValue } = {}

Expand Down Expand Up @@ -189,8 +198,7 @@ export class ShowStyleContext extends StudioContext implements IShowStyleContext
}
}

// tslint:disable-next-line: max-classes-per-file
export class ShowStyleUserContext extends ShowStyleContext implements IUserNotesContext {
export class ShowStyleUserContextMock extends ShowStyleContextMock implements IUserNotesContext {
public notifyUserError(message: string, _params?: { [key: string]: any }): void {
this.pushNote(NoteType.NOTIFY_USER_ERROR, message)
}
Expand All @@ -203,8 +211,7 @@ export class ShowStyleUserContext extends ShowStyleContext implements IUserNotes
}
}

// tslint:disable-next-line: max-classes-per-file
export class GetRundownContext extends ShowStyleUserContext implements IGetRundownContext {
export class GetRundownContextMock extends ShowStyleUserContextMock implements IGetRundownContext {
public async getCurrentPlaylist(): Promise<Readonly<IBlueprintRundownPlaylist> | undefined> {
return undefined
}
Expand All @@ -218,8 +225,7 @@ export class GetRundownContext extends ShowStyleUserContext implements IGetRundo
}
}

// tslint:disable-next-line: max-classes-per-file
export class RundownContext extends ShowStyleContext implements IRundownContext {
export class RundownContextMock extends ShowStyleContextMock implements IRundownContext {
public readonly rundownId: string = 'rundown0'
public readonly rundown: Readonly<IBlueprintRundownDB>

Expand All @@ -246,8 +252,7 @@ export class RundownContext extends ShowStyleContext implements IRundownContext
}
}

// tslint:disable-next-line: max-classes-per-file
export class RundownUserContext extends RundownContext implements IRundownUserContext {
export class RundownUserContextMock extends RundownContextMock implements IRundownUserContext {
public notifyUserError(message: string, _params?: { [key: string]: any }): void {
this.pushNote(NoteType.NOTIFY_USER_ERROR, message)
}
Expand All @@ -260,8 +265,7 @@ export class RundownUserContext extends RundownContext implements IRundownUserCo
}
}

// tslint:disable-next-line: max-classes-per-file
export class SegmentUserContext extends RundownContext implements ISegmentUserContext {
export class SegmentUserContextMock extends RundownContextMock implements ISegmentUserContext {
constructor(
contextName: string,
mappingsDefaults: BlueprintMappings,
Expand Down Expand Up @@ -300,9 +304,10 @@ export class SegmentUserContext extends RundownContext implements ISegmentUserCo
}
}

// tslint:disable-next-line: max-classes-per-file
export class SyncIngestUpdateToPartInstanceContext extends RundownUserContext
implements ISyncIngestUpdateToPartInstanceContext {
export class SyncIngestUpdateToPartInstanceContextMock
extends RundownUserContextMock
implements ISyncIngestUpdateToPartInstanceContext
{
public syncedPieceInstances: string[] = []
public removedPieceInstances: string[] = []
public updatedPieceInstances: string[] = []
Expand Down Expand Up @@ -405,15 +410,13 @@ export class SyncIngestUpdateToPartInstanceContext extends RundownUserContext
}
}

// tslint:disable-next-line: max-classes-per-file
export class ActionExecutionContext extends ShowStyleUserContext implements ITV2ActionExecutionContext {
export class ActionExecutionContextMock extends ShowStyleUserContextMock implements ITV2ActionExecutionContext {
public currentPart: IBlueprintPartInstance
public currentPieceInstances: Array<IBlueprintPieceInstance<PieceMetaData>>
public nextPart: IBlueprintPartInstance | undefined
public nextPieceInstances: Array<IBlueprintPieceInstance<PieceMetaData>> | undefined

public takeAfterExecute: boolean = false
public isTV2Context: true = true

constructor(
contextName: string,
Expand Down Expand Up @@ -552,7 +555,7 @@ export class ActionExecutionContext extends ShowStyleUserContext implements ITV2
}

this.nextPart = instance
this.nextPieceInstances = pieces.map<IBlueprintPieceInstance<PieceMetaData>>(p => ({
this.nextPieceInstances = pieces.map<IBlueprintPieceInstance<PieceMetaData>>((p) => ({
_id: (Date.now() * Math.random()).toString(),
piece: {
_id: '',
Expand Down Expand Up @@ -590,9 +593,9 @@ export class ActionExecutionContext extends ShowStyleUserContext implements ITV2
/** Remove piecesInstances by id. Returns ids of piecesInstances that were removed */
public async removePieceInstances(part: 'current' | 'next', pieceInstanceIds: string[]): Promise<string[]> {
if (part === 'current') {
this.currentPieceInstances = this.currentPieceInstances.filter(p => !pieceInstanceIds.includes(p._id))
this.currentPieceInstances = this.currentPieceInstances.filter((p) => !pieceInstanceIds.includes(p._id))
} else if (this.nextPieceInstances) {
this.nextPieceInstances = this.nextPieceInstances.filter(p => !pieceInstanceIds.includes(p._id))
this.nextPieceInstances = this.nextPieceInstances.filter((p) => !pieceInstanceIds.includes(p._id))
}

return pieceInstanceIds
Expand Down Expand Up @@ -637,15 +640,34 @@ export interface PartNote {
message: string
}

export function makeMockAFVDContext(studioConfigOverrides?: Partial<StudioConfig>) {
const mockContext = new SegmentUserContext(
export interface MockConfigOverrides {
studioConfig?: Partial<TV2StudioConfigBase>
showStyleConfig?: Partial<GalleryShowStyleConfig>
mappingDefaults?: BlueprintMappings
uniformConfig?: Partial<UniformConfig>
}

export function makeMockCoreGalleryContext(overrides?: MockConfigOverrides) {
const mockCoreContext = new SegmentUserContextMock(
'test',
mappingsDefaultsAFVD,
{ ...mappingsDefaultsAFVD, ...overrides?.mappingDefaults },
parseStudioConfigAFVD,
parseShowStyleConfigAFVD
)
mockContext.studioConfig = { ...defaultStudioConfig, ...studioConfigOverrides } as any
mockContext.showStyleConfig = defaultShowStyleConfig as any
mockCoreContext.studioConfig = { ...defaultStudioConfig, ...overrides?.studioConfig } as any
mockCoreContext.showStyleConfig = { ...defaultShowStyleConfig, ...overrides?.showStyleConfig } as any
return mockCoreContext
}

export function makeMockGalleryContext(overrides?: MockConfigOverrides) {
const mockCoreContext = makeMockCoreGalleryContext(overrides)
// @todo: this is not great, but it works
const config = { ...mockCoreContext.getStudioConfig(), ...(mockCoreContext.getShowStyleConfig() as any) }
const mockContext: SegmentContext<GalleryBlueprintConfig> = {
core: mockCoreContext,
config,
uniformConfig: { ...GALLERY_UNIFORM_CONFIG, ...overrides?.uniformConfig },
videoSwitcher: VideoSwitcherBase.getVideoSwitcher(mockCoreContext, config, GALLERY_UNIFORM_CONFIG) // new MockVideoSwitcher()
}
return mockContext
}
8 changes: 4 additions & 4 deletions src/inews-mixins/__tests__/playlist.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
PlaylistTimingType
} from 'blueprints-integration'
import { getRundownWithBackTime } from 'inews-mixins'
import { ShowStyleUserContext } from '../../__mocks__/context'
import { parseConfig as parseShowStyleConfig } from '../../tv2_afvd_showstyle/helpers/config'
import { parseConfig as parseStudioConfig } from '../../tv2_afvd_studio/helpers/config'
import { ShowStyleUserContextMock } from '../../__mocks__/context'
import { preprocessConfig as parseShowStyleConfig } from '../../tv2_afvd_showstyle/helpers/config'
import { preprocessConfig as parseStudioConfig } from '../../tv2_afvd_studio/helpers/config'
import mappingsDefaults from '../../tv2_afvd_studio/migrations/mappings-defaults'
import { makeSegmentWithTime } from './rundownDuration.spec'

Expand All @@ -18,7 +18,7 @@ const SEGMENT_ID = 'test_segment'
const PART_ID = 'test_part'

function getMockContext(): IShowStyleUserContext {
return new ShowStyleUserContext(
return new ShowStyleUserContextMock(
RUNDOWN_NAME,
mappingsDefaults,
parseStudioConfig,
Expand Down
2 changes: 1 addition & 1 deletion src/inews-mixins/__tests__/rundownDuration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { IngestSegment } from 'blueprints-integration'
import { literal } from 'tv2-common'
import { getRundownDuration } from '../rundownDuration'

export function makeSegmentWithoutTime(externalId: string, rank: number): IngestSegment {
function makeSegmentWithoutTime(externalId: string, rank: number): IngestSegment {
return literal<IngestSegment>({
externalId,
name: externalId,
Expand Down
2 changes: 1 addition & 1 deletion src/inews-mixins/playlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function getRundownWithBackTime(
manifest: BlueprintResultRundown
): BlueprintResultRundown {
const sortedSegments = ingestRundown.segments.sort((a, b) => a.rank - b.rank)
const firstContinuityStory = sortedSegments.find(segment => segment.name.match(/^\s*continuity\s*$/i))
const firstContinuityStory = sortedSegments.find((segment) => segment.name.match(/^\s*continuity\s*$/i))
const backTime = firstContinuityStory ? firstContinuityStory.payload.iNewsStory.fields.backTime : undefined

let expectedEnd: number | undefined
Expand Down
Loading

0 comments on commit 6a26995

Please sign in to comment.