-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ability to create element for templates with no fields
- Loading branch information
1 parent
0e3aff2
commit b10f7b0
Showing
2 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { createMSE } from '../mse' | ||
import * as yargs from 'yargs' | ||
|
||
let args = yargs | ||
.string('host') | ||
.number('port') | ||
.string('profile') | ||
.string('showID') | ||
.string('template') | ||
.boolean('delete') | ||
.number('timing') | ||
.string('httphost') | ||
.number('httpport') | ||
.default('host', 'localhost') | ||
.default('port', 8595) | ||
.default('profile', 'SOFIE') | ||
.default('showID', '66E45216-9476-4BDC-9556-C3DB487ED9DF') | ||
.default('template', 'bund') | ||
.default('delete', true) | ||
.default('timing', 10000) | ||
.default('httphost', '') | ||
.default('httpport', 8580) | ||
.argv | ||
|
||
async function wait (t: number) { | ||
return new Promise((resolve, _reject) => { | ||
setTimeout(resolve, t) | ||
}) | ||
} | ||
|
||
async function run () { | ||
let mse = createMSE(args.host, args.httpport, args.port, args.httphost.length > 0 ? args.httphost : undefined) | ||
let rundown = await mse.createRundown(args.showID, args.profile) | ||
let d = new Date() | ||
let elementName = `CLI_TEST_${d.toISOString()}` | ||
let element = await rundown.createElement(args.template, elementName, args._ ? args._ : []) | ||
console.dir(element, { depth: 20 }) | ||
await rundown.cue(elementName) | ||
await rundown.take(elementName) | ||
await wait(args.timing) | ||
console.log(`Taking element ${elementName} out.`) | ||
await rundown.out(elementName) | ||
if (args['delete']) { | ||
rundown.deleteElement(elementName) | ||
await mse.deleteRundown(rundown) | ||
} | ||
await mse.close() | ||
} | ||
|
||
run().catch(console.error) |