aws-transcoder-rails 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/MIT-LICENSE +20 -0
- data/README.md +31 -0
- data/Rakefile +29 -0
- data/lib/aws-transcoder-rails.rb +45 -0
- data/lib/aws-transcoder-rails/config.rb +25 -0
- data/lib/aws-transcoder-rails/preset.rb +31 -0
- data/lib/aws-transcoder-rails/version.rb +5 -0
- data/lib/tasks/transcoder_tasks.rake +5 -0
- metadata +106 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 87787c5f10d1f64729e76359068450922e30782e
|
4
|
+
data.tar.gz: cb274e13f7902eb25ab56e6e64894e24089c58de
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e5958a0343ec63756210914e7a1a0bbe14fcb547538f63dbd15e62895523848aa99e903edd07a791601f1e29b2d396c1af92dc30c0cfab3199b7be7bbee87636
|
7
|
+
data.tar.gz: 3b8831563763dd0073a913962aacf80d6e08fd6ca022db277802cdf0d933f6b6713691cffa33bc68ab959cca7fc0c706eaf68ca852c0f8e1f4e86976f038728e
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2017 penguinwokrs
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# This repository is a project under construction.
|
2
|
+
|
3
|
+
|
4
|
+
# Transcoder
|
5
|
+
Short description and motivation.
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
How to use my plugin.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'transcoder'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
```bash
|
19
|
+
$ bundle
|
20
|
+
```
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
```bash
|
24
|
+
$ gem install transcoder
|
25
|
+
```
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
Contribution directions go here.
|
29
|
+
|
30
|
+
## License
|
31
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'bundler/setup'
|
5
|
+
rescue LoadError
|
6
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'rdoc/task'
|
10
|
+
|
11
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
12
|
+
rdoc.rdoc_dir = 'rdoc'
|
13
|
+
rdoc.title = 'Transcoder'
|
14
|
+
rdoc.options << '--line-numbers'
|
15
|
+
rdoc.rdoc_files.include('README.md')
|
16
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'bundler/gem_tasks'
|
20
|
+
|
21
|
+
require 'rake/testtask'
|
22
|
+
|
23
|
+
Rake::TestTask.new(:test) do |t|
|
24
|
+
t.libs << 'test'
|
25
|
+
t.pattern = 'test/**/*_test.rb'
|
26
|
+
t.verbose = false
|
27
|
+
end
|
28
|
+
|
29
|
+
task default: :test
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'aws_transcoder_rails/config'
|
4
|
+
require 'aws_transcoder_rails/preset'
|
5
|
+
require 'aws-sdk-elastictranscoder'
|
6
|
+
|
7
|
+
module AwsTrancecoderRails
|
8
|
+
class << self
|
9
|
+
attr_writer :outputs
|
10
|
+
|
11
|
+
def create_preset(input_key)
|
12
|
+
use_preset.map do |input_preset|
|
13
|
+
preset = const_get(input_preset)
|
14
|
+
preset.merge(key: "#{preset[:key]}#{output_key(input_key)}", segment_duration: segment_duration)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_playlist(input_key)
|
19
|
+
{
|
20
|
+
name: 'hls_' + output_key(input_key),
|
21
|
+
format: 'HLSv3',
|
22
|
+
output_keys: create_preset(input_key).map { |output| output[:key] }
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_job(input_key)
|
27
|
+
transcoder_client = Aws::ElasticTranscoder::Client.new(
|
28
|
+
region: region,
|
29
|
+
access_key_id: access_key,
|
30
|
+
secret_access_key: secret_key
|
31
|
+
)
|
32
|
+
|
33
|
+
input = { key: input_key }
|
34
|
+
|
35
|
+
transcoder_client.create_job(
|
36
|
+
pipeline_id: pipeline_id,
|
37
|
+
input: input,
|
38
|
+
output_key_prefix: output_key_prefix + output_key(input_key) + '/',
|
39
|
+
outputs: create_preset(input_key),
|
40
|
+
playlists: [create_playlist(input_key)]
|
41
|
+
)[:job]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
self.outputs = []
|
45
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# FIXME: 警告が発生 => warning: already initialized constant Digest::REQUIRE_MUTEX
|
4
|
+
# FIXME: requireすることで発生している。
|
5
|
+
require 'Digest'
|
6
|
+
|
7
|
+
module AwsTranscoderRails
|
8
|
+
class << self
|
9
|
+
attr_accessor :region,
|
10
|
+
:segment_duration,
|
11
|
+
:pipeline_id,
|
12
|
+
:access_key,
|
13
|
+
:secret_key,
|
14
|
+
:output_key_prefix,
|
15
|
+
:use_preset
|
16
|
+
|
17
|
+
def output_key(input_key)
|
18
|
+
Digest::SHA256.hexdigest(input_key.encode('UTF-8'))
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
self.region = 'us-east-1'
|
23
|
+
self.segment_duration = 10
|
24
|
+
self.pipeline_id = '1512644951004-mem7t0'
|
25
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AwsTrancecoderRails
|
4
|
+
HLS_AUDIO_64K = {
|
5
|
+
preset_id: '1351620000001-200071',
|
6
|
+
key: 'hls_audio_64k/'
|
7
|
+
}.freeze
|
8
|
+
HLS_400K = {
|
9
|
+
preset_id: '1351620000001-200050',
|
10
|
+
key: 'hls_400k/'
|
11
|
+
}.freeze
|
12
|
+
HLS_600K = {
|
13
|
+
preset_id: '1351620000001-200040',
|
14
|
+
key: 'hls_600k/'
|
15
|
+
}.freeze
|
16
|
+
HLS_1000K = {
|
17
|
+
preset_id: '1351620000001-200030',
|
18
|
+
key: 'hls_1000k/'
|
19
|
+
}.freeze
|
20
|
+
HLS_1500K = {
|
21
|
+
preset_id: '1351620000001-200020',
|
22
|
+
key: 'hls_1000k/'
|
23
|
+
}.freeze
|
24
|
+
|
25
|
+
# HLS_2000K = '1351620000001-200010'
|
26
|
+
# MPEG_DASH_128K_AUDIO = '1351620000001-500060'
|
27
|
+
# MPEG_DASH_600K = '1351620000001-500050'
|
28
|
+
# MPEG_DASH_1200K = '1351620000001-500040'
|
29
|
+
# MPEG_DASH_2400K = '1351620000001-500030'
|
30
|
+
# MPEG_DASH_4800K = '1351620000001-500020'
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aws-transcoder-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- penguinwokrs
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-06-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.1'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 5.1.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '5.1'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 5.1.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: aws-sdk-elastictranscoder
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - '='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 1.0.0
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - '='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.0.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: minitest
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '5.11'
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 5.11.0
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '5.11'
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 5.11.0
|
67
|
+
description: AWS Elastic Transcoder Rails Library
|
68
|
+
email:
|
69
|
+
- dev.and.penguin@gmail.com
|
70
|
+
executables: []
|
71
|
+
extensions: []
|
72
|
+
extra_rdoc_files: []
|
73
|
+
files:
|
74
|
+
- MIT-LICENSE
|
75
|
+
- README.md
|
76
|
+
- Rakefile
|
77
|
+
- lib/aws-transcoder-rails.rb
|
78
|
+
- lib/aws-transcoder-rails/config.rb
|
79
|
+
- lib/aws-transcoder-rails/preset.rb
|
80
|
+
- lib/aws-transcoder-rails/version.rb
|
81
|
+
- lib/tasks/transcoder_tasks.rake
|
82
|
+
homepage: https://github.com/penguinwokrs
|
83
|
+
licenses:
|
84
|
+
- MIT
|
85
|
+
metadata: {}
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
requirements: []
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 2.6.14.1
|
103
|
+
signing_key:
|
104
|
+
specification_version: 4
|
105
|
+
summary: AWS Elastic Transcoder Rails Library
|
106
|
+
test_files: []
|