woody-decorators 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/woody/decorators.rb +1 -1
- data/lib/woody/decorators/video_transcoding_state.rb +49 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 627b8c37e6d7b5cceb180ea1a0fab50ba2c639f8
|
4
|
+
data.tar.gz: 1aeebb11bf40e6bdc9184508a329aca83ea22825
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ab23e6acfdf8391307dc79851d221aa1120ee487521a84410a13d98a5ae5b0fbb397ac6628b0736abf07fe884ac781580afd4a7da7808aec3a668efcee34265
|
7
|
+
data.tar.gz: 6dc9d86063afaac44ea8780259496c812b1cdfb5b27448a96aee64496df0f020cf1ab23fa99e4b26eb97b5ce1aac87b80a744c6656d13e2123398d7ae7519458
|
data/lib/woody/decorators.rb
CHANGED
@@ -0,0 +1,49 @@
|
|
1
|
+
require "woody/decorators/base"
|
2
|
+
|
3
|
+
module Woody
|
4
|
+
module Decorators
|
5
|
+
class VideoTranscodingState < Base
|
6
|
+
def initialize(model, config)
|
7
|
+
@config = config
|
8
|
+
super(model)
|
9
|
+
end
|
10
|
+
|
11
|
+
def complete?
|
12
|
+
@model.state == "complete"
|
13
|
+
end
|
14
|
+
|
15
|
+
def path(filename, render_type = nil, default = "")
|
16
|
+
type = render_type ? render_type : attributes.type
|
17
|
+
suffix = format_suffix(type)
|
18
|
+
complete? ? [s3_base, filename, suffix].join("/") : default
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def aws_config
|
24
|
+
@aws_config ||= @config.aws
|
25
|
+
end
|
26
|
+
|
27
|
+
def etc_config
|
28
|
+
@etc_config ||= @config.elastic_transcoder
|
29
|
+
end
|
30
|
+
|
31
|
+
def format_suffix(type)
|
32
|
+
case type
|
33
|
+
when "gif", "mp4"
|
34
|
+
"#{etc_config['output_suffix']}.#{type}"
|
35
|
+
when "thumbnail"
|
36
|
+
"#{etc_config['output_suffix']}_00001.png"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def s3_base
|
41
|
+
[
|
42
|
+
aws_config["base_s3_path"],
|
43
|
+
aws_config["s3_bucket"],
|
44
|
+
etc_config["base_prefix"]
|
45
|
+
].join("/")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: woody-decorators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- lib/woody/decorators/brand.rb
|
122
122
|
- lib/woody/decorators/challenge.rb
|
123
123
|
- lib/woody/decorators/creator_user.rb
|
124
|
+
- lib/woody/decorators/video_transcoding_state.rb
|
124
125
|
- woody-decorators.gemspec
|
125
126
|
homepage: ''
|
126
127
|
licenses: []
|