woody-decorators 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/woody/decorators.rb +1 -1
- data/lib/woody/decorators/video.rb +86 -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: 04f77657db3d47be852273f0369290cc0e607923
|
|
4
|
+
data.tar.gz: e53ba600bbd0950d4ae84a1270e9c1ffba3cb53f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7e4ec5225e7f111a32d8e71d5e51bf6fd1f46f804ca20aa9c171c2fb73b74e7a8c6f8a6add2feb02ff321eedfdd267d009d859f1143b7df70783cb1a7927fe80
|
|
7
|
+
data.tar.gz: f5ed123f7717bc01c7e087303ba2f2e85f662decabd880eff57e949fdad9e26f151944d6962dccf87170d7e0dea5cd4f44ffa3623be88f53ceb44fd2f5a08a8e
|
data/lib/woody/decorators.rb
CHANGED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
require "wes/data/api/brand"
|
|
2
|
+
require "wes/data/api/challenge"
|
|
3
|
+
require "wes/data/api/submission"
|
|
4
|
+
require "woody/decorators/base"
|
|
5
|
+
require "woody/decorators/video_transcoding_state"
|
|
6
|
+
|
|
7
|
+
module Woody
|
|
8
|
+
module Decorators
|
|
9
|
+
class Video < Base
|
|
10
|
+
def initialize(model, config)
|
|
11
|
+
@config = config
|
|
12
|
+
super(model)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def aspect_ratio
|
|
16
|
+
aspect_ratios.sample
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def brand
|
|
20
|
+
@brand ||= Wes::Data::API::Brand.find(:id, challenge.brand_id)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def challenge
|
|
24
|
+
@challenge ||= Wes::Data::API::Challenge.find(
|
|
25
|
+
:id, submission.challenge_id
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def gif
|
|
30
|
+
video_transcoding_state("gif").path(filename_hash)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def thumbnail
|
|
34
|
+
video_transcoding_state("gif").path(
|
|
35
|
+
filename_hash,
|
|
36
|
+
"thumbnail",
|
|
37
|
+
app_config["video_default_thumbnail"]
|
|
38
|
+
)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def processed?
|
|
42
|
+
type_processed?("gif") && type_processed?("mp4")
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def url
|
|
46
|
+
video_transcoding_state("mp4").path(filename_hash)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
def app_config
|
|
52
|
+
@app_config ||= @config.app
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def aspect_ratios
|
|
56
|
+
[
|
|
57
|
+
"square",
|
|
58
|
+
"landscape_ar16-9",
|
|
59
|
+
"landscape_ar4-3",
|
|
60
|
+
"portrait_ar9-16",
|
|
61
|
+
"portrait_ar5-4"
|
|
62
|
+
]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def filename_hash
|
|
66
|
+
@model.file_name.split(".").first
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def submission
|
|
70
|
+
@submission ||= Wes::Data::API::Submission.find(
|
|
71
|
+
:id, @model.submission_id
|
|
72
|
+
)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def type_processed?(type)
|
|
76
|
+
video_transcoding_state(type).complete?
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def video_transcoding_state(type)
|
|
80
|
+
VideoTranscodingState.new(
|
|
81
|
+
@model.transcoding_state(type), @config
|
|
82
|
+
)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
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.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ''
|
|
@@ -136,6 +136,7 @@ files:
|
|
|
136
136
|
- lib/woody/decorators/challenge.rb
|
|
137
137
|
- lib/woody/decorators/creator_user.rb
|
|
138
138
|
- lib/woody/decorators/submission.rb
|
|
139
|
+
- lib/woody/decorators/video.rb
|
|
139
140
|
- lib/woody/decorators/video_transcoding_state.rb
|
|
140
141
|
- woody-decorators.gemspec
|
|
141
142
|
homepage: ''
|