@tv2media/v-connection
Advanced tools
Comparing version 5.0.0 to 5.0.1
@@ -5,2 +5,8 @@ # Changelog | ||
### [5.0.1](https://github.com/tv2/v-connection/compare/v5.0.0...v5.0.1) (2021-09-19) | ||
### Bug Fixes | ||
- rundown.deleteElement() didn't work ([645e486](https://github.com/tv2/v-connection/commit/645e4868c1f84c7c423bf18b70f1979b7fdde967)) | ||
### [4.0.3](https://github.com/tv2/v-connection/compare/v4.0.2...v4.0.3) (2021-08-30) | ||
@@ -7,0 +13,0 @@ |
@@ -37,2 +37,3 @@ import { VRundown, VTemplate, InternalElement, ExternalElement, VElement, ExternalElementId } from './v-connection'; | ||
isActive(): Promise<boolean>; | ||
private getExternalElementPath; | ||
} |
@@ -61,6 +61,15 @@ "use strict"; | ||
} | ||
ref(vcpid, channel) { | ||
ref(vcpid, channel, unescape = false) { | ||
var _a; | ||
const key = Rundown.makeKey(vcpid, channel); | ||
return ((_a = this.channelMap[key]) === null || _a === void 0 ? void 0 : _a.refName) ? this.channelMap[key].refName.replace('#', '%23') : 'ref'; | ||
let str = ((_a = this.channelMap[key]) === null || _a === void 0 ? void 0 : _a.refName) || 'ref'; | ||
if (unescape) { | ||
// Return the unescaped string | ||
str = str.replace('%23', '#'); | ||
} | ||
else { | ||
// Return the escaped string | ||
str = str.replace('#', '%23'); | ||
} | ||
return str; | ||
} | ||
@@ -218,7 +227,9 @@ async listTemplates() { | ||
else { | ||
// Note: For some reason, in contrast to the other commands, the delete command only works with the path being unescaped: | ||
const path = this.getExternalElementPath(elementName, channel, true); | ||
if (await this.buildChannelMap(elementName, channel)) { | ||
return this.pep.delete(`/storage/playlists/{${this.playlist}}/elements/${this.ref(elementName, channel)}`); | ||
return this.pep.delete(path); | ||
} | ||
else { | ||
throw new peptalk_1.InexistentError(-1, `/storage/playlists/{${this.playlist}}/elements/${this.ref(elementName, channel)}`); | ||
throw new peptalk_1.InexistentError(-1, path); | ||
} | ||
@@ -232,7 +243,8 @@ } | ||
else { | ||
const path = this.getExternalElementPath(elementName, channel); | ||
if (await this.buildChannelMap(elementName, channel)) { | ||
return this.msehttp.cue(`/storage/playlists/{${this.playlist}}/elements/${this.ref(elementName, channel)}`); | ||
return this.msehttp.cue(path); | ||
} | ||
else { | ||
throw new msehttp_1.HTTPRequestError(`Cannot cue external element as ID '${elementName}' is not known in this rundown.`, this.msehttp.baseURL, `/storage/playlists/{${this.playlist}}/elements/${this.ref(elementName, channel)}`); | ||
throw new msehttp_1.HTTPRequestError(`Cannot cue external element as ID '${elementName}' is not known in this rundown.`, this.msehttp.baseURL, path); | ||
} | ||
@@ -246,7 +258,8 @@ } | ||
else { | ||
const path = this.getExternalElementPath(elementName, channel); | ||
if (await this.buildChannelMap(elementName, channel)) { | ||
return this.msehttp.take(`/storage/playlists/{${this.playlist}}/elements/${this.ref(elementName, channel)}`); | ||
return this.msehttp.take(path); | ||
} | ||
else { | ||
throw new msehttp_1.HTTPRequestError(`Cannot take external element as ID '${elementName}' is not known in this rundown.`, this.msehttp.baseURL, `/storage/playlists/{${this.playlist}}/elements/${this.ref(elementName, channel)}`); | ||
throw new msehttp_1.HTTPRequestError(`Cannot take external element as ID '${elementName}' is not known in this rundown.`, this.msehttp.baseURL, path); | ||
} | ||
@@ -260,7 +273,8 @@ } | ||
else { | ||
const path = this.getExternalElementPath(elementName, channel); | ||
if (await this.buildChannelMap(elementName, channel)) { | ||
return this.msehttp.continue(`/storage/playlists/{${this.playlist}}/elements/${this.ref(elementName, channel)}`); | ||
return this.msehttp.continue(path); | ||
} | ||
else { | ||
throw new msehttp_1.HTTPRequestError(`Cannot continue external element as ID '${elementName}' is not known in this rundown.`, this.msehttp.baseURL, `/storage/playlists/{${this.playlist}}/elements/${this.ref(elementName, channel)}`); | ||
throw new msehttp_1.HTTPRequestError(`Cannot continue external element as ID '${elementName}' is not known in this rundown.`, this.msehttp.baseURL, path); | ||
} | ||
@@ -274,7 +288,8 @@ } | ||
else { | ||
const path = this.getExternalElementPath(elementName, channel); | ||
if (await this.buildChannelMap(elementName, channel)) { | ||
return this.msehttp.continueReverse(`/storage/playlists/{${this.playlist}}/elements/${this.ref(elementName, channel)}`); | ||
return this.msehttp.continueReverse(path); | ||
} | ||
else { | ||
throw new msehttp_1.HTTPRequestError(`Cannot continue reverse external element as ID '${elementName}' is not known in this rundown.`, this.msehttp.baseURL, `/storage/playlists/{${this.playlist}}/elements/${this.ref(elementName, channel)}`); | ||
throw new msehttp_1.HTTPRequestError(`Cannot continue reverse external element as ID '${elementName}' is not known in this rundown.`, this.msehttp.baseURL, path); | ||
} | ||
@@ -288,7 +303,8 @@ } | ||
else { | ||
const path = this.getExternalElementPath(elementName, channel); | ||
if (await this.buildChannelMap(elementName, channel)) { | ||
return this.msehttp.out(`/storage/playlists/{${this.playlist}}/elements/${this.ref(elementName, channel)}`); | ||
return this.msehttp.out(path); | ||
} | ||
else { | ||
throw new msehttp_1.HTTPRequestError(`Cannot take out external element as ID '${elementName}' is not known in this rundown.`, this.msehttp.baseURL, `/storage/playlists/{${this.playlist}}/elements/${this.ref(elementName, channel)}`); | ||
throw new msehttp_1.HTTPRequestError(`Cannot take out external element as ID '${elementName}' is not known in this rundown.`, this.msehttp.baseURL, path); | ||
} | ||
@@ -298,7 +314,8 @@ } | ||
async initialize(elementName, channel) { | ||
const path = this.getExternalElementPath(elementName, channel); | ||
if (await this.buildChannelMap(elementName, channel)) { | ||
return this.msehttp.initialize(`/storage/playlists/{${this.playlist}}/elements/${this.ref(elementName, channel)}`); | ||
return this.msehttp.initialize(path); | ||
} | ||
else { | ||
throw new msehttp_1.HTTPRequestError(`Cannot initialize external element as ID '${elementName}' is not known in this rundown.`, this.msehttp.baseURL, `/storage/playlists/{${this.playlist}}/elements/${this.ref(elementName, channel)}`); | ||
throw new msehttp_1.HTTPRequestError(`Cannot initialize external element as ID '${elementName}' is not known in this rundown.`, this.msehttp.baseURL, path); | ||
} | ||
@@ -369,4 +386,7 @@ } | ||
} | ||
getExternalElementPath(elementName, channel, unescape = false) { | ||
return `/storage/playlists/{${this.playlist}}/elements/${this.ref(elementName, channel, unescape)}`; | ||
} | ||
} | ||
exports.Rundown = Rundown; | ||
//# sourceMappingURL=rundown.js.map |
{ | ||
"name": "@tv2media/v-connection", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "Sofie TV Automation Vizrt Media Sequencer Engine connection library", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -43,9 +43,9 @@ # Sofie TV Automation Media Sequencer Engine connection library | ||
npm install v-connection | ||
yarn add v-connection | ||
npm install @tv2media/v-connection | ||
yarn add @tv2media/v-connection | ||
Import into your project with one of: | ||
const { createMSE, MSE } = require('v-connection') | ||
import { createMSE, MSE } from 'v-connection' | ||
const { createMSE, MSE } = require('@tv2media/v-connection') | ||
import { createMSE, MSE } from '@tv2media/v-connection' | ||
@@ -52,0 +52,0 @@ Use factory `createMSE` to create a connection to a running MSE, e.g.: |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
169795
2463