ruby-macrodroid 0.9.15 → 0.9.20
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 +208 -51
- data/lib/ruby-macrodroid/actionsnlp.rb +104 -9
- data/lib/ruby-macrodroid/base.rb +3 -2
- data/lib/ruby-macrodroid/triggers.rb +4 -0
- data/lib/ruby-macrodroid/triggersnlp.rb +7 -1
- metadata +24 -24
- 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: 02dafd5344cb49f34bc7314f958114e9ae1a2cf90a6f1361db5cfd9359817041
|
4
|
+
data.tar.gz: f84c673798a7d7feea32b9c10f6dfa217b12f89488c318dd31cb5abd35957276
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91032bb5d4742e57d702ee1634f1dd99197acb86e75f299a451b486275ae7ef20f1e58c7f3dc992d022d8d5b6b3c0e48c58d58fcc154eeb25ff6752a9bf28301
|
7
|
+
data.tar.gz: b33532780734f52cda1f52b957084d7d4c5d445e76ca4394a3549fce3aa3f70ebbd398e88fe4dd7dfe59c2179313019146c6be142eecd441fe03d1aad7254719
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
@@ -36,18 +36,24 @@ APPS = {
|
|
36
36
|
'AutoBoy' => 'com.happyconz.blackbox',
|
37
37
|
'Amazon Alexa' => 'com.amazon.dee.app',
|
38
38
|
'Brave' => 'com.brave.browser',
|
39
|
-
'Camera' => 'com.
|
39
|
+
'Camera' => 'com.mediatek.camera',
|
40
40
|
'Cast to TV' => 'cast.video.screenmirroring.casttotv',
|
41
|
+
'Calculator' => 'com.android.pri.calculator',
|
42
|
+
'Calendar' => 'com.google.android.calendar',
|
43
|
+
'Clock' => 'com.android.deskclock',
|
41
44
|
'File Manager' => 'com.alphainventor.filemanager',
|
42
45
|
'Firefox' => 'org.mozilla.firefox',
|
43
46
|
'Google Chrome' => 'com.google.android.chrome',
|
47
|
+
'Google Calendar' => 'com.google.android.calendar',
|
44
48
|
'Chrome' => 'com.google.android.chrome',
|
49
|
+
'Earth' => 'com.google.earth',
|
45
50
|
'Google Home' => 'com.google.android.apps.chromecast.app',
|
46
51
|
'Google Play Music' => 'com.google.android.music',
|
47
52
|
'MacroDroid' => 'com.arlosoft.macrodroid',
|
48
53
|
'QuickEdit Text Editor Pro' => 'com.rhmsoft.edit.pro',
|
49
54
|
'QR & Barcode Reader' => 'com.teacapps.barcodescanner',
|
50
|
-
'Settings' => 'com.
|
55
|
+
'Settings' => 'com.android.settings',
|
56
|
+
'Chrome' => 'com.google.android.street',
|
51
57
|
'tinyCam PRO' => 'com.alexvas.dvr.pro',
|
52
58
|
'Tor Browser' => 'org.torproject.torbrowser',
|
53
59
|
'VLC' => 'org.videolan.vlc',
|
@@ -99,20 +105,29 @@ end
|
|
99
105
|
class LaunchActivityAction < ApplicationAction
|
100
106
|
|
101
107
|
def initialize(h={})
|
102
|
-
|
108
|
+
|
109
|
+
# option 0 is by application name, 1 is launch by package name
|
110
|
+
#
|
103
111
|
options = {
|
104
112
|
application_name: 'Chrome',
|
105
113
|
package_to_launch: 'com.android.chrome',
|
106
114
|
exclude_from_recents: false,
|
107
|
-
start_new: false
|
115
|
+
start_new: false,
|
116
|
+
option: 0,
|
117
|
+
launch_by_package_name: ''
|
108
118
|
}
|
109
119
|
|
110
120
|
super(options.merge h)
|
121
|
+
|
122
|
+
@list = %w(option launchByPackageName)
|
111
123
|
|
112
124
|
end
|
113
125
|
|
114
126
|
def to_s(colour: false, indent: 0)
|
115
|
-
|
127
|
+
option = @h[:option] == 0 ? @h[:application_name] : \
|
128
|
+
@h[:launch_by_package_name]
|
129
|
+
@s = 'Launch ' + option
|
130
|
+
super()
|
116
131
|
end
|
117
132
|
|
118
133
|
end
|
@@ -143,13 +158,30 @@ end
|
|
143
158
|
#
|
144
159
|
class LaunchShortcutAction < ApplicationAction
|
145
160
|
|
146
|
-
def initialize(
|
161
|
+
def initialize(obj=nil)
|
162
|
+
|
163
|
+
puts 'obj: ' + obj.inspect
|
164
|
+
h = if obj.is_a? Hash then
|
165
|
+
obj
|
166
|
+
else
|
167
|
+
obj[2] || {}
|
168
|
+
end
|
147
169
|
|
170
|
+
if h[:shortcut] and h[:shortcut] =~ /Ask Alexa/i then
|
171
|
+
h = {
|
172
|
+
:app_name=>"Amazon Alexa", :intent_encoded=>"#Intent;action=com." +
|
173
|
+
"amazon.alexa.action.WIDGET_SHORTCUT;launchFlags=0x10000000;" +
|
174
|
+
"component=com.amazon.dee.app/.ui.voice.LaunchAlexaActivity;end",
|
175
|
+
:name=>"Ask Alexa"
|
176
|
+
}
|
177
|
+
end
|
148
178
|
options = {
|
149
179
|
:app_name=>"Amazon Alexa", :intent_encoded=>"", :name=>"Ask Alexa"
|
150
180
|
}
|
151
181
|
|
152
182
|
super(options.merge h)
|
183
|
+
|
184
|
+
#@list = %w(appName intentEncoded name)
|
153
185
|
|
154
186
|
end
|
155
187
|
|
@@ -174,17 +206,17 @@ class OpenWebPageAction < ApplicationAction
|
|
174
206
|
|
175
207
|
def initialize(obj={}, macro=nil)
|
176
208
|
|
177
|
-
$debug =
|
209
|
+
$debug = true
|
178
210
|
puts ('obj: ' + obj.inspect).debug if $debug
|
179
211
|
|
180
212
|
h = if obj.is_a? Hash then
|
181
213
|
|
182
|
-
obj.merge({macro: macro})
|
214
|
+
obj.merge({macro: macro}) #unless obj and obj[:macro]
|
183
215
|
|
184
216
|
elsif obj.is_a? Array
|
185
217
|
|
186
218
|
puts ('obj: ' + obj.inspect).debug if $debug
|
187
|
-
e, macro = obj
|
219
|
+
e, macro, h3 = obj
|
188
220
|
|
189
221
|
a = e.xpath('item/*')
|
190
222
|
|
@@ -205,7 +237,7 @@ class OpenWebPageAction < ApplicationAction
|
|
205
237
|
{url: (txt || e.text)}
|
206
238
|
end
|
207
239
|
|
208
|
-
h2.merge(macro: macro)
|
240
|
+
h2.merge(macro: macro).merge(h3)
|
209
241
|
|
210
242
|
end
|
211
243
|
|
@@ -243,6 +275,7 @@ class OpenWebPageAction < ApplicationAction
|
|
243
275
|
h[:macro].title.downcase.gsub(/ +/,'-')
|
244
276
|
|
245
277
|
end
|
278
|
+
puts 'url: ' + url.inspect if $debug
|
246
279
|
|
247
280
|
if h2 then
|
248
281
|
|
@@ -266,7 +299,8 @@ class OpenWebPageAction < ApplicationAction
|
|
266
299
|
end
|
267
300
|
|
268
301
|
def to_s(colour: false, indent: 0)
|
269
|
-
|
302
|
+
s = @h[:http_get] ? '' : 'Open Website / '
|
303
|
+
@s = s + "HTTP GET\nurl: " + @h[:url_to_open]
|
270
304
|
super()
|
271
305
|
end
|
272
306
|
|
@@ -402,6 +436,61 @@ class TakePictureAction < CameraAction
|
|
402
436
|
end
|
403
437
|
|
404
438
|
|
439
|
+
class TakeScreenshotAction < CameraAction
|
440
|
+
|
441
|
+
def initialize(obj=nil)
|
442
|
+
|
443
|
+
h = if obj.is_a? Hash then
|
444
|
+
obj
|
445
|
+
elsif obj.is_a? Array
|
446
|
+
|
447
|
+
e, macro = obj
|
448
|
+
|
449
|
+
a = [
|
450
|
+
'Save to device',
|
451
|
+
'Send via email',
|
452
|
+
'Share via intent'
|
453
|
+
]
|
454
|
+
|
455
|
+
s = e.text('item/description').to_s
|
456
|
+
index = a.map(&:downcase).index s.downcase
|
457
|
+
|
458
|
+
{option: index}
|
459
|
+
|
460
|
+
end
|
461
|
+
|
462
|
+
options = {
|
463
|
+
option: 0,
|
464
|
+
use_smtp_email: false,
|
465
|
+
mechanism_option: 0,
|
466
|
+
save_to_jpeg: false
|
467
|
+
}
|
468
|
+
|
469
|
+
super(options.merge h)
|
470
|
+
|
471
|
+
end
|
472
|
+
|
473
|
+
def to_s(colour: false, indent: 0)
|
474
|
+
|
475
|
+
@s = 'Take Screenshot' #+ @h.inspect
|
476
|
+
|
477
|
+
options = [
|
478
|
+
'Save to device',
|
479
|
+
'Send via email',
|
480
|
+
'Share via intent'
|
481
|
+
]
|
482
|
+
|
483
|
+
option = options[@h[:option]]
|
484
|
+
|
485
|
+
@s += "\n" + option
|
486
|
+
super()
|
487
|
+
|
488
|
+
end
|
489
|
+
|
490
|
+
alias to_summary to_s
|
491
|
+
end
|
492
|
+
|
493
|
+
|
405
494
|
# Conditions/Loops
|
406
495
|
#
|
407
496
|
class IfConfirmedThenAction < Action
|
@@ -708,7 +797,7 @@ class SetAirplaneModeAction < ConnectivityAction
|
|
708
797
|
|
709
798
|
state = ['On', 'Off', 'Toggle'][@h[:state]]
|
710
799
|
@s = 'Airplane Mode ' + state
|
711
|
-
super(
|
800
|
+
super()
|
712
801
|
|
713
802
|
end
|
714
803
|
|
@@ -730,34 +819,20 @@ class SetWifiAction < ConnectivityAction
|
|
730
819
|
|
731
820
|
end
|
732
821
|
|
733
|
-
def to_s(colour: false, indent: 0)
|
734
|
-
|
735
|
-
|
822
|
+
def to_s(colour: false, indent: 0)
|
823
|
+
|
824
|
+
@s = if @h[:state] <= 2 then
|
825
|
+
state = %w(Enable Disable Toggle)[@h[:state]]
|
826
|
+
state + ' Wifi'
|
827
|
+
else
|
828
|
+
"Connected to Network\n%s" % @h[:ssid]
|
829
|
+
end
|
830
|
+
|
831
|
+
super()
|
736
832
|
end
|
737
833
|
|
738
834
|
end
|
739
835
|
|
740
|
-
# Category: Connectivity
|
741
|
-
#
|
742
|
-
class SetBluetoothAction < ConnectivityAction
|
743
|
-
|
744
|
-
def initialize(h={})
|
745
|
-
|
746
|
-
options = {
|
747
|
-
device_name: '',
|
748
|
-
state: 0
|
749
|
-
}
|
750
|
-
|
751
|
-
super(options.merge h)
|
752
|
-
|
753
|
-
end
|
754
|
-
|
755
|
-
def to_s(colour: false, indent: 0)
|
756
|
-
'SetBluetoothAction ' + @h.inspect
|
757
|
-
end
|
758
|
-
|
759
|
-
alias to_summary to_s
|
760
|
-
end
|
761
836
|
|
762
837
|
# Category: Connectivity
|
763
838
|
#
|
@@ -766,6 +841,8 @@ class SetBluetoothAction < ConnectivityAction
|
|
766
841
|
def initialize(h={})
|
767
842
|
|
768
843
|
options = {
|
844
|
+
|
845
|
+
device_address: '',
|
769
846
|
device_name: '',
|
770
847
|
state: 1
|
771
848
|
}
|
@@ -775,7 +852,21 @@ class SetBluetoothAction < ConnectivityAction
|
|
775
852
|
end
|
776
853
|
|
777
854
|
def to_s(colour: false, indent: 0)
|
778
|
-
|
855
|
+
|
856
|
+
@s = if @h[:state] <= 2 then
|
857
|
+
|
858
|
+
state = %w(Enable Disable Toggle)[@h[:state]]
|
859
|
+
state + ' Bluetooth'
|
860
|
+
|
861
|
+
else
|
862
|
+
|
863
|
+
state = @h[:state] == 3 ? 'Connect' : 'Disconnect'
|
864
|
+
state + ' Audio Device' + "\n" + @h[:device_name]
|
865
|
+
|
866
|
+
end
|
867
|
+
|
868
|
+
super()
|
869
|
+
|
779
870
|
end
|
780
871
|
|
781
872
|
alias to_summary to_s
|
@@ -985,8 +1076,15 @@ end
|
|
985
1076
|
#
|
986
1077
|
class ClipboardAction < DeviceAction
|
987
1078
|
|
988
|
-
def initialize(
|
1079
|
+
def initialize(obj=nil)
|
989
1080
|
|
1081
|
+
h = if obj.is_a? Hash then
|
1082
|
+
obj
|
1083
|
+
elsif obj.is_a? Array
|
1084
|
+
e, macro = obj
|
1085
|
+
{clipboard_text: e.text('item/description').to_s}
|
1086
|
+
end
|
1087
|
+
|
990
1088
|
options = {
|
991
1089
|
clipboard_text: ''
|
992
1090
|
}
|
@@ -1066,14 +1164,60 @@ end
|
|
1066
1164
|
#
|
1067
1165
|
class UIInteractionAction < DeviceAction
|
1068
1166
|
|
1069
|
-
def initialize(
|
1167
|
+
def initialize(obj=nil)
|
1070
1168
|
|
1169
|
+
if obj.is_a? Hash then
|
1170
|
+
h = obj
|
1171
|
+
elsif obj.is_a? Array
|
1172
|
+
|
1173
|
+
e, macro = obj
|
1174
|
+
s = e.text('item/description').to_s
|
1175
|
+
|
1176
|
+
r = s.match(/^(Click|Long Click) \[(.*)\]$/)
|
1177
|
+
|
1178
|
+
# [Current focus] # Current focus
|
1179
|
+
# [0,0] # x,y location
|
1180
|
+
# [274,186] # Identify in app
|
1181
|
+
# [fooo] # Text content
|
1182
|
+
|
1183
|
+
h = {
|
1184
|
+
ui_interaction_configuration: {
|
1185
|
+
:xy_point=>{:x=>0, :y=>0},
|
1186
|
+
:type=>"Click"}
|
1187
|
+
}
|
1188
|
+
h2 = h[:ui_interaction_configuration]
|
1189
|
+
|
1190
|
+
if r then
|
1191
|
+
|
1192
|
+
h[:action] = 0
|
1193
|
+
|
1194
|
+
click, detail = r.captures
|
1195
|
+
h2[:long_click] = false if click.downcase.to_sym == :click
|
1196
|
+
|
1197
|
+
if detail == 'Current focus' then
|
1198
|
+
h2[:click_option] = 0
|
1199
|
+
elsif detail =~ /\d+,\d+/
|
1200
|
+
# to-do
|
1201
|
+
else
|
1202
|
+
# text content
|
1203
|
+
h2[:click_option] = 1
|
1204
|
+
h2[:text_content] = detail
|
1205
|
+
end
|
1206
|
+
|
1207
|
+
#h[:ui_interaction_configuration] = h2
|
1208
|
+
end
|
1209
|
+
|
1210
|
+
end
|
1211
|
+
|
1071
1212
|
options = {
|
1072
1213
|
ui_interaction_configuration: {:type=>"Copy"},
|
1073
1214
|
action: 2
|
1074
1215
|
}
|
1075
1216
|
|
1076
|
-
|
1217
|
+
|
1218
|
+
super(options.merge h)
|
1219
|
+
|
1220
|
+
@list = %w(uiInteractionConfiguration action xyPoint textContent clickOption type longClick)
|
1077
1221
|
|
1078
1222
|
end
|
1079
1223
|
|
@@ -1113,7 +1257,8 @@ class UIInteractionAction < DeviceAction
|
|
1113
1257
|
"Gesture [%s]" % detail
|
1114
1258
|
end
|
1115
1259
|
|
1116
|
-
'UI Interaction' + "\n
|
1260
|
+
@s = 'UI Interaction' + "\n" + s #+ ' ' + @h.inspect
|
1261
|
+
super()
|
1117
1262
|
end
|
1118
1263
|
|
1119
1264
|
alias to_summary to_s
|
@@ -1133,7 +1278,10 @@ class VoiceSearchAction < DeviceAction
|
|
1133
1278
|
end
|
1134
1279
|
|
1135
1280
|
def to_s(colour: false, indent: 0)
|
1136
|
-
|
1281
|
+
|
1282
|
+
@s = 'Voice Search' # + @h.inspect
|
1283
|
+
super()
|
1284
|
+
|
1137
1285
|
end
|
1138
1286
|
|
1139
1287
|
alias to_summary to_s
|
@@ -1275,7 +1423,11 @@ class SetAutoRotateAction < DeviceSettingsAction
|
|
1275
1423
|
end
|
1276
1424
|
|
1277
1425
|
def to_s(colour: false, indent: 0)
|
1278
|
-
|
1426
|
+
|
1427
|
+
#'SetAutoRotateAction ' + @h.inspect
|
1428
|
+
@s = 'Auto Rotate ' + %w(On Off Toggle)[@h[:state]]
|
1429
|
+
super()
|
1430
|
+
|
1279
1431
|
end
|
1280
1432
|
|
1281
1433
|
alias to_summary to_s
|
@@ -2061,7 +2213,7 @@ class ControlMediaAction < MediaAction
|
|
2061
2213
|
obj
|
2062
2214
|
elsif obj.is_a? Array
|
2063
2215
|
|
2064
|
-
e, macro = obj
|
2216
|
+
e, macro, h2 = obj
|
2065
2217
|
s = e.text('item/description').to_s
|
2066
2218
|
app = s[/Simulate Media Button \(([^\)]+)/,1]
|
2067
2219
|
|
@@ -2070,18 +2222,21 @@ class ControlMediaAction < MediaAction
|
|
2070
2222
|
{
|
2071
2223
|
application_name: app, package_name: APPS[app],
|
2072
2224
|
simulate_media_button: true
|
2073
|
-
}
|
2225
|
+
}.merge h2
|
2074
2226
|
|
2075
2227
|
else
|
2076
|
-
{
|
2228
|
+
{
|
2229
|
+
send_media_player_commands: true,
|
2230
|
+
simulate_media_button: false
|
2231
|
+
}
|
2077
2232
|
end
|
2078
|
-
end
|
2233
|
+
end
|
2234
|
+
#puts 'h: ' + h.inspect
|
2079
2235
|
|
2080
2236
|
options = {
|
2081
|
-
|
2082
|
-
|
2083
|
-
|
2084
|
-
simulate_media_button: true,
|
2237
|
+
option: "Play/Pause",
|
2238
|
+
send_media_player_commands: true,
|
2239
|
+
simulate_media_button: false,
|
2085
2240
|
}
|
2086
2241
|
|
2087
2242
|
super(options.merge h)
|
@@ -2094,6 +2249,8 @@ class ControlMediaAction < MediaAction
|
|
2094
2249
|
|
2095
2250
|
if @h[:simulate_media_button] then
|
2096
2251
|
@s += "\nSimulate Media Button (%s)" % @h[:application_name]
|
2252
|
+
else
|
2253
|
+
@s += "\nSimulate Audio Button"
|
2097
2254
|
end
|
2098
2255
|
|
2099
2256
|
super()
|
@@ -41,6 +41,27 @@ class ActionsNlp
|
|
41
41
|
|
42
42
|
# -- Connectivity ------------------------------------------------------
|
43
43
|
|
44
|
+
get /^Airplane Mode (On|Off|Toggle)/i do |state|
|
45
|
+
|
46
|
+
index = %w(on off toggle).index state.downcase
|
47
|
+
[SetAirplaneModeAction, {state: index }]
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
get /^(Enable|Disable|Toggle) Bluetooth/i do |state|
|
52
|
+
|
53
|
+
index = %w(enable disable toggle).index state.downcase
|
54
|
+
[SetBluetoothAction, {state: index }]
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
get /^(Connect|Disconnect) Audio Device/i do |state|
|
59
|
+
|
60
|
+
index = %w(connect disconnect).index(state.downcase) + 3
|
61
|
+
[SetBluetoothAction, {state: index }]
|
62
|
+
|
63
|
+
end
|
64
|
+
|
44
65
|
get /^(Enable|Disable) HotSpot/i do |state|
|
45
66
|
enable, state = if state.downcase == 'enable' then
|
46
67
|
[true, 0]
|
@@ -50,6 +71,19 @@ class ActionsNlp
|
|
50
71
|
[SetHotspotAction, {turn_wifi_on: enable, state: state }]
|
51
72
|
end
|
52
73
|
|
74
|
+
get /^(Enable|Disable|Toggle) Wifi/i do |state|
|
75
|
+
|
76
|
+
index = %w(enable disable toggle).index state.downcase
|
77
|
+
[SetWifiAction, {state: index }]
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
get /^Connect to Network$/i do
|
82
|
+
|
83
|
+
[SetWifiAction, {state: 4 }]
|
84
|
+
|
85
|
+
end
|
86
|
+
|
53
87
|
# e.g. message popup: hello world!
|
54
88
|
get /^(?:message popup|popup message): (.*)/i do |msg|
|
55
89
|
[ToastAction, {msg: msg}]
|
@@ -86,10 +120,15 @@ class ActionsNlp
|
|
86
120
|
|
87
121
|
get /^take_picture/i do
|
88
122
|
[TakePictureAction, {}]
|
89
|
-
end
|
123
|
+
end
|
124
|
+
|
125
|
+
get /^Take Screenshot/i do
|
126
|
+
[TakeScreenshotAction, {}]
|
127
|
+
end
|
90
128
|
|
91
129
|
# -- DEVICE ACTIONS ------------------------------------------------------
|
92
130
|
|
131
|
+
#
|
93
132
|
get /^Speak text \(([^\)]+)\)/i do |text|
|
94
133
|
[SpeakTextAction, {text: text}]
|
95
134
|
end
|
@@ -100,7 +139,11 @@ class ActionsNlp
|
|
100
139
|
|
101
140
|
get /^Speak text$/i do |text|
|
102
141
|
[SpeakTextAction, {}]
|
103
|
-
end
|
142
|
+
end
|
143
|
+
|
144
|
+
get /^UI Interaction$/i do
|
145
|
+
[UIInteractionAction, {}]
|
146
|
+
end
|
104
147
|
|
105
148
|
get /^Vibrate \(([^\)]+)/i do |pattern|
|
106
149
|
[VibrateAction, {pattern: pattern}]
|
@@ -109,6 +152,19 @@ class ActionsNlp
|
|
109
152
|
get /^Vibrate$/i do |pattern|
|
110
153
|
[VibrateAction, {pattern: 'short buzz'}]
|
111
154
|
end
|
155
|
+
|
156
|
+
get /^Voice Search$/i do
|
157
|
+
[VoiceSearchAction, {}]
|
158
|
+
end
|
159
|
+
|
160
|
+
# -- Device settings ---------------------------------------
|
161
|
+
|
162
|
+
get /^Auto Rotate (On|Off|Toggle)$/i do |state|
|
163
|
+
|
164
|
+
a = %w(on off toggle)
|
165
|
+
|
166
|
+
[SetAutoRotateAction, {state: a.map(&:downcase).index(state.downcase)}]
|
167
|
+
end
|
112
168
|
|
113
169
|
# e.g. Display Notification: Hi there: This is the body of the message
|
114
170
|
get /^Display Notification: ([^:]+): [^$]+$/i do |subject, text|
|
@@ -123,6 +179,10 @@ class ActionsNlp
|
|
123
179
|
[SetWifiAction, {state: state}]
|
124
180
|
|
125
181
|
end
|
182
|
+
|
183
|
+
get /^Fill Clipboard$/i do
|
184
|
+
[ClipboardAction, {}]
|
185
|
+
end
|
126
186
|
|
127
187
|
# e.g. Play: Altair
|
128
188
|
get /^Play: (.*)$/i do |name|
|
@@ -130,16 +190,34 @@ class ActionsNlp
|
|
130
190
|
[PlaySoundAction, {file_path: name}]
|
131
191
|
|
132
192
|
end
|
193
|
+
|
194
|
+
get /^Launch Shortcut:? (?:Amazon|Ask) Alexa$/i do
|
195
|
+
[LaunchShortcutAction, {shortcut: 'Ask Alexa'}]
|
196
|
+
end
|
197
|
+
|
198
|
+
get /^Shortcut:? (?:Amazon|Ask) Alexa$/i do
|
199
|
+
[LaunchShortcutAction, {shortcut: 'Ask Alexa'}]
|
200
|
+
end
|
133
201
|
|
134
202
|
# e.g. Launch Settings
|
135
|
-
get /^Launch (.*)$/i do |
|
203
|
+
get /^Launch (.*)$/i do |s|
|
136
204
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
205
|
+
h = {}
|
206
|
+
|
207
|
+
if s[0] == '[' then
|
208
|
+
|
209
|
+
h[:launch_by_package_name] = s
|
210
|
+
h[:option] = 1
|
211
|
+
|
212
|
+
else
|
213
|
+
application = s
|
214
|
+
h[:application_name] = application
|
215
|
+
h[:package_to_launch] = APPS[application] || 'com.android.' +
|
216
|
+
application.downcase.split().join('.')
|
217
|
+
h[:option] = 0
|
218
|
+
|
219
|
+
end
|
220
|
+
|
143
221
|
[LaunchActivityAction, h]
|
144
222
|
|
145
223
|
end
|
@@ -157,6 +235,19 @@ class ActionsNlp
|
|
157
235
|
|
158
236
|
end
|
159
237
|
|
238
|
+
|
239
|
+
get /^Open Website \/ HTTP GET$/i do
|
240
|
+
|
241
|
+
[OpenWebPageAction, {http_get: false}]
|
242
|
+
|
243
|
+
end
|
244
|
+
|
245
|
+
get /^(?:open|goto) ((?:https?:\/\/|\[lv=)[^$]+)$/i do |url|
|
246
|
+
|
247
|
+
[OpenWebPageAction, url_to_open: url, http_get: false]
|
248
|
+
|
249
|
+
end
|
250
|
+
|
160
251
|
# e.g. webhook entered_kitchen
|
161
252
|
#
|
162
253
|
get /(?:webhook|HTTP GET) ([^$]+)$/i do |s|
|
@@ -164,6 +255,10 @@ class ActionsNlp
|
|
164
255
|
[OpenWebPageAction, {key => s}]
|
165
256
|
end
|
166
257
|
|
258
|
+
get /(https?:\/\/[^$]+)$/i do |url|
|
259
|
+
[OpenWebPageAction, {url_to_open: url}]
|
260
|
+
end
|
261
|
+
|
167
262
|
#
|
168
263
|
get /^WebHook \(Url\)/i do
|
169
264
|
[OpenWebPageAction, {}]
|
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
|
@@ -195,6 +195,7 @@ class MacroObject
|
|
195
195
|
|
196
196
|
end
|
197
197
|
|
198
|
+
|
198
199
|
private
|
199
200
|
|
200
201
|
def hashify(h)
|
@@ -215,6 +215,10 @@ class PowerButtonToggleTrigger < Trigger
|
|
215
215
|
super(options.merge h)
|
216
216
|
|
217
217
|
end
|
218
|
+
|
219
|
+
def match?(detail={}, model=nil)
|
220
|
+
@h[:num_toggles] == detail[:num_toggles].to_i
|
221
|
+
end
|
218
222
|
|
219
223
|
def to_s(colour: false)
|
220
224
|
"Power Button Toggle (%s)" % @h[:num_toggles] #+ @h.inspect
|
@@ -19,10 +19,14 @@ class TriggersNlp
|
|
19
19
|
|
20
20
|
# -- Battery/Power ---------------------------------------------
|
21
21
|
|
22
|
-
get
|
22
|
+
get /^Power Button Toggle \((\d)\)/i do |num|
|
23
23
|
[PowerButtonToggleTrigger, {num_toggles: num.to_i}]
|
24
24
|
end
|
25
25
|
|
26
|
+
get /^Power Button (\d) times$/i do |num|
|
27
|
+
[PowerButtonToggleTrigger, {num_toggles: num.to_i}]
|
28
|
+
end
|
29
|
+
|
26
30
|
get /^Power Connected: (Wired \([^\)]+\))/i do |s|
|
27
31
|
|
28
32
|
h = {
|
@@ -67,6 +71,8 @@ class TriggersNlp
|
|
67
71
|
[WifiConnectionTrigger, {}]
|
68
72
|
end
|
69
73
|
|
74
|
+
|
75
|
+
|
70
76
|
# -- Device Events ----------------------------------------------------
|
71
77
|
|
72
78
|
get /^NFC Tag$/i do |state|
|
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.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -11,31 +11,31 @@ cert_chain:
|
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjAxMDI2MjIxOTU3WhcN
|
15
|
+
MjExMDI2MjIxOTU3WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDoaG+o
|
17
|
+
lMHEAZHl1nsdoJXwq0LC+quj5tNVCWZh4YQbBElxPfqL/+37lEwiJm9DC2ITVit1
|
18
|
+
H/PAJipSJrOlnX5gBs2xZuKDChGBPLaquioK4ZyTNzMHNTEZiWz3NAGNO+bJuWQd
|
19
|
+
Ho9+C+/BhCgG85XbDrmFdEnYnep3qntkgB860+9NRQNQ53cFn8nBOfGSpvN3Fsqp
|
20
|
+
Ja7FyW59mlLkYccWZrVR+ZAdLYZQLNQ8yobSINKLOkXA9cqExF/pxMjxZpREM1S4
|
21
|
+
qY8Oo4YUw6I2TH3mUkACRdQMmyY/GRR0hDKAFwpsXajz+jmztQ3+dONsqPt+crJB
|
22
|
+
Mk7vSJbCXpVovljhSB3fAGOB0x9hd43AwijgkaW/8lm4N7jajalwXbckaV5C7nnS
|
23
|
+
uMDoU1TBdSKlP3f1VhFVdDBEh8KaqTzyrV8QvJKPirW8BrgpdXB7xYafHBXBSMxo
|
24
|
+
MiafxZoXRxY9cQc7UY9RjFLyKDipubSWhiHfHURnBYgNMJit0mdNGtVBpj8CAwEA
|
25
|
+
AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUuSf+7NQJ
|
26
|
+
u1oQ39UyDRyono+FMTYwJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
|
27
27
|
c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEAcb48mw7R7DM/tkRsqJ3xARYEsqswd6RIcUEQlk+N
|
29
|
+
wl6h9Ep5XXZRiWkjl7LvIwixLsLYJpnr4HrJSMBJ3fOKWO19r+LgxS98BRnIR/ig
|
30
|
+
hkvDTENgc3rCM+1D40IDUVVNOITDO9sJgBGoFCPqySwvqD3k8ZBSsgEUvHCnX0mU
|
31
|
+
7KPih5gG+3xgOKy+OYP9KT68nqJk0MOZa0wf+7Mdi0yfCQ35OWU6k4MLhVlPn3rs
|
32
|
+
KTWiZmv8DTY/GD7UmsU9PyWo4mRL/HStHKOJpayJ+hzdezD1gIKCViUJVQLaNpV4
|
33
|
+
a1xyM49vQ8wAk4hd+36Hs+te+24tUgisk5YF/m5/xHLPzCwU/dzghzyqurY1CcdZ
|
34
|
+
AP47l82yywwqaxpCXBvlpPZ81LOozzu7JOmr/ziys4ube7PbUYN6uiwfoE2/N8Ol
|
35
|
+
cu2W9lmvKJ505bT8+KLouVOtLlxYZknIB/uIea9r5rrGEJDMdYEYl4ZySFmkvJR4
|
36
|
+
tf7VMFcAy1q1HMyemsBUJk5h
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2020-10-
|
38
|
+
date: 2020-10-30 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: glw
|
metadata.gz.sig
CHANGED
Binary file
|