ooyala-cli 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +57 -0
- data/Rakefile +44 -0
- data/bin/ooyala +92 -0
- data/features/ooyala.feature +8 -0
- data/features/step_definitions/ooyala_steps.rb +6 -0
- data/features/support/env.rb +15 -0
- data/lib/ooyala/live_stream.rb +38 -0
- data/lib/ooyala/version.rb +3 -0
- data/lib/ooyala.rb +24 -0
- data/ooyala.gemspec +24 -0
- data/ooyala.rdoc +0 -0
- data/test/default_test.rb +14 -0
- data/test/test_helper.rb +9 -0
- metadata +135 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0eca72d4b46ac60e864a2ff886f2224ca2dd5ee4
|
4
|
+
data.tar.gz: a9bfefb2c626947df6963f2a743ea0611840a81d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 43d051211702046a017b046f54de48b682cf5578088d2ae3e2aa93e12afbc671cae49c393c5ea789133c990f41f5b7ce917033ffca6fc8bfa60fdfa9b8a522cc
|
7
|
+
data.tar.gz: 061a90a33c329388f44698aeaa3b1f538c17e53270fd4e862e6d04a207637f64bd2b97bd0029293a4dd067045297760b8130534d8f09f30c0648221012e2cc1b
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
keys.yml
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ooyala-cli (0.0.1)
|
5
|
+
gli (= 2.11.0)
|
6
|
+
ooyala-v2-api (= 0.0.3)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
aruba (0.6.0)
|
12
|
+
childprocess (>= 0.3.6)
|
13
|
+
cucumber (>= 1.1.1)
|
14
|
+
rspec-expectations (>= 2.7.0)
|
15
|
+
builder (3.2.2)
|
16
|
+
childprocess (0.5.3)
|
17
|
+
ffi (~> 1.0, >= 1.0.11)
|
18
|
+
cucumber (1.3.15)
|
19
|
+
builder (>= 2.1.2)
|
20
|
+
diff-lcs (>= 1.1.3)
|
21
|
+
gherkin (~> 2.12)
|
22
|
+
multi_json (>= 1.7.5, < 2.0)
|
23
|
+
multi_test (>= 0.1.1)
|
24
|
+
diff-lcs (1.2.5)
|
25
|
+
ffi (1.9.3)
|
26
|
+
gherkin (2.12.2)
|
27
|
+
multi_json (~> 1.3)
|
28
|
+
gli (2.11.0)
|
29
|
+
json (1.8.1)
|
30
|
+
mime-types (2.3)
|
31
|
+
multi_json (1.10.1)
|
32
|
+
multi_test (0.1.1)
|
33
|
+
ooyala-v2-api (0.0.3)
|
34
|
+
json
|
35
|
+
json
|
36
|
+
rake
|
37
|
+
rdoc
|
38
|
+
rest-client (~> 1.6.6)
|
39
|
+
rest-client (~> 1.6.6)
|
40
|
+
rake (10.3.2)
|
41
|
+
rdoc (4.1.1)
|
42
|
+
json (~> 1.4)
|
43
|
+
rest-client (1.6.7)
|
44
|
+
mime-types (>= 1.16)
|
45
|
+
rspec-expectations (3.0.2)
|
46
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
+
rspec-support (~> 3.0.0)
|
48
|
+
rspec-support (3.0.2)
|
49
|
+
|
50
|
+
PLATFORMS
|
51
|
+
ruby
|
52
|
+
|
53
|
+
DEPENDENCIES
|
54
|
+
aruba
|
55
|
+
ooyala-cli!
|
56
|
+
rake
|
57
|
+
rdoc
|
data/Rakefile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rake/clean'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rubygems/package_task'
|
4
|
+
require 'rdoc/task'
|
5
|
+
require 'cucumber'
|
6
|
+
require 'cucumber/rake/task'
|
7
|
+
Rake::RDocTask.new do |rd|
|
8
|
+
rd.main = "README.rdoc"
|
9
|
+
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
|
10
|
+
rd.title = 'Your application title'
|
11
|
+
end
|
12
|
+
|
13
|
+
spec = eval(File.read('ooyala.gemspec'))
|
14
|
+
|
15
|
+
Gem::PackageTask.new(spec) do |pkg|
|
16
|
+
end
|
17
|
+
CUKE_RESULTS = 'results.html'
|
18
|
+
CLEAN << CUKE_RESULTS
|
19
|
+
desc 'Run features'
|
20
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
21
|
+
opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
|
22
|
+
opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
|
23
|
+
t.cucumber_opts = opts
|
24
|
+
t.fork = false
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'Run features tagged as work-in-progress (@wip)'
|
28
|
+
Cucumber::Rake::Task.new('features:wip') do |t|
|
29
|
+
tag_opts = ' --tags ~@pending'
|
30
|
+
tag_opts = ' --tags @wip'
|
31
|
+
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
|
32
|
+
t.fork = false
|
33
|
+
end
|
34
|
+
|
35
|
+
task :cucumber => :features
|
36
|
+
task 'cucumber:wip' => 'features:wip'
|
37
|
+
task :wip => 'features:wip'
|
38
|
+
require 'rake/testtask'
|
39
|
+
Rake::TestTask.new do |t|
|
40
|
+
t.libs << "test"
|
41
|
+
t.test_files = FileList['test/*_test.rb']
|
42
|
+
end
|
43
|
+
|
44
|
+
task :default => [:test,:features]
|
data/bin/ooyala
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'gli'
|
3
|
+
begin # XXX: Remove this begin/rescue before distributing your app
|
4
|
+
require 'ooyala'
|
5
|
+
require 'pp'
|
6
|
+
require 'yaml'
|
7
|
+
|
8
|
+
rescue LoadError
|
9
|
+
STDERR.puts "In development, you need to use `bundle exec bin/ooyala` to run your app"
|
10
|
+
STDERR.puts "At install-time, RubyGems will make sure lib, etc. are in the load path"
|
11
|
+
STDERR.puts "Feel free to remove this message from bin/ooyala now"
|
12
|
+
exit 64
|
13
|
+
end
|
14
|
+
|
15
|
+
include GLI::App
|
16
|
+
|
17
|
+
program_desc 'Connect to the Ooyala API with simple commands'
|
18
|
+
|
19
|
+
version Ooyala::VERSION
|
20
|
+
|
21
|
+
desc 'Ooyala API Key'
|
22
|
+
arg_name 'api_key'
|
23
|
+
flag [:k,:key], default_value: Ooyala::Config.fetch('key')
|
24
|
+
|
25
|
+
desc 'Ooyala API Secret'
|
26
|
+
arg_name 'api_secret'
|
27
|
+
flag [:s,:secret], default_value: Ooyala::Config.fetch('secret')
|
28
|
+
|
29
|
+
pre do |global,command,options,args|
|
30
|
+
|
31
|
+
Ooyala::Config.set('key', global[:key])
|
32
|
+
Ooyala::Config.set('secret', global[:key])
|
33
|
+
|
34
|
+
$ooyala = Ooyala::API.new(global[:key], global[:secret])
|
35
|
+
end
|
36
|
+
|
37
|
+
desc 'Add a live stream'
|
38
|
+
command :live do |c|
|
39
|
+
|
40
|
+
c.desc 'Add encodings to the stream'
|
41
|
+
c.flag [:e, :encodings], default_value: Ooyala::Config.fetch('encodings')
|
42
|
+
|
43
|
+
c.desc 'Set the name of the stream (will be shown in the player)'
|
44
|
+
c.flag [:n, :name], default_value: Ooyala::Config.fetch('stream')
|
45
|
+
|
46
|
+
c.desc 'Set the password for the stream (set this on the encoder as well)'
|
47
|
+
c.flag [:p, :password], default_value: Ooyala::Config.fetch('streampw')
|
48
|
+
|
49
|
+
c.action do |global_options, options, args|
|
50
|
+
puts "---Provisioning your stream----"
|
51
|
+
stream = Ooyala::LiveStream.new($ooyala, {name: options[:name], password: options[:password]})
|
52
|
+
stream.encodings = options[:encodings]
|
53
|
+
PP.pp stream.publish
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
desc 'Store a configuration setting to be used next time.
|
58
|
+
|
59
|
+
Options are:
|
60
|
+
|
61
|
+
key
|
62
|
+
secret
|
63
|
+
encodings
|
64
|
+
stream
|
65
|
+
streampw
|
66
|
+
'
|
67
|
+
command :config do |c|
|
68
|
+
|
69
|
+
c.desc 'Config Name'
|
70
|
+
c.flag [:n, :name]
|
71
|
+
c.flag [:v, :value]
|
72
|
+
|
73
|
+
c.action do |global_options, options, args|
|
74
|
+
Ooyala::Config.set(options[:name], options[:value])
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
post do |global,command,options,args|
|
79
|
+
# Post logic here
|
80
|
+
# Use skips_post before a command to skip this
|
81
|
+
# block on that command only
|
82
|
+
end
|
83
|
+
|
84
|
+
on_error do |exception|
|
85
|
+
# Error logic here
|
86
|
+
# return false to skip default error handling
|
87
|
+
puts exception
|
88
|
+
PP.pp exception.backtrace
|
89
|
+
true
|
90
|
+
end
|
91
|
+
|
92
|
+
exit run(ARGV)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'aruba/cucumber'
|
2
|
+
|
3
|
+
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
4
|
+
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
|
5
|
+
|
6
|
+
Before do
|
7
|
+
# Using "announce" causes massive warnings on 1.9.2
|
8
|
+
@puts = true
|
9
|
+
@original_rubylib = ENV['RUBYLIB']
|
10
|
+
ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
|
11
|
+
end
|
12
|
+
|
13
|
+
After do
|
14
|
+
ENV['RUBYLIB'] = @original_rubylib
|
15
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'socket'
|
2
|
+
|
3
|
+
module Ooyala
|
4
|
+
|
5
|
+
class LiveStream
|
6
|
+
|
7
|
+
attr_reader :result
|
8
|
+
|
9
|
+
def initialize(api, options = {})
|
10
|
+
@api = api
|
11
|
+
@options = options.merge({
|
12
|
+
asset_type: "live_stream",
|
13
|
+
is_flash: true,
|
14
|
+
is_ios: true,
|
15
|
+
primary_encoder_ip: UDPSocket.open {|s| s.connect("64.233.187.99", 1); s.addr.last}
|
16
|
+
})
|
17
|
+
end
|
18
|
+
|
19
|
+
# Transforms encodings as a string (1280:720:800;1280:720:1500;1280:720:2500;)
|
20
|
+
# to their final required format-
|
21
|
+
# [
|
22
|
+
# { "width": 800, "height": 600, "bitrate": 600 },
|
23
|
+
# { "width": 800, "height": 600, "bitrate": 300 },
|
24
|
+
# { "width": 400, "height": 300, "bitrate": 200 }
|
25
|
+
# ] - See more at: http://support.ooyala.com/developers/documentation/api/asset_livestream.html#sthash.7v0KBwAI.dpuf
|
26
|
+
def encodings=(enc)
|
27
|
+
formatted = enc.split(";").map {|i| i.split(":") }.map { |item| { width: item.shift, height: item.shift, bitrate: item.shift } }
|
28
|
+
@options[:encodings] = formatted
|
29
|
+
end
|
30
|
+
|
31
|
+
def publish
|
32
|
+
@result = @api.post('assets', @options)
|
33
|
+
@result
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
data/lib/ooyala.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'ooyala/version.rb'
|
2
|
+
require 'ooyala-v2-api'
|
3
|
+
require 'ooyala/live_stream.rb'
|
4
|
+
|
5
|
+
module Ooyala
|
6
|
+
|
7
|
+
class Config
|
8
|
+
|
9
|
+
@@file = File.join(File.dirname(File.expand_path(File.dirname(__FILE__))), 'keys.yml')
|
10
|
+
|
11
|
+
def self.fetch(name)
|
12
|
+
@config ||= YAML.load_file(@@file)
|
13
|
+
@config[name] if @config
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.set(name, val)
|
17
|
+
data = YAML.load_file(@@file) || Hash.new
|
18
|
+
data[name] = val
|
19
|
+
File.open(@@file, "w") { |f| YAML.dump(data, f) }
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/ooyala.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Ensure we require the local version and not one we might have installed already
|
2
|
+
require File.join([File.dirname(__FILE__),'lib','ooyala','version.rb'])
|
3
|
+
spec = Gem::Specification.new do |s|
|
4
|
+
s.name = 'ooyala-cli'
|
5
|
+
s.version = Ooyala::VERSION
|
6
|
+
s.author = 'Brandon Hansen'
|
7
|
+
s.email = 'bh@jesusculture.com'
|
8
|
+
s.homepage = 'http://resume.aisforarray.com'
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.summary = 'Interact with the ooyala API via the command line. A work in progress.'
|
11
|
+
s.files = `git ls-files`.split("
|
12
|
+
")
|
13
|
+
s.require_paths << 'lib'
|
14
|
+
s.has_rdoc = true
|
15
|
+
s.extra_rdoc_files = ['ooyala.rdoc']
|
16
|
+
s.rdoc_options << '--title' << 'ooyala' << '--main' << 'README.rdoc' << '-ri'
|
17
|
+
s.bindir = 'bin'
|
18
|
+
s.executables << 'ooyala'
|
19
|
+
s.add_development_dependency('rake')
|
20
|
+
s.add_development_dependency('rdoc')
|
21
|
+
s.add_development_dependency('aruba')
|
22
|
+
s.add_runtime_dependency('gli','2.11.0')
|
23
|
+
s.add_runtime_dependency('ooyala-v2-api', '0.0.3')
|
24
|
+
end
|
data/ooyala.rdoc
ADDED
File without changes
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ooyala-cli
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brandon Hansen
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rdoc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: aruba
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: gli
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.11.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.11.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: ooyala-v2-api
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.0.3
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.0.3
|
83
|
+
description:
|
84
|
+
email: bh@jesusculture.com
|
85
|
+
executables:
|
86
|
+
- ooyala
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files:
|
89
|
+
- ooyala.rdoc
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- Gemfile
|
93
|
+
- Gemfile.lock
|
94
|
+
- Rakefile
|
95
|
+
- bin/ooyala
|
96
|
+
- features/ooyala.feature
|
97
|
+
- features/step_definitions/ooyala_steps.rb
|
98
|
+
- features/support/env.rb
|
99
|
+
- lib/ooyala.rb
|
100
|
+
- lib/ooyala/live_stream.rb
|
101
|
+
- lib/ooyala/version.rb
|
102
|
+
- ooyala.gemspec
|
103
|
+
- ooyala.rdoc
|
104
|
+
- test/default_test.rb
|
105
|
+
- test/test_helper.rb
|
106
|
+
homepage: http://resume.aisforarray.com
|
107
|
+
licenses: []
|
108
|
+
metadata: {}
|
109
|
+
post_install_message:
|
110
|
+
rdoc_options:
|
111
|
+
- "--title"
|
112
|
+
- ooyala
|
113
|
+
- "--main"
|
114
|
+
- README.rdoc
|
115
|
+
- "-ri"
|
116
|
+
require_paths:
|
117
|
+
- lib
|
118
|
+
- lib
|
119
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
requirements: []
|
130
|
+
rubyforge_project:
|
131
|
+
rubygems_version: 2.2.2
|
132
|
+
signing_key:
|
133
|
+
specification_version: 4
|
134
|
+
summary: Interact with the ooyala API via the command line. A work in progress.
|
135
|
+
test_files: []
|