Skip to content

Commit

Permalink
Parse variables for actions
Browse files Browse the repository at this point in the history
  • Loading branch information
istnv committed Dec 2, 2022
1 parent e6cd32a commit 1103412
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"legacy": [
"qlab-advance"
],
"version": "1.5.0",
"version": "1.5.1",
"api_version": "1.0.0",
"keywords": [
"Software",
Expand Down
41 changes: 25 additions & 16 deletions qlabfb.js
Original file line number Diff line number Diff line change
Expand Up @@ -1212,16 +1212,29 @@ instance.prototype.action = function (action) {
var nc = self.wsCues[self.nextCue]
var optTime
var typeTime
var optCue
var optCueId

// internal function for action (not anonymous)
// self is properly scoped to next outer closure
function setToggle(oldVal, opt) {
return '2' == opt ? 1 - (oldVal ? 1 : 0) : parseInt(opt)
}

self.parseVariables(opt.cue, function (v) {
optCue = v
})

self.parseVariables(opt.cueId, function (v) {
optCueId = v
})

// if this is a +/- time action, preformat seconds arg
if (opt != undefined && opt.time != undefined) {
optTime = parseFloat(opt.time)
self.parseVariables(opt.time, function (v) {
optTime = v
})
optTime = parseFloat(optTime)
if (optTime.isInteger) {
typeTime = 'i'
} else {
Expand All @@ -1231,23 +1244,24 @@ instance.prototype.action = function (action) {

switch (action.action) {
case 'start':
cmd = '/cue/' + opt.cue + '/start'
cmd = '/cue/' + optCue + '/start'
break

case 'goto':
cmd = '/playhead/' + opt.cue
cmd = '/playhead/' + optCue
break

case 'copyCueID':
self.actions()
self.init_feedbacks()
break

case 'start_id':
cmd = '/cue_id/' + opt.cueId + '/start'
cmd = '/cue_id/' + optCueId + '/start'
break

case 'goto_id':
cmd = '/playheadId/' + opt.cueId
cmd = '/playheadId/' + optCueId
break

case 'go':
Expand All @@ -1274,17 +1288,12 @@ instance.prototype.action = function (action) {
cmd = '/cue/selected/stop'
break

case 'copyCueId':
self.actions()
self.init_feedbacks()
break

case 'stop_cue':
cmd = '/cue/' + opt.cue + '/stop'
cmd = '/cue/' + optCue + '/stop'
break

case 'stop_id':
cmd = '/cue_id/' + opt.cueId + '/stop'
cmd = '/cue_id/' + optCueId + '/stop'
break

case 'panic':
Expand All @@ -1304,23 +1313,23 @@ instance.prototype.action = function (action) {
break

case 'panic_cue':
cmd = '/cue/' + opt.cue + '/panic'
cmd = '/cue/' + optCue + '/panic'
break

case 'panicInTime_cue':
cmd = '/cue/' + opt.cue + '/panicInTime'
cmd = '/cue/' + optCue + '/panicInTime'
arg = {
type: typeTime,
value: optTime,
}
break

case 'panic_id':
cmd = '/cue_id/' + opt.cueId + '/panic'
cmd = '/cue_id/' + optCueId + '/panic'
break

case 'panicInTime_id':
cmd = '/cue_id/' + opt.cueId + '/panicInTime'
cmd = '/cue_id/' + optCueId + '/panicInTime'
arg = {
type: typeTime,
value: optTime,
Expand Down

0 comments on commit 1103412

Please sign in to comment.