Skip to content

Commit

Permalink
Release v1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcHagen committed Feb 12, 2021
2 parents 940b583 + 1d23c95 commit f22fec8
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
node_modules/

# Temp store for pearl files.
# Which cannot be commited due to licence
doc/source/
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

---
## [1.0.5] (2021-02-12)

## Bug Fixes
* [#5](https://github.com/bitfocus/companion-module-epiphan-pearl/issues/5) - Dropdown list not updating with correct ids
This now results in an extra entry '---' to force the user to select a Channel or Recorder and assosiated action

---
## [1.0.4] (2021-01-30)
Expand Down
33 changes: 25 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class EpiphanPearl extends instanceSkel {
this.CHOICES_RECORDERS = [];

this.CHOICES_STARTSTOP = [
{id: 99, label: '---', action: ''},
{id: 1, label: 'Start', action: 'start'},
{id: 0, label: 'Stop', action: 'stop'}
];
Expand Down Expand Up @@ -80,14 +81,25 @@ class EpiphanPearl extends instanceSkel {
choices: this.CHOICES_STARTSTOP
};

// Companion has difficulties with the first 'default' selected value.
// It will then return undefined (null) until you change/update the dropdown selection.
let channels = [{id: '0-0', label: '---'}];
Array.prototype.push.apply(channels,this.CHOICES_CHANNELS_LAYOUTS);

let publishers = [{id: '0-0', label: '---'}];
Array.prototype.push.apply(publishers,this.CHOICES_CHANNELS_PUBLISHERS);

let recorders = [{id: '0', label: '---'}];
Array.prototype.push.apply(recorders,this.CHOICES_RECORDERS);

this.setActions({
'channelChangeLayout': {
label: 'Change channel layout',
options: [{
type: 'dropdown',
id: 'channelIdlayoutId',
label: 'Change layout to:',
choices: this.CHOICES_CHANNELS_LAYOUTS
choices: channels
}]
},
'channelStreaming': {
Expand All @@ -97,7 +109,7 @@ class EpiphanPearl extends instanceSkel {
type: 'dropdown',
label: 'Channel publishers',
id: 'channelIdpublisherId',
choices: this.CHOICES_CHANNELS_PUBLISHERS,
choices: publishers,
tooltip: 'If a channel has only one "publisher" or "stream" then you just select all. Else you can pick the "publisher" you want to start/stop'
},
startStopOption
Expand All @@ -110,7 +122,7 @@ class EpiphanPearl extends instanceSkel {
type: 'dropdown',
label: 'Recorder',
id: 'recorderId',
choices: this.CHOICES_RECORDERS
choices: recorders,
},
startStopOption
],
Expand Down Expand Up @@ -169,7 +181,7 @@ class EpiphanPearl extends instanceSkel {
this.log('error', 'Action on non existing channel: ' + channelId);
break;
}
if (!this._checkValidPublisherId(channelId, publishersId)) {
if (publishersId !== 'all' && !this._checkValidPublisherId(channelId, publishersId)) {
this._setStatus(
this.STATUS_ERROR,
'Action on non existing publisher! Please review you\'re button config.'
Expand Down Expand Up @@ -197,6 +209,7 @@ class EpiphanPearl extends instanceSkel {
break;
}
case 'recorderRecording': {
this.debug(action);
const recorderId = action.options.recorderId;
if (!this._getRecorderById(recorderId)) {
this._setStatus(
Expand Down Expand Up @@ -349,6 +362,10 @@ class EpiphanPearl extends instanceSkel {
*/
_getStartStopActionFromOptions(options) {
const startStopActionId = parseInt(options.startStopAction);
if (!options.startStopAction || startStopActionId === 99) {
return null;
}

const action = this.CHOICES_STARTSTOP.find((e) => {
return e.id === startStopActionId;
}).action
Expand Down Expand Up @@ -589,7 +606,7 @@ class EpiphanPearl extends instanceSkel {
}) {
const self = this;
const apiHost = this.config.host,
baseUrl = 'http://' + apiHost;
baseUrl = 'http://' + apiHost + ':8850';

if (url === null || url === '') {
this._setStatus(this.STATUS_ERROR, 'No URL given for _sendRequest');
Expand Down Expand Up @@ -630,9 +647,9 @@ class EpiphanPearl extends instanceSkel {
json: body
},
(error, response, body) => {
self.debug(JSON.stringify(error));
//self.debug(JSON.stringify(response));
self.debug(JSON.stringify(body));
self.debug('error: ' + JSON.stringify(error));
//self.debug('response: ' + JSON.stringify(response));
self.debug('body:' + JSON.stringify(body));

if (error && error.code === 'ETIMEDOUT') {
self._setStatus(self.STATUS_ERROR, 'Connection timeout while connecting to ' + requestUrl);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "epiphan-pearl",
"version": "1.0.4",
"version": "1.0.5",
"manufacturer": "Epiphan",
"product": "Pearl",
"shortname": "pearl",
Expand Down

0 comments on commit f22fec8

Please sign in to comment.