-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
upgrades.js
145 lines (134 loc) · 3.44 KB
/
upgrades.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import { CreateConvertToBooleanFeedbackUpgradeScript } from '@companion-module/base'
export default [
CreateConvertToBooleanFeedbackUpgradeScript({
streaming: true,
scene_item_active: true,
profile_active: true,
scene_collection_active: true,
scene_item_active_in_scene: true,
output_active: true,
transition_active: true,
current_transition: true,
transition_duration: true,
filter_enabled: true,
}),
function v2_0_0(context, props) {
let changes = {
updatedConfig: null,
updatedActions: [],
updatedFeedbacks: [],
}
if (props.config) {
let config = props.config
if (config.port == undefined || config.port == '' || config.port == 4444) {
config.port = 4455
changes.updatedConfig = config
}
}
for (const action of props.actions) {
if (action.actionId === 'set-freetype-text' || action.actionId === 'set-gdi-text') {
action.actionId = 'setText'
changes.updatedActions.push(action)
}
if (action.actionId === 'take_screenshot') {
action.options.source = 'programScene'
action.options.custom = ''
changes.updatedActions.push(action)
}
}
return changes
},
function v3_1_0(context, props) {
let changes = {
updatedConfig: null,
updatedActions: [],
updatedFeedbacks: [],
}
for (const action of props.actions) {
if (action.actionId === 'quick_transition') {
if (action.options.transition_time > 0) {
action.options.customDuration = true
} else {
action.options.customDuration = false
action.options.transition_time = 500
}
changes.updatedActions.push(action)
}
}
return changes
},
function v3_3_0(context, props) {
let changes = {
updatedConfig: null,
updatedActions: [],
updatedFeedbacks: [],
}
for (const action of props.actions) {
if (action.actionId === 'toggle_filter') {
action.options.all = false
changes.updatedActions.push(action)
}
if (action.actionId === 'toggle_scene_item') {
if (action.options.source === 'allSources') {
action.options.all = true
} else {
action.options.all = false
}
changes.updatedActions.push(action)
}
}
for (const feedback of props.feedbacks) {
if (feedback.feedbackId === 'scene_item_active_in_scene') {
if (feedback.options.source === 'anySource') {
feedback.options.any = true
} else {
feedback.options.any = false
}
changes.updatedFeedbacks.push(feedback)
}
}
return changes
},
function v3_5_0(context, props) {
let changes = {
updatedConfig: null,
updatedActions: [],
updatedFeedbacks: [],
}
for (const feedback of props.feedbacks) {
if (feedback.feedbackId === 'streamCongestion') {
if (!feedback.options.colorNoStream) {
feedback.options = {
colorNoStream: '#484848',
colorLow: '#00c800',
colorMedium: '#ff6600',
colorHigh: '#c80000',
}
}
changes.updatedFeedbacks.push(feedback)
}
}
return changes
},
function v3_7_0(context, props) {
let changes = {
updatedConfig: null,
updatedActions: [],
updatedFeedbacks: [],
}
for (const action of props.actions) {
if (action.actionId === 'set_transition_duration') {
if (action.options.duration < 50) {
action.options.duration = 50
}
if (action.options.duration > 20000) {
action.options.duration = 20000
}
action.options.variableValue = '500'
action.options.useVariable = false
changes.updatedActions.push(action)
}
}
return changes
},
]