Skip to content

Commit

Permalink
Release v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcHagen committed Aug 28, 2019
1 parent 5099a06 commit 9529eec
Show file tree
Hide file tree
Showing 6 changed files with 212 additions and 18 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ insert_final_newline = true
[*.js]
indent_style = tab
indent_size = 4

[package.json]
indent_style = space
indent_size = 2
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,24 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

---
## [Unreleased]

1.0.0 (Work In Progress)
---

## [1.0.1] (2019-08-28)
## New Features
### Dynamic generated preset
With this new feature we have added presets to the module.
These presets are, for now, dynamically updated for every channel,
publisher and recoreder that is configured on the Pearl.

## Bug Fixes
* [#1](https://github.com/bitfocus/companion-module-epiphan-pearl/issues/1) - Error on feedback channel layout

---

## [1.0.0] (2019-08-18)
## New Features
Actions:
* Change channel layout
* Start/Stop streaming (per stream or all)
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed re
### License

The MIT License (MIT). Please see [License File](LICENSE) for more information.

### Development

This module has a `develop` branch with the latest changes.
The `master` branch is for "releases" for [companion](https://github.com/bitfocus/companion)
18 changes: 13 additions & 5 deletions feedbacks.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {

/**
* INTERNAL: Get the available feedbacks.
*
Expand All @@ -9,7 +10,7 @@ module.exports = {
getFeedbacks() {
let feedbacks = {};

feedbacks['channel_layout'] = {
feedbacks['channelLayout'] = {
label: 'Change colors on channel layout change',
description: 'If the current layout is active, change color of the bank',
options: [
Expand All @@ -33,6 +34,10 @@ module.exports = {
},
],
callback: (feedback, bank) => {
if (!feedback.options.channelIdlayoutId) {
return {};
}

const [channelId, layoutId] = feedback.options.channelIdlayoutId.split('-');
const layout = this._getLayoutFromChannelById(this._getChannelById(channelId), layoutId);
if (!layout) {
Expand All @@ -49,7 +54,7 @@ module.exports = {
}
};

feedbacks['streaming'] = {
feedbacks['channelStreaming'] = {
label: 'Change colors if streaming',
description: 'If channel is streaming, change colors of the bank',
options: [
Expand All @@ -73,6 +78,10 @@ module.exports = {
},
],
callback: (feedback, bank) => {
if (!feedback.options.channelIdpublisherId) {
return {};
}

const [channelId, publisherId] = feedback.options.channelIdpublisherId.split('-');
const channel = this._getChannelById(channelId);
if (!channel) {
Expand All @@ -95,7 +104,7 @@ module.exports = {
}
};

feedbacks['recording'] = {
feedbacks['recorderRecording'] = {
label: 'Change colors if recording',
description: 'If channel/recorder is recording, change colors of the bank',
options: [
Expand All @@ -119,8 +128,7 @@ module.exports = {
},
],
callback: (feedback, bank) => {
const recorderId = feedback.options.recorderId;
const recorder = this._getRecorderById(recorderId);
const recorder = this._getRecorderById(feedback.options.recorderId);
if (this._isRecorderRecording(recorder)) {
return {
color: feedback.options.fg,
Expand Down
43 changes: 31 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const request = require('request');
let debug, log;

const feedbacks = require('./feedbacks');
const presets = require('./presets');

const TYPE_LAYOUT = 1;
const TYPE_PUBLISHER = 2;
Expand Down Expand Up @@ -59,7 +60,7 @@ class EpiphanPearl extends instanceSkel {
Object.assign(this, {
//...actions,
...feedbacks,
//...presets,
...presets,
//...variables
});
}
Expand Down Expand Up @@ -123,8 +124,9 @@ class EpiphanPearl extends instanceSkel {
* @access public
* @since 1.0.0
* @param {Object} action - the action to be executed
* @param {Object} deviceInfo - information from where the button was pressed...
*/
action(action) {
action(action, deviceInfo) {
let type = 'get', url, body, callback;

switch (action.action) {
Expand All @@ -135,7 +137,7 @@ class EpiphanPearl extends instanceSkel {
url = '/api/channels/' + channelId + '/layouts/active';
body = {id: layoutId};
callback = (err, response) => {
if (response.status === 'ok') {
if (response && response.status === 'ok') {
this._updateActiveChannelLayout(channelId, layoutId);
}
};
Expand All @@ -160,7 +162,7 @@ class EpiphanPearl extends instanceSkel {
type = 'post';
url = '/api/recorders/' + recorderId + '/control/' + startStopAction;
callback = (err, response) => {
if (response.status === 'ok') {
if (response && response.status === 'ok') {
this._updateRecorderStatus(recorderId);
}
};
Expand Down Expand Up @@ -391,7 +393,7 @@ class EpiphanPearl extends instanceSkel {
// Be positive and switch channels in advance.
activeLayout.active = false;
newActiveLayout.active = true;
this.checkFeedbacks('channel_layout');
this.checkFeedbacks('channelLayout');
}

/**
Expand Down Expand Up @@ -475,6 +477,7 @@ class EpiphanPearl extends instanceSkel {
_updateSystem() {
this.actions();
this._updateFeedbacks();
this._updatePresets();
}

/**
Expand All @@ -491,7 +494,7 @@ class EpiphanPearl extends instanceSkel {
}) {
const self = this;
const apiHost = this.config.host,
baseUrl = 'http://' + apiHost;
baseUrl = 'http://' + apiHost;

if (url === null || url === '') {
this._setStatus(this.STATUS_ERROR, 'No URL given for _sendRequest');
Expand Down Expand Up @@ -592,6 +595,16 @@ class EpiphanPearl extends instanceSkel {
this.setFeedbackDefinitions(this.getFeedbacks());
}

/**
* INTERNAL: initialize presets.
*
* @private
* @since [Unreleased]
*/
_updatePresets() {
this.setPresetDefinitions(this.getPresets());
}

/**
* INTERNAL: initialize interval data poller.
* Polling data such as channels, recorders, layouts
Expand Down Expand Up @@ -741,7 +754,9 @@ class EpiphanPearl extends instanceSkel {
const layout = layouts[b];
tempLayouts.push({
id: channel.id + '-' + layout.id,
label: channel.label + ' - ' + layout.name
label: channel.label + ' - ' + layout.name,
channelLabel: channel.label,
layoutLabel: layout.name
});

const objIndex = channel.layouts.findIndex(obj => obj.id === parseInt(layout.id));
Expand All @@ -759,7 +774,7 @@ class EpiphanPearl extends instanceSkel {

self.debug('Updating CHOICES_CHANNELS_LAYOUTS and then call _updateSystem()');
self.CHOICES_CHANNELS_LAYOUTS = tempLayouts.slice();
self.checkFeedbacks('channel_layout');
self.checkFeedbacks('channelLayout');
self._updateSystem();
});
}
Expand Down Expand Up @@ -790,7 +805,9 @@ class EpiphanPearl extends instanceSkel {

tempPublishers.push({
id: currentChannel.id + '-all',
label: currentChannel.label + ' - All'
label: currentChannel.label + ' - All',
channelLabel: currentChannel.label,
publisherLabel: 'All'
});
for (const b in apiChannel.publishers) {
const publisher = apiChannel.publishers[b];
Expand All @@ -801,7 +818,9 @@ class EpiphanPearl extends instanceSkel {

tempPublishers.push({
id: currentChannel.id + '-' + currentPublisher.id,
label: currentChannel.label + ' - ' + currentPublisher.label
label: currentChannel.label + ' - ' + currentPublisher.label,
channelLabel: currentChannel.label,
publisherLabel: currentPublisher.label
});

const status = publisher.status;
Expand All @@ -814,7 +833,7 @@ class EpiphanPearl extends instanceSkel {

self.debug('Updating CHOICES_CHANNELS_PUBLISHERS and then call _updateSystem()');
self.CHOICES_CHANNELS_PUBLISHERS = tempPublishers.slice();
self.checkFeedbacks('streaming');
self.checkFeedbacks('channelStreaming');
self._updateSystem();
});
}
Expand Down Expand Up @@ -850,7 +869,7 @@ class EpiphanPearl extends instanceSkel {
}

self.debug('Updating RECORDER_STATES and then call _updateSystem()');
self.checkFeedbacks('recording');
self.checkFeedbacks('recorderRecording');
self._updateSystem();
});
}
Expand Down
Loading

0 comments on commit 9529eec

Please sign in to comment.