roku-ecp 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/roku/discover.rb +1 -0
- data/lib/roku/input.rb +26 -27
- data/readme.md +13 -0
- data/roku-ecp.gemspec +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3880c57a9d8d5b4eafd4f7e44cdcf3127bc389546caab4d2ec3448bf79dbd5b
|
4
|
+
data.tar.gz: 4708afac1245ee982e6a67661816a5edea27bef24a568f5128c869a9ed088bbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e260f6671001bf3b37cd4ea2819a2161e24bb14716d63cc120e65c2556b516d4ea2a420f7102b5195f89eaaf74a91a56ffd33321de26460862a08f79290cc7d
|
7
|
+
data.tar.gz: 2d3bb137fd4e569700afc078050a08631f8e4f18f6741791eb5f57c6856d94817ddd9c52cd24088f60f3e5d0a3a6ca53b73f68d098a780ab98df04f3c42c7113
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/lib/roku/discover.rb
CHANGED
data/lib/roku/input.rb
CHANGED
@@ -2,38 +2,27 @@ require 'io/console'
|
|
2
2
|
|
3
3
|
module Roku
|
4
4
|
class Input
|
5
|
+
BINDINGS = {
|
6
|
+
' ' => :Play,
|
7
|
+
"\r" => :Select,
|
8
|
+
"\e[A" => :Up,
|
9
|
+
"\e[B" => :Down,
|
10
|
+
"\e[C" => :Right,
|
11
|
+
"\e[D" => :Left,
|
12
|
+
"\e[1;5A" => :VolumeUp,
|
13
|
+
"\e[1;5B" => :VolumeDown,
|
14
|
+
"\u007F" => :Back
|
15
|
+
}.freeze
|
16
|
+
|
5
17
|
def run
|
6
18
|
while (input = read_char)
|
7
19
|
case input
|
8
|
-
when ' '
|
9
|
-
Roku::Client.keypress(:Play)
|
10
|
-
when "\r"
|
11
|
-
Roku::Client.keypress(:Select)
|
12
|
-
when "\e[A"
|
13
|
-
Roku::Client.keypress(:Up)
|
14
|
-
when "\e[B"
|
15
|
-
Roku::Client.keypress(:Down)
|
16
|
-
when "\e[C"
|
17
|
-
Roku::Client.keypress(:Right)
|
18
|
-
when "\e[D"
|
19
|
-
Roku::Client.keypress(:Left)
|
20
|
-
when "\u007F"
|
21
|
-
Roku::Client.keypress(:Back)
|
22
|
-
when "\e[1;5A"
|
23
|
-
Roku::Client.keypress(:VolumeUp)
|
24
|
-
when "\e[1;5B"
|
25
|
-
Roku::Client.keypress(:VolumeDown)
|
26
20
|
when 'a'
|
27
|
-
|
28
|
-
|
29
|
-
if app.nil?
|
30
|
-
print "\rNo app found."
|
31
|
-
else
|
32
|
-
print "\rLaunching #{app.name}."
|
33
|
-
app.launch!
|
34
|
-
end
|
35
|
-
when 'q', "\u0003"
|
21
|
+
launch_app(prompt('Launch: '))
|
22
|
+
when 'q', "\u0003", "\e"
|
36
23
|
break
|
24
|
+
when *BINDINGS.keys
|
25
|
+
Roku::Client.keypress(BINDINGS[input])
|
37
26
|
else
|
38
27
|
puts input.inspect
|
39
28
|
end
|
@@ -57,5 +46,15 @@ module Roku
|
|
57
46
|
print label
|
58
47
|
$stdin.gets.chomp
|
59
48
|
end
|
49
|
+
|
50
|
+
def launch_app(query)
|
51
|
+
app = Roku::Client.apps.find { |a| a.name.casecmp(query).zero? }
|
52
|
+
if app.nil?
|
53
|
+
print "\rNo app found."
|
54
|
+
else
|
55
|
+
print "\rLaunching #{app.name}."
|
56
|
+
app.launch!
|
57
|
+
end
|
58
|
+
end
|
60
59
|
end
|
61
60
|
end
|
data/readme.md
CHANGED
@@ -14,6 +14,19 @@ for interacting.
|
|
14
14
|
|
15
15
|
## Usage
|
16
16
|
|
17
|
+
Use the included bin script to get started.
|
18
|
+
|
19
|
+
```bash
|
20
|
+
$ roku
|
21
|
+
```
|
22
|
+
|
23
|
+
It will find your device and tell you when you're ready to interact.
|
24
|
+
|
25
|
+
### Programatic Usage
|
26
|
+
|
27
|
+
If you don't want to use the included remote program, you can use the source
|
28
|
+
library instead.
|
29
|
+
|
17
30
|
Find your Roku device and automatically configure the client to use it.
|
18
31
|
|
19
32
|
```ruby
|
data/roku-ecp.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roku-ecp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Evan Shreve
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -32,6 +32,7 @@ executables:
|
|
32
32
|
extensions: []
|
33
33
|
extra_rdoc_files: []
|
34
34
|
files:
|
35
|
+
- ".gitignore"
|
35
36
|
- Gemfile
|
36
37
|
- Gemfile.lock
|
37
38
|
- bin/console
|