alexa_remotectl 0.3.0 → 0.4.0
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 +67 -0
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3641c9d28ab824390ab0dc3aebec594eb204fdb0d09f8536ded7a7efd541e62
|
4
|
+
data.tar.gz: 8afb412ab356140e1289d1df7b49487bbc72e2b0d0593f43106f32dc8e643683
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bf863c6ae5e8d4426a32d0b57b0c763aaff8534a0bc379eb3a30e0aaaebb564317d6463b4ab0025133d8b720721315a10c7dc00473c70bb79f4567d1961d1d9
|
7
|
+
data.tar.gz: eb8b72c82327e56afc915dbe0ed2400a05db3ea061c5ae478e61b9cfc7f8e36e3f0f0c4b73908a97e45280f618bab40a9645a7d6f02429bc8f7400675d92e0f1
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/alexa_remotectl.rb
CHANGED
@@ -87,6 +87,10 @@ class AlexaRemoteCtl
|
|
87
87
|
pp_cmd('Play')
|
88
88
|
end
|
89
89
|
|
90
|
+
def playing?()
|
91
|
+
info()[:state] == 'PLAYING'
|
92
|
+
end
|
93
|
+
|
90
94
|
# Artist name
|
91
95
|
#
|
92
96
|
def text1()
|
@@ -201,3 +205,66 @@ class AlexaRemoteCtl
|
|
201
205
|
end
|
202
206
|
|
203
207
|
end
|
208
|
+
|
209
|
+
class AlexaDevices
|
210
|
+
|
211
|
+
# devices = [[{*serialno*, *type*}, label], ...]
|
212
|
+
# note: label can be any identifier you choose e.g. kitchen
|
213
|
+
#
|
214
|
+
def initialize(devicesx=[], devices: devicesx,
|
215
|
+
domain: 'alexa.amazon.co.uk', cookie: '')
|
216
|
+
|
217
|
+
@devices, @domain, @cookie = devices, domain, cookie
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
def playing()
|
222
|
+
|
223
|
+
@devices.map do |device, label|
|
224
|
+
alexa = AlexaRemoteCtl.new(cookie: @cookie, device: device)
|
225
|
+
alexa.playing? ? [alexa, label] : nil
|
226
|
+
end.compact
|
227
|
+
|
228
|
+
end
|
229
|
+
|
230
|
+
def pause(id=nil)
|
231
|
+
|
232
|
+
a = playing()
|
233
|
+
|
234
|
+
if id then
|
235
|
+
|
236
|
+
alexa, _ = a.find {|_, label| label.to_sym == id.to_sym}
|
237
|
+
alexa.pause
|
238
|
+
|
239
|
+
else
|
240
|
+
|
241
|
+
a.each do |alexa, label|
|
242
|
+
puts 'Pausing @' + label.inspect
|
243
|
+
alexa.pause
|
244
|
+
end
|
245
|
+
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
def play(id=nil)
|
250
|
+
|
251
|
+
a = @devices
|
252
|
+
|
253
|
+
if id then
|
254
|
+
|
255
|
+
device, _ = a.find {|_, label| label.to_sym == id.to_sym}
|
256
|
+
alexa = AlexaRemoteCtl.new(cookie: @cookie, device: device)
|
257
|
+
alexa.play
|
258
|
+
|
259
|
+
else
|
260
|
+
|
261
|
+
a.each do |device, label|
|
262
|
+
puts 'Pausing @' + label.inspect
|
263
|
+
alexa = AlexaRemoteCtl.new(cookie: @cookie, device: device)
|
264
|
+
alexa.play
|
265
|
+
end
|
266
|
+
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
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
|
+
version: 0.4.0
|
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-22 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: clipboard
|
metadata.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
�tS��'-'9VN)�Y����>��4�����@o�
|
2
|
+
4�h��Wt�5�F�@�J��E"(�:E�wq9��;����gC��A�{�p�%p�Ay{�{u�(�^������dǤ�+Q9j]*�Y�+Ts��=ٗ�h���ng<"�����������
|