generated from bitfocus/companion-module-template-js
-
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.
* default v2 * handle case where there is no current or next event * fix: speaker msg -> timer msg same as ontime label * add: *MessageVisible variables * add: blink and blackout variable * feat: Toggle/On/Off on all relevant actions * update help * feat: Load and start Cue action * feat: Cue Now and Next variable * feat: Better Add / remove action * feat: feedback Time added or removed * fix: rename delay to added * update presets * fix: case where message is undefined * fix: speaker message -> timer message in feedback * this timer message feedback * fix SetTimerBlink action name * drop v1 support * use new addtime endpoint * bump version
- Loading branch information
Showing
18 changed files
with
431 additions
and
1,521 deletions.
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
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
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
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,70 @@ | ||
import { | ||
// CreateConvertToBooleanFeedbackUpgradeScript, | ||
type CompanionStaticUpgradeProps, | ||
type CompanionStaticUpgradeResult, | ||
type CompanionUpgradeContext, | ||
// type InputValue, | ||
type CompanionStaticUpgradeScript, | ||
type CompanionMigrationAction, | ||
type CompanionMigrationFeedback, | ||
} from '@companion-module/base' | ||
import type { OntimeConfig } from './config' | ||
import { feedbackId, ActionId } from './enums' | ||
|
||
function update2x4x0( | ||
_context: CompanionUpgradeContext<OntimeConfig>, | ||
props: CompanionStaticUpgradeProps<OntimeConfig> | ||
): CompanionStaticUpgradeResult<OntimeConfig> { | ||
const result = { | ||
updatedConfig: null, | ||
updatedActions: new Array<CompanionMigrationAction>(), | ||
updatedFeedbacks: new Array<CompanionMigrationFeedback>(), | ||
} | ||
if (_context.currentConfig.version === 'v1') { | ||
for (const action of props.actions) { | ||
if (action.actionId === 'setSpeakerMessageVisibility') { | ||
action.actionId = ActionId.SetTimerMessageVisibility | ||
result.updatedActions.push(action) | ||
} else if (action.actionId === 'setSpeakerMessage') { | ||
action.actionId = ActionId.SetTimerMessage | ||
result.updatedActions.push(action) | ||
} else if (action.actionId === 'delay') { | ||
action.actionId = ActionId.Add | ||
result.updatedActions.push(action) | ||
} | ||
} | ||
for (const feedback of props.feedbacks) { | ||
if (feedback.feedbackId === 'speakerMessageVisible') { | ||
feedback.feedbackId = feedbackId.TimerMessageVisible | ||
result.updatedFeedbacks.push(feedback) | ||
} | ||
} | ||
} else if (_context.currentConfig.version === 'v2') { | ||
for (const action of props.actions) { | ||
if (action.actionId === 'setSpeakerMessageVisibility') { | ||
action.actionId = ActionId.SetTimerMessageVisibility | ||
result.updatedActions.push(action) | ||
} else if (action.actionId === 'setSpeakerMessage') { | ||
action.actionId = ActionId.SetTimerMessage | ||
result.updatedActions.push(action) | ||
} else if (action.actionId === 'delay') { | ||
action.actionId = ActionId.Add | ||
action.options.addremove = (action.options.value as number) >= 0 ? 'add' : 'remove' | ||
action.options.minutes = Math.abs(action.options.value as number) | ||
action.options.hours = 0 | ||
action.options.seconds = 0 | ||
result.updatedActions.push(action) | ||
} | ||
} | ||
for (const feedback of props.feedbacks) { | ||
if (feedback.feedbackId === 'speakerMessageVisible') { | ||
feedback.feedbackId = feedbackId.TimerMessageVisible | ||
result.updatedFeedbacks.push(feedback) | ||
} | ||
} | ||
} | ||
|
||
return result | ||
} | ||
|
||
export const UpgradeScripts: CompanionStaticUpgradeScript<OntimeConfig>[] = [update2x4x0] |
Oops, something went wrong.