ruby-macrodroid 0.9.14 → 0.9.19
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 +278 -41
- data/lib/ruby-macrodroid/actionsnlp.rb +108 -7
- data/lib/ruby-macrodroid/base.rb +3 -2
- data/lib/ruby-macrodroid/triggersnlp.rb +2 -0
- 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: b5b0e328f9ba62c9217cfc9dcce286b3d450953d77eef32ba00c7fd1bf07d3d7
|
4
|
+
data.tar.gz: d8e6c46d8fc8b4a3185ab9b1a0da3a6937e1aabf43a152e6c238b1187455c0db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11f4918c738e8e42d78f0d5acc2b04994b45848d5d56010dc6c3f89f6c1a05ea24166cd95aaeca736a09d2b0990874cbdfdd8dba8f9548d999e5c50bae2e9dba
|
7
|
+
data.tar.gz: '09d9a30e0c8799ae2cb68acccc3d505a6f8cbe04a6206c28d0584e2b3f16b26b92b394ea24f137bfb576b8df5574a50aed3d32a09b03fe311e4427ddfab7bd3f'
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
@@ -32,6 +32,36 @@
|
|
32
32
|
#
|
33
33
|
|
34
34
|
|
35
|
+
APPS = {
|
36
|
+
'AutoBoy' => 'com.happyconz.blackbox',
|
37
|
+
'Amazon Alexa' => 'com.amazon.dee.app',
|
38
|
+
'Brave' => 'com.brave.browser',
|
39
|
+
'Camera' => 'com.mediatek.camera',
|
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',
|
44
|
+
'File Manager' => 'com.alphainventor.filemanager',
|
45
|
+
'Firefox' => 'org.mozilla.firefox',
|
46
|
+
'Google Chrome' => 'com.google.android.chrome',
|
47
|
+
'Google Calendar' => 'com.google.android.calendar',
|
48
|
+
'Chrome' => 'com.google.android.chrome',
|
49
|
+
'Earth' => 'com.google.earth',
|
50
|
+
'Google Home' => 'com.google.android.apps.chromecast.app',
|
51
|
+
'Google Play Music' => 'com.google.android.music',
|
52
|
+
'MacroDroid' => 'com.arlosoft.macrodroid',
|
53
|
+
'QuickEdit Text Editor Pro' => 'com.rhmsoft.edit.pro',
|
54
|
+
'QR & Barcode Reader' => 'com.teacapps.barcodescanner',
|
55
|
+
'Settings' => 'com.android.settings',
|
56
|
+
'Chrome' => 'com.google.android.street',
|
57
|
+
'tinyCam PRO' => 'com.alexvas.dvr.pro',
|
58
|
+
'Tor Browser' => 'org.torproject.torbrowser',
|
59
|
+
'VLC' => 'org.videolan.vlc',
|
60
|
+
'WiFi FTP Server' => 'com.medhaapps.wififtpserver',
|
61
|
+
'YouTube' => 'com.google.android.youtube'
|
62
|
+
}
|
63
|
+
|
64
|
+
|
35
65
|
class Action < MacroObject
|
36
66
|
using ColouredText
|
37
67
|
using Params
|
@@ -75,20 +105,29 @@ end
|
|
75
105
|
class LaunchActivityAction < ApplicationAction
|
76
106
|
|
77
107
|
def initialize(h={})
|
78
|
-
|
108
|
+
|
109
|
+
# option 0 is by application name, 1 is launch by package name
|
110
|
+
#
|
79
111
|
options = {
|
80
112
|
application_name: 'Chrome',
|
81
113
|
package_to_launch: 'com.android.chrome',
|
82
114
|
exclude_from_recents: false,
|
83
|
-
start_new: false
|
115
|
+
start_new: false,
|
116
|
+
option: 0,
|
117
|
+
launch_by_package_name: ''
|
84
118
|
}
|
85
119
|
|
86
120
|
super(options.merge h)
|
121
|
+
|
122
|
+
@list = %w(option launchByPackageName)
|
87
123
|
|
88
124
|
end
|
89
125
|
|
90
126
|
def to_s(colour: false, indent: 0)
|
91
|
-
|
127
|
+
option = @h[:option] == 0 ? @h[:application_name] : \
|
128
|
+
@h[:launch_by_package_name]
|
129
|
+
@s = 'Launch ' + option
|
130
|
+
super()
|
92
131
|
end
|
93
132
|
|
94
133
|
end
|
@@ -119,13 +158,30 @@ end
|
|
119
158
|
#
|
120
159
|
class LaunchShortcutAction < ApplicationAction
|
121
160
|
|
122
|
-
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
|
123
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
|
124
178
|
options = {
|
125
179
|
:app_name=>"Amazon Alexa", :intent_encoded=>"", :name=>"Ask Alexa"
|
126
180
|
}
|
127
181
|
|
128
182
|
super(options.merge h)
|
183
|
+
|
184
|
+
#@list = %w(appName intentEncoded name)
|
129
185
|
|
130
186
|
end
|
131
187
|
|
@@ -150,17 +206,17 @@ class OpenWebPageAction < ApplicationAction
|
|
150
206
|
|
151
207
|
def initialize(obj={}, macro=nil)
|
152
208
|
|
153
|
-
$debug =
|
209
|
+
$debug = true
|
154
210
|
puts ('obj: ' + obj.inspect).debug if $debug
|
155
211
|
|
156
212
|
h = if obj.is_a? Hash then
|
157
213
|
|
158
|
-
obj.merge({macro: macro})
|
214
|
+
obj.merge({macro: macro}) #unless obj and obj[:macro]
|
159
215
|
|
160
216
|
elsif obj.is_a? Array
|
161
217
|
|
162
218
|
puts ('obj: ' + obj.inspect).debug if $debug
|
163
|
-
e, macro = obj
|
219
|
+
e, macro, h3 = obj
|
164
220
|
|
165
221
|
a = e.xpath('item/*')
|
166
222
|
|
@@ -181,7 +237,7 @@ class OpenWebPageAction < ApplicationAction
|
|
181
237
|
{url: (txt || e.text)}
|
182
238
|
end
|
183
239
|
|
184
|
-
h2.merge(macro: macro)
|
240
|
+
h2.merge(macro: macro).merge(h3)
|
185
241
|
|
186
242
|
end
|
187
243
|
|
@@ -219,6 +275,7 @@ class OpenWebPageAction < ApplicationAction
|
|
219
275
|
h[:macro].title.downcase.gsub(/ +/,'-')
|
220
276
|
|
221
277
|
end
|
278
|
+
puts 'url: ' + url.inspect if $debug
|
222
279
|
|
223
280
|
if h2 then
|
224
281
|
|
@@ -242,7 +299,8 @@ class OpenWebPageAction < ApplicationAction
|
|
242
299
|
end
|
243
300
|
|
244
301
|
def to_s(colour: false, indent: 0)
|
245
|
-
|
302
|
+
s = @h[:http_get] ? '' : 'Open Website / '
|
303
|
+
@s = s + "HTTP GET\nurl: " + @h[:url_to_open]
|
246
304
|
super()
|
247
305
|
end
|
248
306
|
|
@@ -378,6 +436,61 @@ class TakePictureAction < CameraAction
|
|
378
436
|
end
|
379
437
|
|
380
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
|
+
|
381
494
|
# Conditions/Loops
|
382
495
|
#
|
383
496
|
class IfConfirmedThenAction < Action
|
@@ -684,7 +797,7 @@ class SetAirplaneModeAction < ConnectivityAction
|
|
684
797
|
|
685
798
|
state = ['On', 'Off', 'Toggle'][@h[:state]]
|
686
799
|
@s = 'Airplane Mode ' + state
|
687
|
-
super(
|
800
|
+
super()
|
688
801
|
|
689
802
|
end
|
690
803
|
|
@@ -706,34 +819,20 @@ class SetWifiAction < ConnectivityAction
|
|
706
819
|
|
707
820
|
end
|
708
821
|
|
709
|
-
def to_s(colour: false, indent: 0)
|
710
|
-
|
711
|
-
|
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()
|
712
832
|
end
|
713
833
|
|
714
834
|
end
|
715
835
|
|
716
|
-
# Category: Connectivity
|
717
|
-
#
|
718
|
-
class SetBluetoothAction < ConnectivityAction
|
719
|
-
|
720
|
-
def initialize(h={})
|
721
|
-
|
722
|
-
options = {
|
723
|
-
device_name: '',
|
724
|
-
state: 0
|
725
|
-
}
|
726
|
-
|
727
|
-
super(options.merge h)
|
728
|
-
|
729
|
-
end
|
730
|
-
|
731
|
-
def to_s(colour: false, indent: 0)
|
732
|
-
'SetBluetoothAction ' + @h.inspect
|
733
|
-
end
|
734
|
-
|
735
|
-
alias to_summary to_s
|
736
|
-
end
|
737
836
|
|
738
837
|
# Category: Connectivity
|
739
838
|
#
|
@@ -742,6 +841,8 @@ class SetBluetoothAction < ConnectivityAction
|
|
742
841
|
def initialize(h={})
|
743
842
|
|
744
843
|
options = {
|
844
|
+
|
845
|
+
device_address: '',
|
745
846
|
device_name: '',
|
746
847
|
state: 1
|
747
848
|
}
|
@@ -751,7 +852,21 @@ class SetBluetoothAction < ConnectivityAction
|
|
751
852
|
end
|
752
853
|
|
753
854
|
def to_s(colour: false, indent: 0)
|
754
|
-
|
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
|
+
|
755
870
|
end
|
756
871
|
|
757
872
|
alias to_summary to_s
|
@@ -961,8 +1076,15 @@ end
|
|
961
1076
|
#
|
962
1077
|
class ClipboardAction < DeviceAction
|
963
1078
|
|
964
|
-
def initialize(
|
1079
|
+
def initialize(obj=nil)
|
965
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
|
+
|
966
1088
|
options = {
|
967
1089
|
clipboard_text: ''
|
968
1090
|
}
|
@@ -1042,14 +1164,60 @@ end
|
|
1042
1164
|
#
|
1043
1165
|
class UIInteractionAction < DeviceAction
|
1044
1166
|
|
1045
|
-
def initialize(
|
1167
|
+
def initialize(obj=nil)
|
1046
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
|
+
|
1047
1212
|
options = {
|
1048
1213
|
ui_interaction_configuration: {:type=>"Copy"},
|
1049
1214
|
action: 2
|
1050
1215
|
}
|
1051
1216
|
|
1052
|
-
|
1217
|
+
|
1218
|
+
super(options.merge h)
|
1219
|
+
|
1220
|
+
@list = %w(uiInteractionConfiguration action xyPoint textContent clickOption type longClick)
|
1053
1221
|
|
1054
1222
|
end
|
1055
1223
|
|
@@ -1089,7 +1257,8 @@ class UIInteractionAction < DeviceAction
|
|
1089
1257
|
"Gesture [%s]" % detail
|
1090
1258
|
end
|
1091
1259
|
|
1092
|
-
'UI Interaction' + "\n
|
1260
|
+
@s = 'UI Interaction' + "\n" + s #+ ' ' + @h.inspect
|
1261
|
+
super()
|
1093
1262
|
end
|
1094
1263
|
|
1095
1264
|
alias to_summary to_s
|
@@ -1109,7 +1278,10 @@ class VoiceSearchAction < DeviceAction
|
|
1109
1278
|
end
|
1110
1279
|
|
1111
1280
|
def to_s(colour: false, indent: 0)
|
1112
|
-
|
1281
|
+
|
1282
|
+
@s = 'Voice Search' # + @h.inspect
|
1283
|
+
super()
|
1284
|
+
|
1113
1285
|
end
|
1114
1286
|
|
1115
1287
|
alias to_summary to_s
|
@@ -1251,7 +1423,11 @@ class SetAutoRotateAction < DeviceSettingsAction
|
|
1251
1423
|
end
|
1252
1424
|
|
1253
1425
|
def to_s(colour: false, indent: 0)
|
1254
|
-
|
1426
|
+
|
1427
|
+
#'SetAutoRotateAction ' + @h.inspect
|
1428
|
+
@s = 'Auto Rotate ' + %w(On Off Toggle)[@h[:state]]
|
1429
|
+
super()
|
1430
|
+
|
1255
1431
|
end
|
1256
1432
|
|
1257
1433
|
alias to_summary to_s
|
@@ -2022,6 +2198,67 @@ end
|
|
2022
2198
|
|
2023
2199
|
# Category: Media
|
2024
2200
|
#
|
2201
|
+
|
2202
|
+
|
2203
|
+
# note: to find a package id from an App name, try searching for the name on
|
2204
|
+
# the Google Play Store and the id will be returned in the URL once the
|
2205
|
+
# correct app has been clicked. e.g.
|
2206
|
+
# https://play.google.com/store/apps/details?id=com.google.android.music
|
2207
|
+
#
|
2208
|
+
class ControlMediaAction < MediaAction
|
2209
|
+
|
2210
|
+
def initialize(obj=nil)
|
2211
|
+
|
2212
|
+
h = if obj.is_a? Hash then
|
2213
|
+
obj
|
2214
|
+
elsif obj.is_a? Array
|
2215
|
+
|
2216
|
+
e, macro, h2 = obj
|
2217
|
+
s = e.text('item/description').to_s
|
2218
|
+
app = s[/Simulate Media Button \(([^\)]+)/,1]
|
2219
|
+
|
2220
|
+
if app then
|
2221
|
+
|
2222
|
+
{
|
2223
|
+
application_name: app, package_name: APPS[app],
|
2224
|
+
simulate_media_button: true
|
2225
|
+
}.merge h2
|
2226
|
+
|
2227
|
+
else
|
2228
|
+
{
|
2229
|
+
send_media_player_commands: true,
|
2230
|
+
simulate_media_button: false
|
2231
|
+
}
|
2232
|
+
end
|
2233
|
+
end
|
2234
|
+
#puts 'h: ' + h.inspect
|
2235
|
+
|
2236
|
+
options = {
|
2237
|
+
option: "Play/Pause",
|
2238
|
+
send_media_player_commands: true,
|
2239
|
+
simulate_media_button: false,
|
2240
|
+
}
|
2241
|
+
|
2242
|
+
super(options.merge h)
|
2243
|
+
|
2244
|
+
end
|
2245
|
+
|
2246
|
+
def to_s(colour: false, indent: 0)
|
2247
|
+
|
2248
|
+
@s = 'Media ' + @h[:option] #+ @h.inspect
|
2249
|
+
|
2250
|
+
if @h[:simulate_media_button] then
|
2251
|
+
@s += "\nSimulate Media Button (%s)" % @h[:application_name]
|
2252
|
+
else
|
2253
|
+
@s += "\nSimulate Audio Button"
|
2254
|
+
end
|
2255
|
+
|
2256
|
+
super()
|
2257
|
+
end
|
2258
|
+
|
2259
|
+
alias to_summary to_s
|
2260
|
+
end
|
2261
|
+
|
2025
2262
|
class RecordMicrophoneAction < MediaAction
|
2026
2263
|
|
2027
2264
|
def initialize(h={})
|
@@ -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,14 +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
|
-
h = {
|
138
|
-
|
139
|
-
|
140
|
-
|
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
|
+
|
141
221
|
[LaunchActivityAction, h]
|
142
222
|
|
143
223
|
end
|
@@ -155,6 +235,19 @@ class ActionsNlp
|
|
155
235
|
|
156
236
|
end
|
157
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
|
+
|
158
251
|
# e.g. webhook entered_kitchen
|
159
252
|
#
|
160
253
|
get /(?:webhook|HTTP GET) ([^$]+)$/i do |s|
|
@@ -238,6 +331,14 @@ class ActionsNlp
|
|
238
331
|
[PauseAction, {delay_in_seconds: seconds.to_i}]
|
239
332
|
end
|
240
333
|
|
334
|
+
## -- Media -----------------------------------------
|
335
|
+
#
|
336
|
+
# options: Play/Pause, Previous, Next, Play, Pause, Stop
|
337
|
+
#
|
338
|
+
get /^Media ([^$]+)$/i do |option|
|
339
|
+
[ControlMediaAction, {option: option}]
|
340
|
+
end
|
341
|
+
|
241
342
|
# -- Screen ------------------------------------------------
|
242
343
|
#
|
243
344
|
get /^Screen (On|Off)$/i do |state|
|
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)
|
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.19
|
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-26 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: glw
|
metadata.gz.sig
CHANGED
Binary file
|