Skip to content

Commit 76dfbd2

Browse files
authored
feat: cleanup media manager support (#1509)
1 parent af14bcd commit 76dfbd2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+73
-2035
lines changed

DEVELOPER.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,6 @@ However, one usage by AdlibActions for their userDataManifest remains as this is
145145
In R52, the replacement flow of `validateConfig` and `applyConfig` was extended to the system blueprint
146146
It is no longer recommended to use the old migrations flow for system blueprints.
147147

148-
### ExpectedMediaItems
149-
150-
These are used for Media-manager which is no longer being developed.
151-
152148
### Blueprints: getPieceABSessionId & getTimelineObjectAbSessionId
153149

154150
With AB being a native concept supported by Sofie since R50, these are likely no longer useful to Blueprints.

meteor/server/__tests__/_testEnvironment.test.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@ import {
77
Blueprints,
88
CoreSystem,
99
Evaluations,
10-
ExpectedMediaItems,
1110
ExternalMessageQueue,
1211
NrcsIngestDataCache,
1312
MediaObjects,
14-
MediaWorkFlows,
15-
MediaWorkFlowSteps,
1613
Parts,
1714
PeripheralDeviceCommands,
1815
PeripheralDevices,
@@ -48,18 +45,12 @@ describe('Basic test of test environment', () => {
4845
// @ts-ignore
4946
expect(Evaluations._isMock).toBeTruthy()
5047
// @ts-ignore
51-
expect(ExpectedMediaItems._isMock).toBeTruthy()
52-
// @ts-ignore
5348
expect(ExternalMessageQueue._isMock).toBeTruthy()
5449
// @ts-ignore
5550
expect(NrcsIngestDataCache._isMock).toBeTruthy()
5651
// @ts-ignore
5752
expect(MediaObjects._isMock).toBeTruthy()
5853
// @ts-ignore
59-
expect(MediaWorkFlows._isMock).toBeTruthy()
60-
// @ts-ignore
61-
expect(MediaWorkFlowSteps._isMock).toBeTruthy()
62-
// @ts-ignore
6354
expect(Parts._isMock).toBeTruthy()
6455
// @ts-ignore
6556
expect(PeripheralDeviceCommands._isMock).toBeTruthy()

meteor/server/api/__tests__/cleanup.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,10 +472,7 @@ async function setDefaultDatatoDB(env: DefaultEnvironment, now: number) {
472472
'organizations',
473473
'Users',
474474
// Deprecated:
475-
'expectedMediaItems',
476475
'mediaObjects',
477-
'mediaWorkFlows',
478-
'mediaWorkFlowSteps',
479476
].includes(collectionName)
480477
)
481478
continue

meteor/server/api/__tests__/peripheralDevice.test.ts

Lines changed: 2 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ import { waitUntil } from '../../../__mocks__/helpers/jest'
1212
import { setupDefaultStudioEnvironment, DefaultEnvironment } from '../../../__mocks__/helpers/database'
1313
import { setLogLevel } from '../../logging'
1414
import { IngestDeviceSecretSettings } from '@sofie-automation/corelib/dist/dataModel/PeripheralDeviceSettings/ingestDevice'
15-
import { MediaWorkFlow } from '@sofie-automation/shared-lib/dist/core/model/MediaWorkFlows'
16-
import { MediaWorkFlowStep } from '@sofie-automation/shared-lib/dist/core/model/MediaWorkFlowSteps'
17-
import { MediaManagerAPI } from '@sofie-automation/meteor-lib/dist/api/mediaManager'
1815
import { MediaObject } from '@sofie-automation/shared-lib/dist/core/model/MediaObjects'
1916
import {
2017
IBlueprintPieceType,
@@ -39,8 +36,6 @@ import { RundownId, RundownPlaylistId, SegmentId } from '@sofie-automation/corel
3936
import { PeripheralDeviceAPIMethods } from '@sofie-automation/shared-lib/dist/peripheralDevice/methodsAPI'
4037
import {
4138
MediaObjects,
42-
MediaWorkFlows,
43-
MediaWorkFlowSteps,
4439
Parts,
4540
PeripheralDeviceCommands,
4641
PeripheralDevices,
@@ -624,166 +619,6 @@ describe('test peripheralDevice general API methods', () => {
624619
}
625620
})
626621

627-
// test MediaManagerIntegration API
628-
describe('Media Manager API', () => {
629-
let workFlowId: ProtectedString<any>
630-
let workStepIds: ProtectedString<any>[]
631-
let deviceId: ProtectedString<any>
632-
let device: PeripheralDevice
633-
beforeEach(async () => {
634-
workFlowId = getRandomId()
635-
workStepIds = [getRandomId(), getRandomId()]
636-
deviceId = getRandomId()
637-
env = await setupDefaultStudioEnvironment()
638-
await PeripheralDevices.insertAsync({
639-
_id: deviceId,
640-
organizationId: null,
641-
name: 'Mock Media Manager',
642-
deviceName: 'Media Manager',
643-
studioAndConfigId: {
644-
studioId: env.studio._id,
645-
configId: 'test',
646-
},
647-
category: PeripheralDeviceCategory.MEDIA_MANAGER,
648-
configManifest: {
649-
deviceConfigSchema: JSONBlobStringify({}),
650-
subdeviceManifest: {},
651-
},
652-
connected: true,
653-
connectionId: '0',
654-
created: 0,
655-
lastConnected: 0,
656-
lastSeen: 0,
657-
status: {
658-
statusCode: StatusCode.GOOD,
659-
},
660-
subType: '_process',
661-
token: 'MockToken',
662-
type: PeripheralDeviceType.MEDIA_MANAGER,
663-
})
664-
device = (await PeripheralDevices.findOneAsync(deviceId))!
665-
await MediaWorkFlows.insertAsync({
666-
_id: workFlowId,
667-
_rev: '1',
668-
created: 0,
669-
deviceId: device._id,
670-
priority: 1,
671-
source: 'MockSource',
672-
studioId: device.studioAndConfigId!.studioId,
673-
finished: false,
674-
success: false,
675-
})
676-
await MediaWorkFlowSteps.insertAsync({
677-
_id: workStepIds[0],
678-
_rev: '1',
679-
criticalStep: false,
680-
action: MediaManagerAPI.WorkStepAction.COPY,
681-
deviceId: device._id,
682-
priority: 2,
683-
status: MediaManagerAPI.WorkStepStatus.IDLE,
684-
studioId: device.studioAndConfigId!.studioId,
685-
workFlowId: workFlowId,
686-
})
687-
await MediaWorkFlowSteps.insertAsync({
688-
_id: workStepIds[1],
689-
_rev: '1',
690-
criticalStep: false,
691-
action: MediaManagerAPI.WorkStepAction.GENERATE_METADATA,
692-
deviceId: device._id,
693-
priority: 1,
694-
status: MediaManagerAPI.WorkStepStatus.IDLE,
695-
studioId: device.studioAndConfigId!.studioId,
696-
workFlowId: workFlowId,
697-
})
698-
})
699-
test('getMediaWorkFlowRevisions', async () => {
700-
const workFlows = (
701-
await MediaWorkFlows.findFetchAsync({
702-
studioId: device.studioAndConfigId!.studioId,
703-
})
704-
).map((wf) => ({
705-
_id: wf._id,
706-
_rev: wf._rev,
707-
}))
708-
expect(workFlows.length).toBeGreaterThan(0)
709-
const res = await MeteorCall.peripheralDevice.getMediaWorkFlowRevisions(device._id, device.token)
710-
expect(res).toHaveLength(workFlows.length)
711-
expect(res).toMatchObject(workFlows)
712-
})
713-
test('getMediaWorkFlowStepRevisions', async () => {
714-
const workFlowSteps = (
715-
await MediaWorkFlowSteps.findFetchAsync({
716-
studioId: device.studioAndConfigId!.studioId,
717-
})
718-
).map((wf) => ({
719-
_id: wf._id,
720-
_rev: wf._rev,
721-
}))
722-
expect(workFlowSteps.length).toBeGreaterThan(0)
723-
const res = await MeteorCall.peripheralDevice.getMediaWorkFlowStepRevisions(device._id, device.token)
724-
expect(res).toHaveLength(workFlowSteps.length)
725-
expect(res).toMatchObject(workFlowSteps)
726-
})
727-
describe('updateMediaWorkFlow', () => {
728-
test('update', async () => {
729-
const workFlow = await MediaWorkFlows.findOneAsync(workFlowId)
730-
731-
expect(workFlow).toBeTruthy()
732-
const newWorkFlow = Object.assign({}, workFlow)
733-
newWorkFlow._rev = '2'
734-
newWorkFlow.comment = 'New comment'
735-
736-
await MeteorCall.peripheralDevice.updateMediaWorkFlow(
737-
device._id,
738-
device.token,
739-
newWorkFlow._id,
740-
newWorkFlow
741-
)
742-
743-
const updatedWorkFlow = await MediaWorkFlows.findOneAsync(workFlowId)
744-
expect(updatedWorkFlow).toMatchObject(newWorkFlow)
745-
})
746-
test('remove', async () => {
747-
const workFlow = (await MediaWorkFlows.findOneAsync(workFlowId)) as MediaWorkFlow
748-
expect(workFlow).toBeTruthy()
749-
750-
await MeteorCall.peripheralDevice.updateMediaWorkFlow(device._id, device.token, workFlow._id, null)
751-
752-
const updatedWorkFlow = await MediaWorkFlows.findOneAsync(workFlowId)
753-
expect(updatedWorkFlow).toBeFalsy()
754-
})
755-
})
756-
describe('updateMediaWorkFlowStep', () => {
757-
test('update', async () => {
758-
const workStep = await MediaWorkFlowSteps.findOneAsync(workStepIds[0])
759-
760-
expect(workStep).toBeTruthy()
761-
const newWorkStep = Object.assign({}, workStep)
762-
newWorkStep._rev = '2'
763-
newWorkStep.status = MediaManagerAPI.WorkStepStatus.WORKING
764-
765-
await MeteorCall.peripheralDevice.updateMediaWorkFlowStep(
766-
device._id,
767-
device.token,
768-
newWorkStep._id,
769-
newWorkStep
770-
)
771-
772-
const updatedWorkFlow = await MediaWorkFlowSteps.findOneAsync(workStepIds[0])
773-
expect(updatedWorkFlow).toMatchObject(newWorkStep)
774-
})
775-
test('remove', async () => {
776-
const workStep = (await MediaWorkFlowSteps.findOneAsync(workStepIds[0])) as MediaWorkFlowStep
777-
expect(workStep).toBeTruthy()
778-
779-
await MeteorCall.peripheralDevice.updateMediaWorkFlowStep(device._id, device.token, workStep._id, null)
780-
781-
const updatedWorkFlow = await MediaWorkFlowSteps.findOneAsync(workStepIds[0])
782-
expect(updatedWorkFlow).toBeFalsy()
783-
})
784-
})
785-
})
786-
787622
// test Media Scanner API
788623
describe('Media Scanner API', () => {
789624
let deviceId: ProtectedString<any>
@@ -802,7 +637,7 @@ describe('test peripheralDevice general API methods', () => {
802637
studioId: env.studio._id,
803638
configId: 'test',
804639
},
805-
category: PeripheralDeviceCategory.MEDIA_MANAGER,
640+
category: PeripheralDeviceCategory.PLAYOUT,
806641
configManifest: {
807642
deviceConfigSchema: JSONBlobStringify({}),
808643
subdeviceManifest: {},
@@ -817,7 +652,7 @@ describe('test peripheralDevice general API methods', () => {
817652
},
818653
subType: '_process',
819654
token: 'MockToken',
820-
type: PeripheralDeviceType.MEDIA_MANAGER,
655+
type: PeripheralDeviceType.PLAYOUT,
821656
})
822657
device = (await PeripheralDevices.findOneAsync(deviceId))!
823658

0 commit comments

Comments
 (0)