-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeedbacks.js
127 lines (121 loc) · 3.55 KB
/
feedbacks.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
const { combineRgb } = require('@companion-module/base')
module.exports = async function (self) {
self.setFeedbackDefinitions({
playlist_feedback: {
name: 'Playlist',
type: 'boolean',
label: 'Change style if playing',
description: 'This feedback will change the style of the button based on your selected playlist ID.',
options: [
{
type: 'textinput',
label: 'Playlist ID',
id: 'id',
default: '',
required: true,
},
],
defaultStyle: {
bgcolor: combineRgb(0, 255, 0),
color: combineRgb(0, 0, 0),
},
callback: (feedback) => {
// Return true if playing, changing the button style
return self.PlaylistPlaybackState.playlist?.id === feedback.options.id
},
},
playlist_playback_feedback: {
name: 'Playlist Playback State',
type: 'boolean',
label: 'Change style if playing',
description: 'This feedback will change the style of the button based on whether a track is currently playing.',
defaultStyle: {
bgcolor: combineRgb(0, 255, 0),
color: combineRgb(0, 0, 0),
},
callback: () => {
// Return true if playing, changing the button style
return self.PlaylistPlaybackState.playing
},
},
playlist_shuffle_feedback: {
name: 'Playlist Shuffle State',
type: 'boolean',
label: 'Change style if playing',
description: 'This feedback will change the style of the button based on whether Shuffle is currently on.',
defaultStyle: {
bgcolor: combineRgb(0, 255, 0),
color: combineRgb(0, 0, 0),
},
callback: () => {
// Return true if playing, changing the button style
return self.PlaylistPlaybackState.shuffle
},
},
playlist_mute_feedback: {
name: 'Playlist Mute State',
type: 'boolean',
label: 'Change style if playing',
description: 'This feedback will change the style of the button based on whether Mute is currently on.',
defaultStyle: {
bgcolor: combineRgb(0, 255, 0),
color: combineRgb(0, 0, 0),
},
callback: () => {
// Return true if playing, changing the button style
return self.PlaylistPlaybackState.muted
},
},
playlist_repeat_feedback: {
name: 'Playlist Repeat State',
type: 'boolean',
label: 'Change style if selected state',
description:
'This feedback will change the style of the button based on whether what Repeat state is on and selected.',
defaultStyle: {
bgcolor: combineRgb(0, 255, 0),
color: combineRgb(0, 0, 0),
},
options: [
{
id: 'repeat_state',
type: 'dropdown',
label: 'Repeat State',
default: 'off', // Set a default value
choices: [
{ id: 'track', label: 'Track' },
{ id: 'playlist', label: 'Playlist' },
{ id: 'off', label: 'Off' },
],
},
],
callback: (feedback) => {
// Check if the current repeat state matches the user-selected state
return self.PlaylistPlaybackState.repeat === feedback.options.repeat_state
},
},
soundboard_sound_feedback: {
name: 'Soundboard Sound',
type: 'boolean',
label: 'Change style if playing',
description: 'This feedback will change the style of the button based on your selected Sound ID.',
options: [
{
type: 'textinput',
label: 'Sound ID',
id: 'id',
default: '',
required: true,
},
],
defaultStyle: {
bgcolor: combineRgb(0, 255, 0),
color: combineRgb(0, 0, 0),
},
callback: (feedback) => {
// Check if the sound with the given ID is in the currently playing sounds
return self.SoundboardPlaybackState.sounds.some((sound) => sound.id === feedback.options.id)
},
},
})
}