alexa_transmission 1.0.1 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/alexa_transmission.gemspec +2 -2
- data/lib/alexa_transmission.rb +13 -42
- data/lib/alexa_transmission/custom_slots.rb +5 -0
- data/lib/alexa_transmission/intent_schema.rb +4 -6
- data/lib/alexa_transmission/sample_utterances.rb +4 -6
- data/lib/alexa_transmission/version.rb +2 -2
- metadata +4 -5
- data/lib/alexa_transmission/custom_schema.rb +0 -7
- data/lib/alexa_transmission/endpoint.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82680284e5a7e45464f7d22d9a21d215a948570d
|
4
|
+
data.tar.gz: 73aa685a0b858726958d07d6c483d236223f16eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13b0870f7741d53000d5e610b68dd18c4e251a5f6a2e9a8182b552d46a326d0da348eb4f6c5e0be395386752fae295dd8db11a80818f16d594e1321bc69cd789
|
7
|
+
data.tar.gz: 663bb70023e781f394031e6c36a93aafec452200ad6b3dd19c9320fc3dd9ea9d737013fecbea681cd87379025e77e2cf5abc38cb332ad5a5b547949e2cf5f5b1
|
data/alexa_transmission.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'alexa_transmission/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "alexa_transmission"
|
8
|
-
spec.version =
|
8
|
+
spec.version = Transmission::VERSION
|
9
9
|
spec.authors = ["kylegrantlucas"]
|
10
10
|
spec.email = ["kglucas93@gmail.com"]
|
11
11
|
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_runtime_dependency 'toname'
|
24
24
|
spec.add_runtime_dependency 'transmission_api'
|
25
25
|
spec.add_runtime_dependency 'activesupport'
|
26
|
-
spec.add_runtime_dependency 'sinatra'
|
26
|
+
spec.add_runtime_dependency 'sinatra-contrib'
|
27
27
|
|
28
28
|
spec.add_development_dependency "bundler", "~> 1.11"
|
29
29
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/lib/alexa_transmission.rb
CHANGED
@@ -1,52 +1,23 @@
|
|
1
|
-
Bundler.require
|
2
1
|
require "alexa_transmission/version"
|
3
2
|
require 'transmission_api'
|
4
|
-
require 'sinatra/base'
|
5
3
|
require 'to_name'
|
6
4
|
require 'active_support/core_ext/array'
|
5
|
+
require 'sinatra/extension'
|
7
6
|
|
8
|
-
module
|
9
|
-
|
10
|
-
def self.registered(app)
|
11
|
-
app.post '/alexa_transmission' do
|
12
|
-
#halt 400, "" unless settings.config.application_id && @application_id == settings.config.application_id
|
7
|
+
module Transmission
|
8
|
+
extend Sinatra::Extension
|
13
9
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
transmission_api_client = ::TransmissionApi::Client.new(
|
22
|
-
:username => settings.config.transmission.username,
|
23
|
-
:password => settings.config.transmission.password,
|
24
|
-
:url => settings.config.transmission.rpc_url
|
25
|
-
)
|
10
|
+
helpers do
|
11
|
+
def check_transmission
|
12
|
+
transmission_api_client = ::TransmissionApi::Client.new(
|
13
|
+
:username => settings.config.transmission.username,
|
14
|
+
:password => settings.config.transmission.password,
|
15
|
+
:url => settings.config.transmission.rpc_url
|
16
|
+
)
|
26
17
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
response = AlexaObjects::Response.new
|
32
|
-
response.end_session = true
|
33
|
-
response.spoken_response = parsed_strings
|
34
|
-
|
35
|
-
response.without_card.to_json
|
36
|
-
elsif @echo_request.intent_name == "EndSession"
|
37
|
-
puts @echo_request.slots
|
38
|
-
response = AlexaObjects::Response.new
|
39
|
-
response.end_session = true
|
40
|
-
response.spoken_response = "exiting couchpoato"
|
41
|
-
response.without_card.to_json
|
42
|
-
elsif @echo_request.session_ended_request?
|
43
|
-
response = AlexaObjects::Response.new
|
44
|
-
response.end_session = true
|
45
|
-
response.without_card.to_json
|
46
|
-
end
|
47
|
-
end
|
18
|
+
parsed_files = transmission_api_client.all.map{|x| {percent_completed: x["percentDone"], name: ToName.to_name(x["name"].gsub(/\+/, '.').gsub(' ', '.'))} if x["percentDone"] != 1}.compact
|
19
|
+
parsed_strings = parsed_files.map {|x| "#{x[:name].name}#{" Episode #{x[:name].episode}" if x[:name].episode} is at #{(x[:percent_completed]*100).round} percent" }.to_sentence
|
20
|
+
AlexaObjects::Response.new(spoken_response: parsed_strings).to_json
|
48
21
|
end
|
49
22
|
end
|
50
|
-
|
51
|
-
register Transmission
|
52
23
|
end
|
@@ -1,7 +1,5 @@
|
|
1
|
-
module
|
2
|
-
|
3
|
-
|
4
|
-
File.read(File.expand_path('../../../skills_config/intent_schema.txt', __FILE__))
|
5
|
-
end
|
1
|
+
module Transmission
|
2
|
+
def self.intent_schema
|
3
|
+
File.read(File.expand_path('../../../skills_config/intent_schema.txt', __FILE__))
|
6
4
|
end
|
7
|
-
end
|
5
|
+
end
|
@@ -1,7 +1,5 @@
|
|
1
|
-
module
|
2
|
-
|
3
|
-
|
4
|
-
File.read(File.expand_path('../../../skills_config/sample_utterances.txt', __FILE__))
|
5
|
-
end
|
1
|
+
module Transmission
|
2
|
+
def self.sample_utterances
|
3
|
+
File.read(File.expand_path('../../../skills_config/sample_utterances.txt', __FILE__))
|
6
4
|
end
|
7
|
-
end
|
5
|
+
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
module
|
2
|
-
VERSION = "1.
|
1
|
+
module Transmission
|
2
|
+
VERSION = "1.1.1"
|
3
3
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alexa_transmission
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kylegrantlucas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: alexa_objects
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: sinatra
|
70
|
+
name: sinatra-contrib
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -141,8 +141,7 @@ files:
|
|
141
141
|
- bin/console
|
142
142
|
- bin/setup
|
143
143
|
- lib/alexa_transmission.rb
|
144
|
-
- lib/alexa_transmission/
|
145
|
-
- lib/alexa_transmission/endpoint.rb
|
144
|
+
- lib/alexa_transmission/custom_slots.rb
|
146
145
|
- lib/alexa_transmission/intent_schema.rb
|
147
146
|
- lib/alexa_transmission/sample_utterances.rb
|
148
147
|
- lib/alexa_transmission/version.rb
|