forked from bitfocus/companion-module-figure53-qlab-advance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cues.js
86 lines (79 loc) · 1.91 KB
/
cues.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
import * as Colors from './colors.js'
class Cue {
uniqueID = ''
qName = '[none]'
qNumber = ''
qType = null
qMode = null
isLoaded = false
isBroken = false
isRunning = false
isPaused = false
isArmed = false
isFlagged = false
isAuditioning = false
isSelected = false
continueMode = 0
infiniteLoop = false
holdLastFrame = false
autoLoad = false
duration = 0
pctElapsed = 0
elapsed = 0
startedAt = -1
qColor = 0
qColorName = ''
qOrder = -1
qParent = ''
qList = ''
Notes = ''
constructor(j, self) {
if (j != undefined) {
JSONtoCue(this, j, self)
}
}
}
function JSONtoCue(newCue, j, self) {
newCue.uniqueID = j.uniqueID
newCue.qName = j.listName == '' ? '[none]' : j.listName
newCue.qNumber = j.number
newCue.qColorName = j.colorName
newCue.qType = j.type.toLowerCase()
newCue.qMode = j.mode,
newCue.isRunning = j.isRunning
newCue.isAuditioning = j.isAuditioning
newCue.isLoaded = j.isLoaded
newCue.isBroken = j.isBroken
newCue.isPaused = j.isPaused
newCue.isFlagged = j.flagged
newCue.isArmed = j.armed
newCue.autoLoad = j.autoLoad
newCue.continueMode = j.continueMode
newCue.infiniteLoop = j.infiniteLoop
newCue.holdLastFrame = j.holdLastFrame
newCue.duration = j.duration
newCue.qParent = j.parent
newCue.pctElapsed = j.percentActionElapsed
newCue.elapsed = j.actionElapsed
if (j.notes) {
newCue.Notes = j.notes.slice(0, 20)
}
newCue.qColor = Colors.colorRGB[j.colorName.toLowerCase().replaceAll(' ','')]
const isExistingQ = newCue.uniqueID in self.wsCues
if (isExistingQ) {
newCue.qOrder = self.wsCues[newCue.uniqueID].qOrder
}
if (newCue.isRunning || newCue.isPaused) {
if (isExistingQ) {
if (0 == (newCue.startedAt = self.wsCues[newCue.uniqueID].startedAt)) {
newCue.startedAt = Date.now()
}
} else {
newCue.startedAt = Date.now()
//i.debug("--------Cue " + newCue.qNumber + "@" + newCue.startedAt);
}
} else {
newCue.startedAt = 0
}
}
export default Cue