qcmd 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +13 -2
- data/README.md +64 -66
- data/lib/qcmd.rb +3 -1
- data/lib/qcmd/action.rb +3 -164
- data/lib/qcmd/actions/action.rb +4 -0
- data/lib/qcmd/actions/base_action.rb +139 -0
- data/lib/qcmd/actions/cue_action.rb +27 -0
- data/lib/qcmd/cli.rb +20 -15
- data/lib/qcmd/core_ext/osc/tcp_client.rb +5 -0
- data/lib/qcmd/version.rb +1 -1
- data/qcmd.gemspec +1 -1
- data/spec/unit/cli_spec.rb +5 -0
- data/spec/unit/commands_spec.rb +15 -4
- metadata +6 -3
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
### 0.1.8
|
1
|
+
### 0.1.8 to 0.1.9
|
2
2
|
|
3
|
-
* add "alias" command
|
3
|
+
* add help documentation for the "alias" command
|
4
4
|
* add "new" command to create new cues in QLab
|
5
5
|
* add "select" command to allow selection of a given cue (by number)
|
6
6
|
* `select 2; go` would select and start the QLab workspace at the given cue
|
@@ -15,4 +15,15 @@ Internals:
|
|
15
15
|
* fix `-c "COMMAND"` command line option
|
16
16
|
* various small bug fixes
|
17
17
|
|
18
|
+
### 0.1.7 to 0.1.8
|
18
19
|
|
20
|
+
* create "alias" command to allow creation of commands from qcmd interactive interface
|
21
|
+
* add ".." (disconnect one level) command
|
22
|
+
* update location of qcmd settings and log files: `/Users/$USER/.qcmd/`
|
23
|
+
* replace CLI parser with aarongough/sexpistol
|
24
|
+
* use TCP connection and alwaysReply instead of UDP connection
|
25
|
+
* show current time and connection state in interactive mode
|
26
|
+
* persist command history across interactive qcmd sessions
|
27
|
+
* allow multiple commands separated with ";". For example,
|
28
|
+
`cue 1 name; cue 2 name` would show the names of cues 1 and 2.
|
29
|
+
* better debug logging
|
data/README.md
CHANGED
@@ -35,7 +35,9 @@ From there, you can connect to a machine, connect to a workspace, and then
|
|
35
35
|
send commands to cues and the workspace.
|
36
36
|
|
37
37
|
`qcmd` supports tab completion for commands in case you get stuck or are
|
38
|
-
wondering what you can do from the console.
|
38
|
+
wondering what you can do from the console. Type the beginning of a command and
|
39
|
+
hit tab to auto-complete the command, or hit it twice to see all possible
|
40
|
+
completions.
|
39
41
|
|
40
42
|
Run `qcmd` with the -v option to get full debugging output. Use the main
|
41
43
|
project repository (https://github.com/Figure53/qcmd) to report any issues.
|
@@ -43,95 +45,91 @@ project repository (https://github.com/Figure53/qcmd) to report any issues.
|
|
43
45
|
An example session might look like this:
|
44
46
|
|
45
47
|
$ qcmd
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
48
|
+
.:::: .:: .::
|
49
|
+
.:: .:: .:: .::
|
50
|
+
.:: .::.:: .:: .::
|
51
|
+
.:: .::.:: .:: .:: .:: .::
|
52
|
+
.:: .::.:: .:: .:: .:: .::
|
53
|
+
.:: .: .:: .:: .:: .:: .:: .::
|
54
|
+
.:: :: .:::::::: .:: .:::.:: .::
|
55
|
+
.:
|
54
56
|
|
55
|
-
|
57
|
+
qcmd 0.1.9 (c) 2012 Figure 53, Baltimore, MD.
|
56
58
|
|
57
59
|
Found 2 QLab machines
|
58
60
|
|
59
|
-
1.
|
60
|
-
2.
|
61
|
+
1. my-mac-laptop
|
62
|
+
2. f53imac
|
61
63
|
|
62
|
-
|
64
|
+
Type `connect "MACHINE NAME"` or `connect IP_ADDRESS` to connect to a machine
|
63
65
|
|
64
|
-
|
65
|
-
|
66
|
-
|
66
|
+
13:40
|
67
|
+
> connect my-mac-laptop
|
68
|
+
Connecting to machine: my-mac-laptop
|
69
|
+
Connected to machine "my-mac-laptop"
|
70
|
+
Connecting to workspace: Untitled Workspace 1
|
71
|
+
Connected to "Untitled Workspace 1"
|
72
|
+
Loaded 3 cues
|
73
|
+
13:41 [my-mac-laptop] [Untitled Workspace 1]
|
74
|
+
> cues
|
67
75
|
|
68
|
-
|
76
|
+
------------------------------- Cues: Main Cue List -------------------------------
|
69
77
|
|
70
|
-
|
71
|
-
passcode if your workspace uses one
|
78
|
+
Number Id Name Type
|
72
79
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
loaded 2 cues
|
77
|
-
adam-retina:Untitled Workspace> cues
|
80
|
+
1 1 YOP Audio
|
81
|
+
2 2 Not Armory Audio
|
82
|
+
3 3 BUTT Audio
|
78
83
|
|
79
|
-
----------------------------------- Cues -----------------------------------
|
80
84
|
|
81
|
-
|
85
|
+
13:41 [my-mac-laptop] [Untitled Workspace 1]
|
86
|
+
> cue 3 name "Fix this name"
|
87
|
+
ok
|
88
|
+
13:41 [my-mac-laptop] [Untitled Workspace 1] [3 Fix this name]
|
89
|
+
> start
|
90
|
+
ok
|
91
|
+
13:41 [my-mac-laptop] [Untitled Workspace 1] [3 Fix this name]
|
92
|
+
> ..
|
93
|
+
13:41 [my-mac-laptop] [Untitled Workspace 1]
|
94
|
+
> hardStop
|
95
|
+
ok
|
96
|
+
13:41 [my-mac-laptop] [Untitled Workspace 1]
|
97
|
+
> copy-name 3 2
|
98
|
+
ok
|
99
|
+
13:41 [my-mac-laptop] [Untitled Workspace 1] [2 Fix this name]
|
100
|
+
> cues
|
82
101
|
|
83
|
-
|
84
|
-
2 3 Nipe Audio
|
102
|
+
------------------------------- Cues: Main Cue List -------------------------------
|
85
103
|
|
104
|
+
Number Id Name Type
|
86
105
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
adam-retina:Untitled Workspace> workspace runningCues
|
106
|
+
1 1 YOP Audio
|
107
|
+
2 2 Fix this name Audio
|
108
|
+
3 3 Fix this name Audio
|
91
109
|
|
92
|
-
------------------------------- Running Cues -------------------------------
|
93
110
|
|
94
|
-
|
111
|
+
13:41 [my-mac-laptop] [Untitled Workspace 1] [2 Fix this name]
|
112
|
+
> alias smiley (cue $1 name ":) :) :) :) :) :)")
|
113
|
+
Added alias for "smiley": (cue $1 name ":) :) :) :) :) :)")
|
114
|
+
13:41 [my-mac-laptop] [Untitled Workspace 1] [2 Fix this name]
|
115
|
+
> smiley 2
|
116
|
+
ok
|
117
|
+
13:41 [my-mac-laptop] [Untitled Workspace 1] [2 :) :) :) :) :) :)]
|
118
|
+
> cues
|
95
119
|
|
96
|
-
|
120
|
+
------------------------------- Cues: Main Cue List -------------------------------
|
97
121
|
|
122
|
+
Number Id Name Type
|
98
123
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
children colorName connect
|
103
|
-
continueMode cue cueLists
|
104
|
-
cueTargetId cueTargetNumber disconnect
|
105
|
-
duration exit flagged
|
106
|
-
hasCueTargets hasFileTargets isBroken
|
107
|
-
isLoaded isPaused isRunning
|
108
|
-
load loadAt name
|
109
|
-
notes number panic
|
110
|
-
pause percentActionElapsed percentPostWaitElapsed
|
111
|
-
percentPreWaitElapsed postWait postWaitElapsed
|
112
|
-
preview preWait preWaitElapsed
|
113
|
-
reset resume runningCues
|
114
|
-
runningOrPausedCues selectedCues stop
|
115
|
-
thump type uniqueID
|
116
|
-
workspace workspaces
|
117
|
-
adam-retina:Untitled Workspace> cue 2 pause
|
118
|
-
adam-retina:Untitled Workspace> cue 2 isRunning
|
119
|
-
false
|
120
|
-
adam-retina:Untitled Workspace> cue 2 percentActionElapsed
|
121
|
-
0.109189204871655
|
122
|
-
adam-retina:Untitled Workspace> disconnect
|
124
|
+
1 1 YOP Audio
|
125
|
+
2 2 :) :) :) :) :) :) Audio
|
126
|
+
3 3 Fix this name Audio
|
123
127
|
|
124
|
-
Found 2 QLab machines
|
125
|
-
|
126
|
-
1. adam-retina
|
127
|
-
2. f53zwimac
|
128
|
-
|
129
|
-
type `connect MACHINE` to connect to a machine
|
130
128
|
|
129
|
+
13:41 [my-mac-laptop] [Untitled Workspace 1] [2 :) :) :) :) :) :)]
|
131
130
|
> exit
|
132
131
|
exiting...
|
133
132
|
|
134
|
-
|
135
133
|
## Contributing
|
136
134
|
|
137
135
|
1. Fork it
|
data/lib/qcmd.rb
CHANGED
@@ -25,9 +25,11 @@ module Qcmd
|
|
25
25
|
autoload :Network, 'qcmd/network'
|
26
26
|
autoload :QLab, 'qcmd/qlab'
|
27
27
|
autoload :VERSION, 'qcmd/version'
|
28
|
-
autoload :Action, 'qcmd/action'
|
29
28
|
autoload :Aliases, 'qcmd/aliases'
|
30
29
|
|
30
|
+
autoload :Action, 'qcmd/action'
|
31
|
+
autoload :CueAction, 'qcmd/action'
|
32
|
+
|
31
33
|
# on launch
|
32
34
|
|
33
35
|
class << self
|
data/lib/qcmd/action.rb
CHANGED
@@ -1,164 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
# initialize and evaluate in one shot
|
6
|
-
def self.evaluate action_input
|
7
|
-
is_cue_action = false
|
8
|
-
|
9
|
-
if action_input.is_a?(String)
|
10
|
-
is_cue_action = %w(cue cue_id).include?(action_input.split.first)
|
11
|
-
else
|
12
|
-
is_cue_action = ['cue', 'cue_id', :cue, :cue_id].include?(action_input.first)
|
13
|
-
end
|
14
|
-
|
15
|
-
if is_cue_action
|
16
|
-
CueAction.new(action_input).evaluate
|
17
|
-
else
|
18
|
-
Action.new(action_input).evaluate
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def initialize(expression)
|
23
|
-
if expression.is_a?(String)
|
24
|
-
expression = Qcmd::Parser.parse(expression)
|
25
|
-
end
|
26
|
-
|
27
|
-
@code = parse(expression)
|
28
|
-
end
|
29
|
-
|
30
|
-
def evaluate
|
31
|
-
if code.size == 0
|
32
|
-
nil
|
33
|
-
else
|
34
|
-
@code = code.map do |token|
|
35
|
-
if token.is_a?(Action)
|
36
|
-
Qcmd.debug "[Action evaluate] evaluating nested action: #{ token.code.inspect }"
|
37
|
-
token.evaluate
|
38
|
-
else
|
39
|
-
token
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
Qcmd.debug "[Action evaluate] evaluating code: #{ code.inspect }"
|
44
|
-
|
45
|
-
send_message
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def parse(expression)
|
50
|
-
# unwrap nested arrays
|
51
|
-
if expression.size == 1 && expression[0].is_a?(Array)
|
52
|
-
expression = expression[0]
|
53
|
-
end
|
54
|
-
|
55
|
-
expression.map do |token|
|
56
|
-
if token.is_a?(Array)
|
57
|
-
if [:cue, :cue_id].include?(token.first)
|
58
|
-
Qcmd.debug "nested cue action detected in #{ expression.inspect }"
|
59
|
-
CueAction.new(token)
|
60
|
-
else
|
61
|
-
Action.new(token)
|
62
|
-
end
|
63
|
-
else
|
64
|
-
token
|
65
|
-
end
|
66
|
-
end.tap {|exp|
|
67
|
-
Qcmd.debug "[Action parse] returning: #{ exp.inspect }"
|
68
|
-
}
|
69
|
-
end
|
70
|
-
|
71
|
-
# the default command builder
|
72
|
-
def osc_message
|
73
|
-
OSC::Message.new osc_address.to_s, *osc_arguments
|
74
|
-
end
|
75
|
-
|
76
|
-
def osc_address
|
77
|
-
# prefix w/ slash if necessary
|
78
|
-
if %r[^/] !~ code[0].to_s
|
79
|
-
"/#{ code[0] }"
|
80
|
-
else
|
81
|
-
code[0]
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def osc_address=(value)
|
86
|
-
code[0] = value
|
87
|
-
end
|
88
|
-
|
89
|
-
def osc_arguments
|
90
|
-
stringify code[1..-1]
|
91
|
-
end
|
92
|
-
|
93
|
-
# the raw command
|
94
|
-
def command
|
95
|
-
code[0]
|
96
|
-
end
|
97
|
-
|
98
|
-
private
|
99
|
-
|
100
|
-
def send_message
|
101
|
-
responses = []
|
102
|
-
|
103
|
-
Qcmd.debug "[Action send_message] send #{ osc_message.encode }"
|
104
|
-
Qcmd.context.qlab.send(osc_message) do |response|
|
105
|
-
# puts "response to: #{ osc_message.inspect }"
|
106
|
-
# puts response.inspect
|
107
|
-
|
108
|
-
responses << QLab::Reply.new(response)
|
109
|
-
end
|
110
|
-
|
111
|
-
if responses.size == 1
|
112
|
-
q_reply = responses[0]
|
113
|
-
Qcmd.debug "[Action send_message] got one response: #{q_reply.inspect}"
|
114
|
-
|
115
|
-
if q_reply.has_data?
|
116
|
-
q_reply.data
|
117
|
-
else
|
118
|
-
q_reply
|
119
|
-
end
|
120
|
-
else
|
121
|
-
responses
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
def stringify args
|
126
|
-
if args.nil?
|
127
|
-
nil
|
128
|
-
else
|
129
|
-
args.map {|arg|
|
130
|
-
if arg.is_a?(Symbol)
|
131
|
-
arg.to_s
|
132
|
-
else
|
133
|
-
arg
|
134
|
-
end
|
135
|
-
}
|
136
|
-
end
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
class CueAction < Action
|
141
|
-
# cue commands work differently
|
142
|
-
def command
|
143
|
-
code[2]
|
144
|
-
end
|
145
|
-
|
146
|
-
def osc_address
|
147
|
-
"/#{ code[0] }/#{ code[1] }/#{ code[2] }"
|
148
|
-
end
|
149
|
-
|
150
|
-
def osc_arguments
|
151
|
-
stringify code[3..-1]
|
152
|
-
end
|
153
|
-
|
154
|
-
# cue specific fields
|
155
|
-
|
156
|
-
def id_field
|
157
|
-
code[0]
|
158
|
-
end
|
159
|
-
|
160
|
-
def identifier
|
161
|
-
code[1]
|
162
|
-
end
|
163
|
-
end
|
164
|
-
end
|
1
|
+
require 'qcmd/actions/base_action'
|
2
|
+
require 'qcmd/actions/action'
|
3
|
+
require 'qcmd/actions/cue_action'
|
@@ -0,0 +1,139 @@
|
|
1
|
+
module Qcmd
|
2
|
+
class BaseAction
|
3
|
+
attr_reader :code
|
4
|
+
|
5
|
+
# initialize and evaluate in one shot
|
6
|
+
def self.evaluate action_input
|
7
|
+
is_cue_action = false
|
8
|
+
|
9
|
+
if action_input.is_a?(String)
|
10
|
+
is_cue_action = %w(cue cue_id).include?(action_input.split.first)
|
11
|
+
else
|
12
|
+
is_cue_action = ['cue', 'cue_id', :cue, :cue_id].include?(action_input.first)
|
13
|
+
end
|
14
|
+
|
15
|
+
if is_cue_action
|
16
|
+
CueAction.new(action_input).evaluate
|
17
|
+
else
|
18
|
+
Action.new(action_input).evaluate
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def initialize(expression)
|
23
|
+
if expression.is_a?(String)
|
24
|
+
expression = Qcmd::Parser.parse(expression)
|
25
|
+
end
|
26
|
+
|
27
|
+
@code = parse(expression)
|
28
|
+
end
|
29
|
+
|
30
|
+
def evaluate
|
31
|
+
if code.size == 0
|
32
|
+
nil
|
33
|
+
else
|
34
|
+
@code = code.map do |token|
|
35
|
+
if token.is_a?(Action)
|
36
|
+
Qcmd.debug "[Action evaluate] evaluating nested action: #{ token.code.inspect }"
|
37
|
+
token.evaluate
|
38
|
+
else
|
39
|
+
token
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
Qcmd.debug "[Action evaluate] evaluating code: #{ code.inspect }"
|
44
|
+
|
45
|
+
send_message
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def parse(expression)
|
50
|
+
# unwrap nested arrays
|
51
|
+
if expression.size == 1 && expression[0].is_a?(Array)
|
52
|
+
expression = expression[0]
|
53
|
+
end
|
54
|
+
|
55
|
+
expression.map do |token|
|
56
|
+
if token.is_a?(Array)
|
57
|
+
if [:cue, :cue_id].include?(token.first)
|
58
|
+
Qcmd.debug "nested cue action detected in #{ expression.inspect }"
|
59
|
+
CueAction.new(token)
|
60
|
+
else
|
61
|
+
Action.new(token)
|
62
|
+
end
|
63
|
+
else
|
64
|
+
token
|
65
|
+
end
|
66
|
+
end.tap {|exp|
|
67
|
+
Qcmd.debug "[Action parse] returning: #{ exp.inspect }"
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
# the default command builder
|
72
|
+
def osc_message
|
73
|
+
OSC::Message.new osc_address.to_s, *osc_arguments
|
74
|
+
end
|
75
|
+
|
76
|
+
def osc_address
|
77
|
+
# prefix w/ slash if necessary
|
78
|
+
if %r[^/] !~ code[0].to_s
|
79
|
+
"/#{ code[0] }"
|
80
|
+
else
|
81
|
+
code[0]
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def osc_address=(value)
|
86
|
+
code[0] = value
|
87
|
+
end
|
88
|
+
|
89
|
+
def osc_arguments
|
90
|
+
stringify code[1..-1]
|
91
|
+
end
|
92
|
+
|
93
|
+
# the raw command
|
94
|
+
def command
|
95
|
+
code[0]
|
96
|
+
end
|
97
|
+
|
98
|
+
private
|
99
|
+
|
100
|
+
def send_message
|
101
|
+
responses = []
|
102
|
+
|
103
|
+
Qcmd.debug "[Action send_message] send #{ osc_message.encode }"
|
104
|
+
Qcmd.context.qlab.send(osc_message) do |response|
|
105
|
+
# puts "response to: #{ osc_message.inspect }"
|
106
|
+
# puts response.inspect
|
107
|
+
|
108
|
+
responses << QLab::Reply.new(response)
|
109
|
+
end
|
110
|
+
|
111
|
+
if responses.size == 1
|
112
|
+
q_reply = responses[0]
|
113
|
+
Qcmd.debug "[Action send_message] got one response: #{q_reply.inspect}"
|
114
|
+
|
115
|
+
if q_reply.has_data?
|
116
|
+
q_reply.data
|
117
|
+
else
|
118
|
+
q_reply
|
119
|
+
end
|
120
|
+
else
|
121
|
+
responses
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def stringify args
|
126
|
+
if args.nil?
|
127
|
+
nil
|
128
|
+
else
|
129
|
+
args.map {|arg|
|
130
|
+
if arg.is_a?(Symbol)
|
131
|
+
arg.to_s
|
132
|
+
else
|
133
|
+
arg
|
134
|
+
end
|
135
|
+
}
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Qcmd
|
2
|
+
class CueAction < Action
|
3
|
+
# cue commands work differently
|
4
|
+
def command
|
5
|
+
code[2]
|
6
|
+
end
|
7
|
+
|
8
|
+
def osc_address
|
9
|
+
"/#{ code[0] }/#{ code[1] }/#{ code[2] }"
|
10
|
+
end
|
11
|
+
|
12
|
+
def osc_arguments
|
13
|
+
stringify code[3..-1]
|
14
|
+
end
|
15
|
+
|
16
|
+
# cue specific fields
|
17
|
+
|
18
|
+
def id_field
|
19
|
+
code[0]
|
20
|
+
end
|
21
|
+
|
22
|
+
def identifier
|
23
|
+
code[1]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
data/lib/qcmd/cli.rb
CHANGED
@@ -36,12 +36,9 @@ module Qcmd
|
|
36
36
|
handle_input Qcmd::Parser.parse(options[:command])
|
37
37
|
return
|
38
38
|
end
|
39
|
-
elsif
|
40
|
-
|
41
|
-
|
42
|
-
if !connect_default_workspace
|
43
|
-
Handler.print_workspace_list
|
44
|
-
end
|
39
|
+
elsif !connect_default_workspace
|
40
|
+
Handler.print_workspace_list
|
41
|
+
# end
|
45
42
|
end
|
46
43
|
end
|
47
44
|
|
@@ -385,7 +382,7 @@ module Qcmd
|
|
385
382
|
workspace_command = args[1]
|
386
383
|
|
387
384
|
if !Qcmd.context.workspace_connected?
|
388
|
-
handle_failed_workspace_command
|
385
|
+
handle_failed_workspace_command args
|
389
386
|
return
|
390
387
|
end
|
391
388
|
|
@@ -402,7 +399,7 @@ module Qcmd
|
|
402
399
|
|
403
400
|
when 'cues'
|
404
401
|
if !Qcmd.context.workspace_connected?
|
405
|
-
handle_failed_workspace_command
|
402
|
+
handle_failed_workspace_command args
|
406
403
|
return
|
407
404
|
end
|
408
405
|
|
@@ -425,7 +422,7 @@ module Qcmd
|
|
425
422
|
# id_field = $1
|
426
423
|
|
427
424
|
if !Qcmd.context.workspace_connected?
|
428
|
-
handle_failed_workspace_command
|
425
|
+
handle_failed_workspace_command args
|
429
426
|
return
|
430
427
|
end
|
431
428
|
|
@@ -525,14 +522,17 @@ module Qcmd
|
|
525
522
|
elsif Qcmd.context.cue_connected? && Qcmd::InputCompleter::ReservedCueWords.include?(command)
|
526
523
|
# prepend the given command with a cue address
|
527
524
|
if Qcmd.context.cue.number.nil? || Qcmd.context.cue.number.size == 0
|
528
|
-
|
525
|
+
command_args = [:cue_id, Qcmd.context.cue.id, command]
|
529
526
|
else
|
530
|
-
|
527
|
+
command_args = [:cue, Qcmd.context.cue.number, command]
|
531
528
|
end
|
532
529
|
|
533
|
-
|
530
|
+
# add the rest of the given args
|
531
|
+
Qcmd.debug "adding #{args[1..-1].inspect} to #{ command_args.inspect }"
|
532
|
+
command_args.push(*args[1..-1])
|
534
533
|
|
535
|
-
|
534
|
+
Qcmd.debug "creating cue action with #{command_args.inspect}"
|
535
|
+
cue_action = Qcmd::CueAction.new(command_args)
|
536
536
|
|
537
537
|
reply = cue_action.evaluate
|
538
538
|
handle_simple_reply reply
|
@@ -568,6 +568,7 @@ module Qcmd
|
|
568
568
|
end
|
569
569
|
|
570
570
|
def handle_failed_workspace_command command
|
571
|
+
command = command.join ' '
|
571
572
|
print_wrapped(%[The command, "#{ command }" can't be processed yet. you must
|
572
573
|
first connect to a machine and a workspace
|
573
574
|
before issuing other commands.])
|
@@ -613,7 +614,7 @@ module Qcmd
|
|
613
614
|
end
|
614
615
|
|
615
616
|
def fixate_on_cue cue_action
|
616
|
-
# fixate on cue
|
617
|
+
# fixate on the cue which is the subject of the given action
|
617
618
|
if Qcmd.context.workspace.has_cues?
|
618
619
|
_cue = Qcmd.context.workspace.cues.find {|cue|
|
619
620
|
case cue_action.id_field
|
@@ -649,8 +650,12 @@ module Qcmd
|
|
649
650
|
end
|
650
651
|
|
651
652
|
def connect_default_workspace
|
652
|
-
|
653
|
+
connectable = Qcmd.context.machine.workspaces.size == 1 &&
|
654
|
+
!Qcmd.context.machine.workspaces.first.passcode? &&
|
655
|
+
!Qcmd.context.workspace_connected?
|
656
|
+
if connectable
|
653
657
|
connect_to_workspace_by_index(0, nil)
|
658
|
+
|
654
659
|
true
|
655
660
|
else
|
656
661
|
false
|
@@ -52,16 +52,21 @@ module OSC
|
|
52
52
|
|
53
53
|
send_char CHAR_END
|
54
54
|
|
55
|
+
# puts "[TCPClient] sent message: #{ enc_msg.inspect }"
|
56
|
+
|
55
57
|
if block_given? || @handler
|
56
58
|
messages = response
|
57
59
|
if !messages.nil?
|
58
60
|
messages.each do |message|
|
61
|
+
# puts "[TCPClient] got message #{ message }"
|
59
62
|
if block_given?
|
60
63
|
yield message
|
61
64
|
else
|
62
65
|
@handler.handle message
|
63
66
|
end
|
64
67
|
end
|
68
|
+
else
|
69
|
+
# puts "[TCPClient] response is nil"
|
65
70
|
end
|
66
71
|
end
|
67
72
|
end
|
data/lib/qcmd/version.rb
CHANGED
data/qcmd.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.email = ["adam.bachman@gmail.com"]
|
11
11
|
gem.description = %q{A simple interactive QLab 3 command line controller}
|
12
12
|
gem.summary = %q{QLab 3 console}
|
13
|
-
gem.homepage = "https://github.com/
|
13
|
+
gem.homepage = "https://github.com/Figure53/qcmd"
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split($/)
|
16
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/spec/unit/cli_spec.rb
CHANGED
data/spec/unit/commands_spec.rb
CHANGED
@@ -38,22 +38,27 @@ describe Qcmd::Commands do
|
|
38
38
|
|
39
39
|
describe 'machine commands' do
|
40
40
|
it 'should not raise errors' do
|
41
|
+
Qcmd.context.machine_connected?.should be_true
|
41
42
|
test_log
|
42
43
|
|
43
44
|
Qcmd::Commands::MACHINE.each do |machine_command|
|
44
45
|
expect {
|
45
|
-
osc_message = OSC::Message.new "/#{ machine_command }"
|
46
|
+
osc_message = OSC::Message.new "/#{ machine_command }", 1
|
46
47
|
|
47
48
|
reply = nil
|
48
49
|
|
50
|
+
test_log "[machine_command] sending #{ machine_command } - #{ osc_message.address } #{ osc_message.to_a.inspect }"
|
51
|
+
|
49
52
|
# should be able to instantiate all OSC message reponses as QLab replies
|
50
53
|
Qcmd.context.qlab.send(osc_message) do |response|
|
54
|
+
# test_log "[machine command] response: #{ response.inspect }"
|
51
55
|
reply = Qcmd::QLab::Reply.new(response)
|
52
56
|
# test_log "[machine command] #{ reply.address } got #{ reply.to_s }"
|
53
57
|
end
|
54
58
|
|
55
|
-
test_log reply.address
|
56
59
|
reply.should_not be_nil
|
60
|
+
# test_log reply.address
|
61
|
+
|
57
62
|
}.to_not raise_error
|
58
63
|
end
|
59
64
|
end
|
@@ -122,6 +127,8 @@ describe Qcmd::Commands do
|
|
122
127
|
Qcmd.context.qlab.send(osc_message) do |response|
|
123
128
|
reply = Qcmd::QLab::Reply.new(response)
|
124
129
|
@cue = Qcmd::QLab::Cue.new(reply.data.first['cues'].first)
|
130
|
+
|
131
|
+
test_log "pulling cue from data: #{ reply.data.inspect }"
|
125
132
|
end
|
126
133
|
end
|
127
134
|
|
@@ -132,7 +139,11 @@ describe Qcmd::Commands do
|
|
132
139
|
|
133
140
|
Qcmd::Commands::CUE.each do |cue_command|
|
134
141
|
expect {
|
135
|
-
|
142
|
+
test_log "using cue #{ @cue } : #{ @cue.data }"
|
143
|
+
cmd = "/workspace/#{workspace.id}/cue/#{ @cue.number }/#{ cue_command }"
|
144
|
+
|
145
|
+
test_log "sending #{ cmd }"
|
146
|
+
osc_message = OSC::Message.new cmd
|
136
147
|
|
137
148
|
osc_response = nil
|
138
149
|
reply = nil
|
@@ -146,7 +157,7 @@ describe Qcmd::Commands do
|
|
146
157
|
test_log reply.address
|
147
158
|
reply.should_not be_nil
|
148
159
|
rescue => ex
|
149
|
-
|
160
|
+
test_log "reply access fail '#{ ex.message }' on response #{ osc_response.inspect }"
|
150
161
|
raise
|
151
162
|
end
|
152
163
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qcmd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dnssd
|
@@ -142,6 +142,9 @@ files:
|
|
142
142
|
- features/support/setup.rb
|
143
143
|
- lib/qcmd.rb
|
144
144
|
- lib/qcmd/action.rb
|
145
|
+
- lib/qcmd/actions/action.rb
|
146
|
+
- lib/qcmd/actions/base_action.rb
|
147
|
+
- lib/qcmd/actions/cue_action.rb
|
145
148
|
- lib/qcmd/aliases.rb
|
146
149
|
- lib/qcmd/cli.rb
|
147
150
|
- lib/qcmd/commands.rb
|
@@ -179,7 +182,7 @@ files:
|
|
179
182
|
- spec/unit/parser_spec.rb
|
180
183
|
- spec/unit/qcmd_spec.rb
|
181
184
|
- spec/unit/qlab_spec.rb
|
182
|
-
homepage: https://github.com/
|
185
|
+
homepage: https://github.com/Figure53/qcmd
|
183
186
|
licenses: []
|
184
187
|
post_install_message:
|
185
188
|
rdoc_options: []
|