roku-ecp 0.1.0 → 0.1.1
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
- data/bin/roku +4 -0
- data/lib/roku/client.rb +1 -1
- data/lib/roku/discover.rb +15 -2
- data/roku-ecp.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: acb4cbf41e1b18efedf721b6f71f86a4a19269f96daa7488c9292e347ea73599
|
4
|
+
data.tar.gz: 4249254d232d264bbfb61f4862b2baaccc0b74fac79040a3edfcbbf2225d9116
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b9dedf8f5a6341a6a5607c3f414a0490ceaaf7407246c8b1e2e486213b27a2a4c4c2d477714b39f03553977475c14a4c47fe10c94105a7273839bb34ed422dc
|
7
|
+
data.tar.gz: 401e8af162143954e6eaeba630ef7e6e17db34e98a5182bd0360c499c4c8a7b3dab353b7d0ba4746f51ef75123fa52908f2baf29567f7b1d61bd3e6b83fc3a1c
|
data/bin/roku
CHANGED
data/lib/roku/client.rb
CHANGED
data/lib/roku/discover.rb
CHANGED
@@ -10,15 +10,28 @@ module Roku
|
|
10
10
|
"Man: \"ssdp:discover\"\n" \
|
11
11
|
"ST: roku:ecp\n\n".freeze
|
12
12
|
|
13
|
+
class DeviceNotFound < StandardError
|
14
|
+
end
|
15
|
+
|
13
16
|
class << self
|
14
17
|
def search
|
15
18
|
bind
|
16
19
|
socket.send(REQUEST, 0, MULTICAST_ADDR, PORT)
|
17
|
-
|
20
|
+
begin
|
21
|
+
parse_address(await_response)
|
22
|
+
rescue Timeout::Error
|
23
|
+
raise DeviceNotFound,
|
24
|
+
"Roku's automatic device discovery failed. If you continue " \
|
25
|
+
"to receive this message, you should try restarting your " \
|
26
|
+
"router, and you may want to manually configure this. You " \
|
27
|
+
"can do this by finding the device's IP via your router " \
|
28
|
+
"and setting the ROKU_HOST environment variable to " \
|
29
|
+
"\"http://{{device-ip}}:8060\"."
|
30
|
+
end
|
18
31
|
end
|
19
32
|
|
20
33
|
def await_response
|
21
|
-
Timeout.timeout(
|
34
|
+
Timeout.timeout(10) do
|
22
35
|
loop do
|
23
36
|
response, = socket.recvfrom(1024)
|
24
37
|
if response.include?('LOCATION') && response.include?('200 OK')
|
data/roku-ecp.gemspec
CHANGED