alexa_remotectl 0.4.3 → 0.4.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3390f693c5318ae22b5c79fbe464dacd839ef331c4d3f2a07e9aeed38229be2
4
- data.tar.gz: adb89f569f0f47f88304c5032b963e171c556d340f928dd70de0437318c9b09f
3
+ metadata.gz: ee085eb3e18299edb7c08f01ca1eac8f90ca30f6cc125b64deb18ff9af848662
4
+ data.tar.gz: 48225e18ed743504662f52f6abd3ba17bad63fa3035bfb04a29a85b1d176a0a4
5
5
  SHA512:
6
- metadata.gz: 874e773c33e46ab1843c655ba49f138ffff68f9ef7a088cf550f5791c3e6fa567545f1e1a8fab52083b860c3c512ffdebd86f312059c2fc9d1e5def5a9881539
7
- data.tar.gz: f0f91e9861f1cd68e3d2494341f6bbc28f2d482d5766b124b66f65e9cab60fa34d03f199516bc1f75936320e620096f40d9b33c9a98dfb2991575529c1736bbe
6
+ metadata.gz: efbd977b60c72d374cb8b3f7864030dc772fbd1fb6369e3a5ee74f1dc7ba41276c2df2b2640b983deccad8273a8a1cf6ca26237a60b72fc59e61cb489bac5a42
7
+ data.tar.gz: 2e40d366bb49d53f9808117034cfa87c276d4ddb212ee321320ce9f9dc7ead6a50db66e3f88b341a505ad322e0aee045f6a495162508fd105d79bfd37b4d9b33
checksums.yaml.gz.sig CHANGED
Binary file
@@ -13,7 +13,7 @@ require 'json'
13
13
  # Use the CodeWizard with the cURL command you've copied using Developer
14
14
  # tools on Alexa's SPA page (within the web browser).
15
15
  #
16
- # note: to find the correct url to convert, try clickin on pause or play to
16
+ # note: to find the correct url to convert, try clicking on pause or play to
17
17
  # invoke an AJAX request
18
18
 
19
19
  class CodeWizard
@@ -70,13 +70,29 @@ class AlexaRemoteCtl
70
70
 
71
71
  end
72
72
 
73
+ # Some audio streams can't be paused through the SPA API. Playing a
74
+ # historical queue, and then pausing it, is the best next option.
75
+ #
76
+ def force_pause()
77
+
78
+ r = list_hq()
79
+ queueid = r[:media][0][:queueId]
80
+
81
+ play_hq queueid
82
+ sleep 1
83
+
84
+ pause()
85
+
86
+ end
87
+
73
88
  def info()
74
89
  device_player()[:playerInfo]
75
90
  end
76
91
 
77
92
  def list_ebooks()
78
- get_json '/api/ebooks/library', "mediaOwnerCustomerId=#{@customerid}" +
93
+ r = get_json '/api/ebooks/library', "mediaOwnerCustomerId=#{@customerid}" +
79
94
  "&nextToken=&size=50"
95
+ r[:metadataList]
80
96
  end
81
97
 
82
98
  # list historical queue (hq)
@@ -104,7 +120,13 @@ class AlexaRemoteCtl
104
120
  pp_cmd('Play')
105
121
  end
106
122
 
107
- def play_ebook(id)
123
+ def play_ebook(obj)
124
+
125
+ id = if obj.is_a? Integer then
126
+ list_ebook()[obj][:asin]
127
+ else
128
+ obj
129
+ end
108
130
 
109
131
  serialno = @device[:serialno]
110
132
  type = @device[:type]
@@ -125,7 +147,15 @@ class AlexaRemoteCtl
125
147
  # play historical queue
126
148
  # note: You can find the queueid from an entry in the list_hq() result
127
149
  #
128
- def play_hq(queueid)
150
+ def play_hq(obj)
151
+
152
+ queueid = if obj.is_a? Integer then
153
+ r = list_hq()
154
+ r[:media][obj][:queueId]
155
+ else
156
+ obj
157
+ end
158
+
129
159
  device_phq(queueid)
130
160
  end
131
161
 
@@ -164,6 +194,8 @@ class AlexaRemoteCtl
164
194
  device_cmd(body)
165
195
  end
166
196
 
197
+ alias setvol vol=
198
+
167
199
  private
168
200
 
169
201
  # play, pause, or next
@@ -310,6 +342,7 @@ class AlexaDevices
310
342
 
311
343
  end
312
344
 
345
+ def force_pause(id) invoke(:force_pause, id) end
313
346
  def info(id=nil) invoke(:info, id) end
314
347
  def list_ebooks(id) invoke(:list_ebooks, id) end
315
348
  def list_hq(id=nil) invoke(:list_hq, id) 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.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file