alexa_remotectl 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/alexa_remotectl.rb +56 -32
- data.tar.gz.sig +3 -3
- 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: f3390f693c5318ae22b5c79fbe464dacd839ef331c4d3f2a07e9aeed38229be2
|
4
|
+
data.tar.gz: adb89f569f0f47f88304c5032b963e171c556d340f928dd70de0437318c9b09f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 874e773c33e46ab1843c655ba49f138ffff68f9ef7a088cf550f5791c3e6fa567545f1e1a8fab52083b860c3c512ffdebd86f312059c2fc9d1e5def5a9881539
|
7
|
+
data.tar.gz: f0f91e9861f1cd68e3d2494341f6bbc28f2d482d5766b124b66f65e9cab60fa34d03f199516bc1f75936320e620096f40d9b33c9a98dfb2991575529c1736bbe
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/alexa_remotectl.rb
CHANGED
@@ -62,7 +62,8 @@ class AlexaRemoteCtl
|
|
62
62
|
|
63
63
|
# note: Added the Cross-site request forgery (crsf) variable
|
64
64
|
#
|
65
|
-
def initialize(domain: 'alexa.amazon.co.uk', device: {}, cookie: '',
|
65
|
+
def initialize(domain: 'alexa.amazon.co.uk', device: {}, cookie: '',
|
66
|
+
customerid: '', csrf: '')
|
66
67
|
|
67
68
|
@domain, @device, @cookie, @customerid = domain, device, cookie, customerid
|
68
69
|
@csrf = csrf
|
@@ -78,6 +79,12 @@ class AlexaRemoteCtl
|
|
78
79
|
"&nextToken=&size=50"
|
79
80
|
end
|
80
81
|
|
82
|
+
# list historical queue (hq)
|
83
|
+
#
|
84
|
+
def list_hq()
|
85
|
+
get_json '/api/media/historical-queue', "size=50&offset=-1"
|
86
|
+
end
|
87
|
+
|
81
88
|
def mute?()
|
82
89
|
info()[:volume][:muted]
|
83
90
|
end
|
@@ -115,8 +122,11 @@ class AlexaRemoteCtl
|
|
115
122
|
|
116
123
|
end
|
117
124
|
|
118
|
-
|
119
|
-
|
125
|
+
# play historical queue
|
126
|
+
# note: You can find the queueid from an entry in the list_hq() result
|
127
|
+
#
|
128
|
+
def play_hq(queueid)
|
129
|
+
device_phq(queueid)
|
120
130
|
end
|
121
131
|
|
122
132
|
def playing?()
|
@@ -293,70 +303,84 @@ class AlexaDevices
|
|
293
303
|
#
|
294
304
|
def initialize(devicesx=[], devices: devicesx,
|
295
305
|
domain: 'alexa.amazon.co.uk', cookie: '', customerid: '',
|
296
|
-
csrf: '')
|
306
|
+
csrf: '', debug: false)
|
297
307
|
|
298
308
|
@devices, @domain, @cookie = devices, domain, cookie
|
299
|
-
@customerid, @csrf = customerid, csrf
|
309
|
+
@customerid, @csrf, @debug = customerid, csrf, debug
|
300
310
|
|
301
311
|
end
|
302
312
|
|
313
|
+
def info(id=nil) invoke(:info, id) end
|
314
|
+
def list_ebooks(id) invoke(:list_ebooks, id) end
|
315
|
+
def list_hq(id=nil) invoke(:list_hq, id) end
|
316
|
+
def mute?(id=nil) invoke2(:mute?, id) end
|
317
|
+
def next(id) invoke2(:next, id) end
|
318
|
+
|
303
319
|
def playing()
|
304
320
|
|
305
|
-
@devices.map do |device, label|
|
321
|
+
devices = @devices.map do |device, label|
|
322
|
+
|
323
|
+
puts 'label: ' + label.inspect if @debug
|
324
|
+
puts 'device: ' + device.inspect if @debug
|
325
|
+
|
306
326
|
alexa = get_alexa device
|
307
327
|
alexa.playing? ? [alexa, label] : nil
|
308
|
-
end.compact
|
309
|
-
|
310
|
-
end
|
311
328
|
|
312
|
-
|
329
|
+
end.compact
|
313
330
|
|
314
|
-
|
331
|
+
puts 'devices: ' + devices.inspect if @debug
|
332
|
+
return devices
|
315
333
|
|
316
|
-
|
334
|
+
end
|
317
335
|
|
318
|
-
|
319
|
-
|
336
|
+
def pause(id=nil) invoke2(:pause, id) end
|
337
|
+
def play(id) invoke(:play, id) end
|
338
|
+
def play_ebook(id) invoke(:list_hq, id) end
|
339
|
+
def play_hq(id,qid) invoke(:play_hq, id, qid) end
|
340
|
+
def playing?(id=nil) invoke(:playing, id) end
|
341
|
+
def text1(id=nil) invoke2(:text1, id) end
|
342
|
+
def text2(id=nil) invoke2(:text2, id) end
|
343
|
+
def title(id=nil) invoke2(:title, id) end
|
344
|
+
def vol(id=nil) invoke(:vol, id) end
|
345
|
+
def vol=(id=nil) invoke(:vol=, id) end
|
320
346
|
|
321
|
-
|
347
|
+
private
|
322
348
|
|
323
|
-
|
324
|
-
puts 'Pausing @' + label.inspect
|
325
|
-
alexa.pause
|
326
|
-
end
|
349
|
+
def get_alexa(device)
|
327
350
|
|
328
|
-
|
351
|
+
AlexaRemoteCtl.new(cookie: @cookie, device: device,
|
352
|
+
customerid: @customerid, csrf: @csrf)
|
329
353
|
end
|
330
354
|
|
331
|
-
def
|
332
|
-
|
333
|
-
a = @devices
|
355
|
+
def apply_cmd(a, cmd, id, args)
|
334
356
|
|
335
357
|
if id then
|
336
358
|
|
337
359
|
device, _ = a.find {|_, label| label.to_sym == id.to_sym}
|
338
360
|
alexa = get_alexa device
|
339
|
-
alexa.
|
361
|
+
alexa.method(cmd).call(*args)
|
340
362
|
|
341
363
|
else
|
342
364
|
|
343
|
-
a.
|
365
|
+
a.map do |device, label|
|
344
366
|
|
345
|
-
puts '
|
367
|
+
puts cmd.to_s + ' @' + label.inspect
|
346
368
|
alexa = get_alexa device
|
347
|
-
alexa.
|
369
|
+
alexa.method(cmd).call(*args)
|
348
370
|
|
349
371
|
end
|
350
372
|
|
351
373
|
end
|
352
374
|
end
|
353
375
|
|
354
|
-
|
355
|
-
|
356
|
-
|
376
|
+
def invoke(cmd, id, *args)
|
377
|
+
apply_cmd(@devices, cmd, id, args)
|
378
|
+
end
|
357
379
|
|
358
|
-
|
359
|
-
|
380
|
+
# apply command to an Alexa device which is currently playing
|
381
|
+
#
|
382
|
+
def invoke2(cmd, id, *args)
|
383
|
+
apply_cmd(playing(), cmd, id, args)
|
360
384
|
end
|
361
385
|
|
362
386
|
end
|
data.tar.gz.sig
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
�
|
2
|
-
V�
|
3
|
-
�
|
1
|
+
:�c>j<�;Iy6A�-=�i)�+4��b�
|
2
|
+
�"M�b�*��+�jM`|����L_WM�+ѫ�5�GX�T�E>u�T�ehK�[oO�P�ф�^e�)�MƢฮ�$����k�I�9�~b��Ӭ*�Ȩ+�22��,GA-��*ϑ`�[V��8�3ݽ�snf�՜L
|
3
|
+
�
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alexa_remotectl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
d/gEwBtUmduwWZNX2NOJehf8s1cnH9OBP7s1ziHjdkZCgkQm3QewRRcdfZeYwFi6
|
36
36
|
4kVEcApgAgd+04ctE6uiRn5o
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-05-
|
38
|
+
date: 2022-05-23 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: clipboard
|
metadata.gz.sig
CHANGED
Binary file
|