ruby-macrodroid 0.9.15 → 0.9.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/ruby-macrodroid/actions.rb +61 -9
- data/lib/ruby-macrodroid/actionsnlp.rb +23 -1
- data/lib/ruby-macrodroid/base.rb +2 -2
- data/lib/ruby-macrodroid/triggersnlp.rb +2 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9789db9405136e821003060f52912072c11665303ab25a714c93d5dac058d8f
|
4
|
+
data.tar.gz: 7878f4f2c52b3450e2485e5b993cfe275269e88e125da647f89ddf73610c504e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a2f574bc7692cba9cf2cc31228c5c4e6cd4aa78de0bb3a73c5e73c1458fd6cdc0798ac31aebd9e1833738ce700819257a02242c13ed2c5bc91f4e977d171e27
|
7
|
+
data.tar.gz: ce58d73abe7f2583bd50a7c6fa0fda42c9aa2a0cf14b9fc370c066dad69fcb8263332f685da3f14aee447180fbfcd9cd5a25a59b81853748114e58e420c6f74c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
@@ -174,17 +174,17 @@ class OpenWebPageAction < ApplicationAction
|
|
174
174
|
|
175
175
|
def initialize(obj={}, macro=nil)
|
176
176
|
|
177
|
-
$debug =
|
177
|
+
$debug = true
|
178
178
|
puts ('obj: ' + obj.inspect).debug if $debug
|
179
179
|
|
180
180
|
h = if obj.is_a? Hash then
|
181
181
|
|
182
|
-
obj.merge({macro: macro})
|
182
|
+
obj.merge({macro: macro}) #unless obj and obj[:macro]
|
183
183
|
|
184
184
|
elsif obj.is_a? Array
|
185
185
|
|
186
186
|
puts ('obj: ' + obj.inspect).debug if $debug
|
187
|
-
e, macro = obj
|
187
|
+
e, macro, h3 = obj
|
188
188
|
|
189
189
|
a = e.xpath('item/*')
|
190
190
|
|
@@ -205,7 +205,7 @@ class OpenWebPageAction < ApplicationAction
|
|
205
205
|
{url: (txt || e.text)}
|
206
206
|
end
|
207
207
|
|
208
|
-
h2.merge(macro: macro)
|
208
|
+
h2.merge(macro: macro).merge(h3)
|
209
209
|
|
210
210
|
end
|
211
211
|
|
@@ -243,6 +243,7 @@ class OpenWebPageAction < ApplicationAction
|
|
243
243
|
h[:macro].title.downcase.gsub(/ +/,'-')
|
244
244
|
|
245
245
|
end
|
246
|
+
puts 'url: ' + url.inspect if $debug
|
246
247
|
|
247
248
|
if h2 then
|
248
249
|
|
@@ -266,7 +267,8 @@ class OpenWebPageAction < ApplicationAction
|
|
266
267
|
end
|
267
268
|
|
268
269
|
def to_s(colour: false, indent: 0)
|
269
|
-
|
270
|
+
s = @h[:http_get] ? '' : 'Open Website / '
|
271
|
+
@s = s + "HTTP GET\nurl: " + @h[:url_to_open]
|
270
272
|
super()
|
271
273
|
end
|
272
274
|
|
@@ -985,8 +987,15 @@ end
|
|
985
987
|
#
|
986
988
|
class ClipboardAction < DeviceAction
|
987
989
|
|
988
|
-
def initialize(
|
990
|
+
def initialize(obj=nil)
|
989
991
|
|
992
|
+
h = if obj.is_a? Hash then
|
993
|
+
obj
|
994
|
+
elsif obj.is_a? Array
|
995
|
+
e, macro = obj
|
996
|
+
{clipboard_text: e.text('item/description').to_s}
|
997
|
+
end
|
998
|
+
|
990
999
|
options = {
|
991
1000
|
clipboard_text: ''
|
992
1001
|
}
|
@@ -1066,14 +1075,57 @@ end
|
|
1066
1075
|
#
|
1067
1076
|
class UIInteractionAction < DeviceAction
|
1068
1077
|
|
1069
|
-
def initialize(
|
1078
|
+
def initialize(obj=nil)
|
1079
|
+
|
1080
|
+
if obj.is_a? Hash then
|
1081
|
+
h = obj
|
1082
|
+
elsif obj.is_a? Array
|
1083
|
+
|
1084
|
+
e, macro = obj
|
1085
|
+
s = e.text('item/description').to_s
|
1086
|
+
|
1087
|
+
r = s.match(/^(Click|Long Click) \[([^\]]+)/)
|
1088
|
+
|
1089
|
+
# [Current focus] # Current focus
|
1090
|
+
# [0,0] # x,y location
|
1091
|
+
# [274,186] # Identify in app
|
1092
|
+
# [fooo] # Text content
|
1093
|
+
|
1094
|
+
h = {
|
1095
|
+
ui_interaction_configuration: {}, :xy_point=>{:x=>0, :y=>0},
|
1096
|
+
:type=>"Click"
|
1097
|
+
}
|
1098
|
+
h2 = {}
|
1099
|
+
|
1100
|
+
if r then
|
1101
|
+
|
1102
|
+
h[:action] = 0
|
1070
1103
|
|
1104
|
+
click, detail = r.captures
|
1105
|
+
h2[:long_click] = false if click.downcase.to_sym == :click
|
1106
|
+
|
1107
|
+
if detail == 'Current focus' then
|
1108
|
+
h2[:click_option] = 1
|
1109
|
+
elsif detail =~ /\d+,\d+/
|
1110
|
+
# to-do
|
1111
|
+
else
|
1112
|
+
# text content
|
1113
|
+
h2[:click_option] = 1
|
1114
|
+
h2[:text_content] = detail
|
1115
|
+
end
|
1116
|
+
|
1117
|
+
h[:ui_interaction_configuration] = h2
|
1118
|
+
end
|
1119
|
+
|
1120
|
+
end
|
1121
|
+
|
1071
1122
|
options = {
|
1072
1123
|
ui_interaction_configuration: {:type=>"Copy"},
|
1073
1124
|
action: 2
|
1074
1125
|
}
|
1075
1126
|
|
1076
|
-
|
1127
|
+
|
1128
|
+
super(options.merge h)
|
1077
1129
|
|
1078
1130
|
end
|
1079
1131
|
|
@@ -1113,7 +1165,7 @@ class UIInteractionAction < DeviceAction
|
|
1113
1165
|
"Gesture [%s]" % detail
|
1114
1166
|
end
|
1115
1167
|
|
1116
|
-
'UI Interaction' + "\n " + s
|
1168
|
+
'UI Interaction' + "\n " + s + ' ' + @h.inspect
|
1117
1169
|
end
|
1118
1170
|
|
1119
1171
|
alias to_summary to_s
|
@@ -90,6 +90,7 @@ class ActionsNlp
|
|
90
90
|
|
91
91
|
# -- DEVICE ACTIONS ------------------------------------------------------
|
92
92
|
|
93
|
+
#
|
93
94
|
get /^Speak text \(([^\)]+)\)/i do |text|
|
94
95
|
[SpeakTextAction, {text: text}]
|
95
96
|
end
|
@@ -100,7 +101,11 @@ class ActionsNlp
|
|
100
101
|
|
101
102
|
get /^Speak text$/i do |text|
|
102
103
|
[SpeakTextAction, {}]
|
103
|
-
end
|
104
|
+
end
|
105
|
+
|
106
|
+
get /^UI Interaction$/i do
|
107
|
+
[UIInteractionAction, {}]
|
108
|
+
end
|
104
109
|
|
105
110
|
get /^Vibrate \(([^\)]+)/i do |pattern|
|
106
111
|
[VibrateAction, {pattern: pattern}]
|
@@ -123,6 +128,10 @@ class ActionsNlp
|
|
123
128
|
[SetWifiAction, {state: state}]
|
124
129
|
|
125
130
|
end
|
131
|
+
|
132
|
+
get /^Fill Clipboard$/i do
|
133
|
+
[ClipboardAction, {}]
|
134
|
+
end
|
126
135
|
|
127
136
|
# e.g. Play: Altair
|
128
137
|
get /^Play: (.*)$/i do |name|
|
@@ -157,6 +166,19 @@ class ActionsNlp
|
|
157
166
|
|
158
167
|
end
|
159
168
|
|
169
|
+
|
170
|
+
get /^Open Website \/ HTTP GET$/i do
|
171
|
+
|
172
|
+
[OpenWebPageAction, {http_get: false}]
|
173
|
+
|
174
|
+
end
|
175
|
+
|
176
|
+
get /^(?:open|goto) ((?:https?:\/\/|\[lv=)[^$]+)$/i do |url|
|
177
|
+
|
178
|
+
[OpenWebPageAction, url_to_open: url, http_get: false]
|
179
|
+
|
180
|
+
end
|
181
|
+
|
160
182
|
# e.g. webhook entered_kitchen
|
161
183
|
#
|
162
184
|
get /(?:webhook|HTTP GET) ([^$]+)$/i do |s|
|
data/lib/ruby-macrodroid/base.rb
CHANGED
@@ -12,7 +12,7 @@ module ObjectX
|
|
12
12
|
|
13
13
|
def action_to_object(ap, e, item, macro)
|
14
14
|
|
15
|
-
debug =
|
15
|
+
debug = true
|
16
16
|
|
17
17
|
puts 'inside action_to_object: item.xml: ' + item.xml if debug
|
18
18
|
|
@@ -34,7 +34,7 @@ module ObjectX
|
|
34
34
|
r = ap.find_action action
|
35
35
|
puts 'r: ' + r.inspect if debug
|
36
36
|
|
37
|
-
nested = description.element('item
|
37
|
+
nested = description.element('item/*')
|
38
38
|
puts 'nested: ' + nested.inspect if debug
|
39
39
|
|
40
40
|
if r[1].any? and not nested then
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-macrodroid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
NZ2kdBIUDnAM24e0/wXdVxg4HnsZbdymxyzMQ4P5pKYcpI6oisBxI37p/Xy+wAg3
|
36
36
|
SBHno3GEuuD8ZWj24IMJpfbp
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2020-10-
|
38
|
+
date: 2020-10-23 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: glw
|
metadata.gz.sig
CHANGED
Binary file
|