active_encode 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +1 -0
- data/Gemfile +2 -1
- data/README.md +69 -0
- data/active_encode.gemspec +5 -2
- data/lib/active_encode/engine_adapters.rb +1 -0
- data/lib/active_encode/engine_adapters/elastic_transcoder_adapter.rb +1 -1
- data/lib/active_encode/engine_adapters/ffmpeg_adapter.rb +12 -2
- data/lib/active_encode/engine_adapters/media_convert_adapter.rb +372 -0
- data/lib/active_encode/engine_adapters/media_convert_output.rb +104 -0
- data/lib/active_encode/polling.rb +1 -1
- data/lib/active_encode/spec/shared_specs.rb +2 -0
- data/{spec/shared_specs/engine_adapter_specs.rb → lib/active_encode/spec/shared_specs/engine_adapter.rb} +36 -36
- data/lib/active_encode/version.rb +1 -1
- data/lib/file_locator.rb +1 -1
- data/spec/fixtures/media_convert/endpoints.json +1 -0
- data/spec/fixtures/media_convert/job_canceled.json +412 -0
- data/spec/fixtures/media_convert/job_canceling.json +1 -0
- data/spec/fixtures/media_convert/job_completed.json +359 -0
- data/spec/fixtures/media_convert/job_completed_detail.json +1 -0
- data/spec/fixtures/media_convert/job_completed_detail_query.json +1 -0
- data/spec/fixtures/media_convert/job_created.json +408 -0
- data/spec/fixtures/media_convert/job_failed.json +406 -0
- data/spec/fixtures/media_convert/job_progressing.json +414 -0
- data/spec/integration/elastic_transcoder_adapter_spec.rb +4 -4
- data/spec/integration/ffmpeg_adapter_spec.rb +2 -2
- data/spec/integration/matterhorn_adapter_spec.rb +39 -39
- data/spec/integration/media_convert_adapter_spec.rb +126 -0
- data/spec/integration/pass_through_adapter_spec.rb +2 -2
- data/spec/integration/zencoder_adapter_spec.rb +198 -198
- data/spec/spec_helper.rb +0 -1
- data/spec/units/core_spec.rb +17 -17
- data/spec/units/file_locator_spec.rb +1 -1
- data/spec/units/global_id_spec.rb +8 -8
- data/spec/units/persistence_spec.rb +9 -9
- metadata +87 -23
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'spec_helper'
|
3
|
-
require 'aws-sdk'
|
3
|
+
require 'aws-sdk-elastictranscoder'
|
4
4
|
require 'json'
|
5
|
-
require 'shared_specs
|
5
|
+
require 'active_encode/spec/shared_specs'
|
6
6
|
|
7
7
|
describe ActiveEncode::EngineAdapters::ElasticTranscoderAdapter do
|
8
8
|
around do |example|
|
@@ -106,7 +106,7 @@ describe ActiveEncode::EngineAdapters::ElasticTranscoderAdapter do
|
|
106
106
|
let(:create_output) { [{ id: "2", url: "s3://BucketName/elastic-transcoder-samples/output/hls/hls0400k/e8fe80f5b7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a", label: "hls0400k" }] }
|
107
107
|
|
108
108
|
it { is_expected.to be_running }
|
109
|
-
|
109
|
+
it { expect(subject.current_operations).to be_empty }
|
110
110
|
|
111
111
|
it 'output has technical metadata' do
|
112
112
|
subject.output.each do |output|
|
@@ -122,7 +122,7 @@ describe ActiveEncode::EngineAdapters::ElasticTranscoderAdapter do
|
|
122
122
|
let(:running_output) { [{ id: "2", url: "s3://BucketName/elastic-transcoder-samples/output/hls/hls0400k/e8fe80f5b7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a", label: "hls0400k" }] }
|
123
123
|
let(:running_tech_metadata) { { width: 1280, height: 720, frame_rate: 25, file_size: 21_069_678, duration: 117_312 } }
|
124
124
|
|
125
|
-
|
125
|
+
it { expect(subject.current_operations).to be_empty }
|
126
126
|
|
127
127
|
it 'input has technical metadata' do
|
128
128
|
expect(subject.input.as_json.symbolize_keys).to include running_tech_metadata
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'rails_helper'
|
3
|
-
require 'shared_specs
|
3
|
+
require 'active_encode/spec/shared_specs'
|
4
4
|
|
5
5
|
describe ActiveEncode::EngineAdapters::FfmpegAdapter do
|
6
6
|
around do |example|
|
@@ -154,7 +154,7 @@ describe ActiveEncode::EngineAdapters::FfmpegAdapter do
|
|
154
154
|
end
|
155
155
|
|
156
156
|
it { is_expected.to be_failed }
|
157
|
-
|
157
|
+
it { expect(subject.errors).to be_present }
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'spec_helper'
|
3
3
|
require 'rubyhorn'
|
4
|
-
require 'shared_specs
|
4
|
+
require 'active_encode/spec/shared_specs'
|
5
5
|
|
6
6
|
describe ActiveEncode::EngineAdapters::MatterhornAdapter do
|
7
7
|
before(:all) do
|
@@ -42,53 +42,53 @@ describe ActiveEncode::EngineAdapters::MatterhornAdapter do
|
|
42
42
|
describe "#create" do
|
43
43
|
subject { created_job }
|
44
44
|
|
45
|
-
|
46
|
-
|
45
|
+
it { expect(subject.output).to be_empty }
|
46
|
+
it { expect(subject.options).to include(preset: 'full') }
|
47
47
|
end
|
48
48
|
|
49
49
|
describe "#find" do
|
50
50
|
context "a running encode" do
|
51
51
|
subject { running_job }
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
53
|
+
it { expect(subject.options).to include(preset: 'full') }
|
54
|
+
it { expect(subject.output).to be_empty }
|
55
|
+
it { expect(subject.current_operations).to include("Hold for workflow selection") }
|
56
56
|
|
57
57
|
context 'input' do
|
58
58
|
subject { running_job.input }
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
60
|
+
it { expect(subject.width).to be_blank }
|
61
|
+
it { expect(subject.height).to be_blank }
|
62
|
+
it { expect(subject.frame_rate).to be_blank }
|
63
|
+
it { expect(subject.duration).to be_blank }
|
64
|
+
it { expect(subject.file_size).to be_blank }
|
65
|
+
it { expect(subject.checksum).to be_blank }
|
66
|
+
it { expect(subject.audio_codec).to be_blank }
|
67
|
+
it { expect(subject.video_codec).to be_blank }
|
68
|
+
it { expect(subject.audio_bitrate).to be_blank }
|
69
|
+
it { expect(subject.video_bitrate).to be_blank }
|
70
70
|
end
|
71
71
|
end
|
72
72
|
context "a cancelled encode" do
|
73
73
|
subject { canceled_job }
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
75
|
+
it { expect(subject.options).to include(preset: 'full') }
|
76
|
+
it { expect(subject.current_operations).not_to be_empty }
|
77
|
+
it { expect(subject.current_operations).to include("Tagging dublin core catalogs for publishing") }
|
78
|
+
it { expect(subject.updated_at).to be > subject.created_at }
|
79
79
|
end
|
80
80
|
|
81
81
|
context "a completed encode" do
|
82
82
|
subject { completed_job }
|
83
83
|
|
84
|
-
|
85
|
-
|
84
|
+
it { expect(subject.options).to include(preset: 'avalon') }
|
85
|
+
it { expect(subject.current_operations).to include("Cleaning up") }
|
86
86
|
end
|
87
87
|
context "a failed encode" do
|
88
88
|
subject { failed_job }
|
89
89
|
|
90
|
-
|
91
|
-
|
90
|
+
it { expect(subject.options).to include(preset: 'error') }
|
91
|
+
it { expect(subject.current_operations).to include("Cleaning up after failure") }
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
@@ -97,7 +97,7 @@ describe ActiveEncode::EngineAdapters::MatterhornAdapter do
|
|
97
97
|
let(:encode) { ActiveEncode::Base.create(file) }
|
98
98
|
|
99
99
|
it { is_expected.to be_a ActiveEncode::Base }
|
100
|
-
|
100
|
+
it { expect(subject.id).to eq 'cancelled-id' }
|
101
101
|
it { is_expected.to be_cancelled }
|
102
102
|
end
|
103
103
|
|
@@ -108,24 +108,24 @@ describe ActiveEncode::EngineAdapters::MatterhornAdapter do
|
|
108
108
|
|
109
109
|
subject { running_job.reload }
|
110
110
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
111
|
+
it { expect(subject.output).to be_empty }
|
112
|
+
it { expect(subject.options).to include(preset: 'full') }
|
113
|
+
it { expect(subject.current_operations).to include("Hold for workflow selection") }
|
114
|
+
it { expect(subject.percent_complete).to eq 0.43478260869565216 }
|
115
115
|
|
116
116
|
context 'input' do
|
117
117
|
subject { running_job.reload.input }
|
118
118
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
119
|
+
it { expect(subject.width).to be_blank }
|
120
|
+
it { expect(subject.height).to be_blank }
|
121
|
+
it { expect(subject.frame_rate).to be_blank }
|
122
|
+
it { expect(subject.duration).to be_blank }
|
123
|
+
it { expect(subject.file_size).to be_blank }
|
124
|
+
it { expect(subject.checksum).to be_blank }
|
125
|
+
it { expect(subject.audio_codec).to be_blank }
|
126
|
+
it { expect(subject.video_codec).to be_blank }
|
127
|
+
it { expect(subject.audio_bitrate).to be_blank }
|
128
|
+
it { expect(subject.video_bitrate).to be_blank }
|
129
129
|
end
|
130
130
|
end
|
131
131
|
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'aws-sdk-cloudwatchevents'
|
4
|
+
require 'aws-sdk-cloudwatchlogs'
|
5
|
+
require 'aws-sdk-mediaconvert'
|
6
|
+
require 'aws-sdk-s3'
|
7
|
+
require 'json'
|
8
|
+
require 'active_encode/spec/shared_specs'
|
9
|
+
require 'active_support/json'
|
10
|
+
require 'active_support/time'
|
11
|
+
|
12
|
+
def with_json_parsing
|
13
|
+
old_settings = { parse_json_times: ActiveSupport.parse_json_times, time_zone: Time.zone }
|
14
|
+
ActiveSupport.parse_json_times = true
|
15
|
+
Time.zone = 'America/Chicago'
|
16
|
+
yield
|
17
|
+
ensure
|
18
|
+
ActiveSupport.parse_json_times = old_settings[:parse_json_times]
|
19
|
+
Time.zone = old_settings[:time_zone]
|
20
|
+
end
|
21
|
+
|
22
|
+
def reconstitute_response(fixture_path)
|
23
|
+
with_json_parsing do
|
24
|
+
HashWithIndifferentAccess.new(ActiveSupport::JSON.decode(File.read(File.join("spec/fixtures", fixture_path))))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe ActiveEncode::EngineAdapters::MediaConvertAdapter do
|
29
|
+
around do |example|
|
30
|
+
# Setting this before each test works around a stubbing + memoization limitation
|
31
|
+
ActiveEncode::Base.engine_adapter = :media_convert
|
32
|
+
ActiveEncode::Base.engine_adapter.role = 'arn:aws:iam::123456789012:role/service-role/MediaConvert_Default_Role'
|
33
|
+
ActiveEncode::Base.engine_adapter.output_bucket = 'output-bucket'
|
34
|
+
example.run
|
35
|
+
ActiveEncode::Base.engine_adapter = :test
|
36
|
+
end
|
37
|
+
|
38
|
+
let(:job_id) { "1625859001514-vvqfwj" }
|
39
|
+
let(:mediaconvert) { Aws::MediaConvert::Client.new(stub_responses: true) }
|
40
|
+
let(:cloudwatch_events) { Aws::CloudWatchEvents::Client.new(stub_responses: true) }
|
41
|
+
let(:cloudwatch_logs) { Aws::CloudWatchLogs::Client.new(stub_responses: true) }
|
42
|
+
|
43
|
+
before do
|
44
|
+
mediaconvert.stub_responses(:describe_endpoints, reconstitute_response("media_convert/endpoints.json"))
|
45
|
+
|
46
|
+
allow(Aws::MediaConvert::Client).to receive(:new).and_return(mediaconvert)
|
47
|
+
allow(Aws::CloudWatchEvents::Client).to receive(:new).and_return(cloudwatch_events)
|
48
|
+
allow(Aws::CloudWatchLogs::Client).to receive(:new).and_return(cloudwatch_logs)
|
49
|
+
end
|
50
|
+
|
51
|
+
let(:created_job) do
|
52
|
+
mediaconvert.stub_responses(:create_job, reconstitute_response("media_convert/job_created.json"))
|
53
|
+
|
54
|
+
ActiveEncode::Base.create(
|
55
|
+
"s3://input-bucket/test_files/source_file.mp4",
|
56
|
+
output_prefix: "active-encode-test/output",
|
57
|
+
outputs: [
|
58
|
+
{ preset: "System-Avc_16x9_1080p_29_97fps_8500kbps", modifier: "-1080" },
|
59
|
+
{ preset: "System-Avc_16x9_720p_29_97fps_5000kbps", modifier: "-720" },
|
60
|
+
{ preset: "System-Avc_16x9_540p_29_97fps_3500kbps", modifier: "-540" }
|
61
|
+
],
|
62
|
+
use_original_url: true
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
66
|
+
let(:running_job) do
|
67
|
+
mediaconvert.stub_responses(:get_job, reconstitute_response("media_convert/job_progressing.json"))
|
68
|
+
ActiveEncode::Base.find(job_id)
|
69
|
+
end
|
70
|
+
|
71
|
+
let(:canceled_job) do
|
72
|
+
mediaconvert.stub_responses(:get_job, reconstitute_response("media_convert/job_canceled.json"))
|
73
|
+
ActiveEncode::Base.find(job_id)
|
74
|
+
end
|
75
|
+
|
76
|
+
let(:cancelling_job) do
|
77
|
+
mediaconvert.stub_responses(:cancel_job, reconstitute_response("media_convert/job_canceling.json"))
|
78
|
+
mediaconvert.stub_responses(:get_job, reconstitute_response("media_convert/job_canceled.json"))
|
79
|
+
ActiveEncode::Base.find(job_id)
|
80
|
+
end
|
81
|
+
|
82
|
+
let(:completed_job) do
|
83
|
+
mediaconvert.stub_responses(:get_job, reconstitute_response("media_convert/job_completed.json"))
|
84
|
+
cloudwatch_logs.stub_responses(:start_query, reconstitute_response("media_convert/job_completed_detail_query.json"))
|
85
|
+
cloudwatch_logs.stub_responses(:get_query_results, reconstitute_response("media_convert/job_completed_detail.json"))
|
86
|
+
|
87
|
+
ActiveEncode::Base.find(job_id)
|
88
|
+
end
|
89
|
+
|
90
|
+
let(:failed_job) do
|
91
|
+
mediaconvert.stub_responses(:get_job, reconstitute_response("media_convert/job_failed.json"))
|
92
|
+
|
93
|
+
ActiveEncode::Base.find(job_id)
|
94
|
+
end
|
95
|
+
|
96
|
+
let(:completed_output) do
|
97
|
+
[
|
98
|
+
{ id: "1625859001514-vvqfwj-output-auto", url: "s3://output-bucket/active-encode-test/output.m3u8",
|
99
|
+
label: "output.m3u8", audio_codec: "AAC", duration: 888_020, video_codec: "H_264" },
|
100
|
+
{ id: "1625859001514-vvqfwj-output-1080", url: "s3://output-bucket/active-encode-test/output-1080.m3u8",
|
101
|
+
label: "output-1080.m3u8", audio_bitrate: 128_000, audio_codec: "AAC", duration: 888_020,
|
102
|
+
video_bitrate: 8_500_000, height: 1080, width: 1920, video_codec: "H_264", frame_rate: 29.97 },
|
103
|
+
{ id: "1625859001514-vvqfwj-output-720", url: "s3://output-bucket/active-encode-test/output-720.m3u8",
|
104
|
+
label: "output-720.m3u8", audio_bitrate: 96_000, audio_codec: "AAC", duration: 888_020,
|
105
|
+
video_bitrate: 5_000_000, height: 720, width: 1280, video_codec: "H_264", frame_rate: 29.97 },
|
106
|
+
{ id: "1625859001514-vvqfwj-output-540", url: "s3://output-bucket/active-encode-test/output-540.m3u8",
|
107
|
+
label: "output-540.m3u8", audio_bitrate: 96_000, audio_codec: "AAC", duration: 888_020,
|
108
|
+
video_bitrate: 3_500_000, height: 540, width: 960, video_codec: "H_264", frame_rate: 29.97 }
|
109
|
+
]
|
110
|
+
end
|
111
|
+
let(:completed_tech_metadata) { {} }
|
112
|
+
let(:failed_tech_metadata) { {} }
|
113
|
+
|
114
|
+
it_behaves_like "an ActiveEncode::EngineAdapter"
|
115
|
+
|
116
|
+
describe "output" do
|
117
|
+
it "contains all expected outputs" do
|
118
|
+
completed_output.each do |expected_output|
|
119
|
+
found_output = completed_job.output.find { |output| output.id == expected_output[:id] }
|
120
|
+
expected_output.each_pair do |key, value|
|
121
|
+
expect(found_output.send(key)).to eq(value)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'rails_helper'
|
3
|
-
require 'shared_specs
|
3
|
+
require 'active_encode/spec/shared_specs'
|
4
4
|
|
5
5
|
describe ActiveEncode::EngineAdapters::PassThroughAdapter do
|
6
6
|
around do |example|
|
@@ -145,7 +145,7 @@ describe ActiveEncode::EngineAdapters::PassThroughAdapter do
|
|
145
145
|
end
|
146
146
|
|
147
147
|
it { is_expected.to be_failed }
|
148
|
-
|
148
|
+
it { expect(subject.errors).to be_present }
|
149
149
|
end
|
150
150
|
end
|
151
151
|
end
|
@@ -31,34 +31,34 @@ describe ActiveEncode::EngineAdapters::ZencoderAdapter do
|
|
31
31
|
let(:create_output) { [{ id: "511404522", url: "https://zencoder-temp-storage-us-east-1.s3.amazonaws.com/o/20150610/c09b61e4d130ddf923f0653418a80b9c/399ae101c3f99b4f318635e78a4e587a.mp4?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=GY/9LMkQAiDOrMQwS5BkmOE200s%3D&Expires=1434033527", label: nil }] }
|
32
32
|
|
33
33
|
it { is_expected.to be_a ActiveEncode::Base }
|
34
|
-
|
34
|
+
it { expect(subject.id).not_to be_empty }
|
35
35
|
it { is_expected.to be_running }
|
36
|
-
#
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
36
|
+
# it { expect(subject.output).to eq create_output }
|
37
|
+
it { expect(subject.current_operations).to be_empty }
|
38
|
+
it { expect(subject.percent_complete).to eq 0 }
|
39
|
+
it { expect(subject.errors).to be_empty }
|
40
|
+
it { expect(subject.created_at).to eq '2015-06-10T14:38:47Z' }
|
41
|
+
it { expect(subject.updated_at).to eq '2015-06-10T14:38:47Z' }
|
42
42
|
|
43
43
|
context 'input' do
|
44
44
|
subject { ActiveEncode::Base.create(file).input }
|
45
45
|
|
46
46
|
it { is_expected.to be_a ActiveEncode::Input }
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
47
|
+
it { expect(subject.id).to eq "166179248" }
|
48
|
+
it { expect(subject.url).to eq "https://archive.org/download/LuckyStr1948_2/LuckyStr1948_2_512kb.mp4" }
|
49
|
+
it { expect(subject.width).to be_blank }
|
50
|
+
it { expect(subject.height).to be_blank }
|
51
|
+
it { expect(subject.frame_rate).to be_blank }
|
52
|
+
it { expect(subject.duration).to be_blank }
|
53
|
+
it { expect(subject.file_size).to be_blank }
|
54
|
+
it { expect(subject.checksum).to be_blank }
|
55
|
+
it { expect(subject.audio_codec).to be_blank }
|
56
|
+
it { expect(subject.video_codec).to be_blank }
|
57
|
+
it { expect(subject.audio_bitrate).to be_blank }
|
58
|
+
it { expect(subject.video_bitrate).to be_blank }
|
59
|
+
it { expect(subject.state).to eq :running }
|
60
|
+
it { expect(subject.created_at).to eq "2015-06-10T14:38:47Z" }
|
61
|
+
it { expect(subject.updated_at).to eq "2015-06-10T14:38:00Z" }
|
62
62
|
end
|
63
63
|
|
64
64
|
context 'output' do
|
@@ -69,22 +69,22 @@ describe ActiveEncode::EngineAdapters::ZencoderAdapter do
|
|
69
69
|
expect(output).to be_a Array
|
70
70
|
end
|
71
71
|
it { is_expected.to be_a ActiveEncode::Output }
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
72
|
+
it { expect(subject.id).to eq "511404522" }
|
73
|
+
it { expect(subject.url).to eq "https://zencoder-temp-storage-us-east-1.s3.amazonaws.com/o/20150610/c09b61e4d130ddf923f0653418a80b9c/399ae101c3f99b4f318635e78a4e587a.mp4?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=GY/9LMkQAiDOrMQwS5BkmOE200s%3D&Expires=1434033527" }
|
74
|
+
it { expect(subject.label).to be_blank }
|
75
|
+
it { expect(subject.width).to be_blank }
|
76
|
+
it { expect(subject.height).to be_blank }
|
77
|
+
it { expect(subject.frame_rate).to be_blank }
|
78
|
+
it { expect(subject.duration).to be_blank }
|
79
|
+
it { expect(subject.file_size).to be_blank }
|
80
|
+
it { expect(subject.checksum).to be_blank }
|
81
|
+
it { expect(subject.audio_codec).to be_blank }
|
82
|
+
it { expect(subject.video_codec).to be_blank }
|
83
|
+
it { expect(subject.audio_bitrate).to be_blank }
|
84
|
+
it { expect(subject.video_bitrate).to be_blank }
|
85
|
+
it { expect(subject.state).to eq :running }
|
86
|
+
it { expect(subject.created_at).to eq "2015-06-10T14:38:47Z" }
|
87
|
+
it { expect(subject.updated_at).to eq "2015-06-10T14:38:47Z" }
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -102,35 +102,35 @@ describe ActiveEncode::EngineAdapters::ZencoderAdapter do
|
|
102
102
|
# let(:running_tech_metadata) { { audio_bitrate: "52", audio_codec: "aac", audio_channels: "2", duration: "57992", mime_type: "mpeg4", video_framerate: "29.97", height: "240", video_bitrate: "535", video_codec: "h264", width: "320" } }
|
103
103
|
|
104
104
|
it { is_expected.to be_a ActiveEncode::Base }
|
105
|
-
|
105
|
+
it { expect(subject.id).to eq '166019107' }
|
106
106
|
it { is_expected.to be_running }
|
107
|
-
#
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
#
|
107
|
+
# it { expect(subject.output).to eq running_output }
|
108
|
+
it { expect(subject.current_operations).to be_empty }
|
109
|
+
it { expect(subject.percent_complete).to eq 30.0 }
|
110
|
+
it { expect(subject.errors).to be_empty }
|
111
|
+
it { expect(subject.created_at).to eq '2015-06-09T16:18:26Z' }
|
112
|
+
it { expect(subject.updated_at).to eq '2015-06-09T16:18:28Z' }
|
113
|
+
|
114
|
+
# it { expect(subject.tech_metadata).to eq running_tech_metadata }
|
115
115
|
context 'input' do
|
116
116
|
subject { ActiveEncode::Base.find('166019107').input }
|
117
117
|
|
118
118
|
it { is_expected.to be_a ActiveEncode::Input }
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
119
|
+
it { expect(subject.id).to eq "165990056" }
|
120
|
+
it { expect(subject.url).to eq "https://archive.org/download/LuckyStr1948_2/LuckyStr1948_2_512kb.mp4" }
|
121
|
+
it { expect(subject.width).to eq 320 }
|
122
|
+
it { expect(subject.height).to eq 240 }
|
123
|
+
it { expect(subject.frame_rate).to eq 29.97 }
|
124
|
+
it { expect(subject.duration).to eq 57_992 }
|
125
|
+
it { expect(subject.file_size).to be_blank }
|
126
|
+
it { expect(subject.checksum).to be_blank }
|
127
|
+
it { expect(subject.audio_codec).to eq "aac" }
|
128
|
+
it { expect(subject.video_codec).to eq "h264" }
|
129
|
+
it { expect(subject.audio_bitrate).to eq 52 }
|
130
|
+
it { expect(subject.video_bitrate).to eq 535 }
|
131
|
+
it { expect(subject.state).to eq :completed }
|
132
|
+
it { expect(subject.created_at).to eq "2015-06-09T16:18:26Z" }
|
133
|
+
it { expect(subject.updated_at).to eq "2015-06-09T16:18:32Z" }
|
134
134
|
end
|
135
135
|
|
136
136
|
context 'output' do
|
@@ -141,22 +141,22 @@ describe ActiveEncode::EngineAdapters::ZencoderAdapter do
|
|
141
141
|
expect(output).to be_a Array
|
142
142
|
end
|
143
143
|
it { is_expected.to be_a ActiveEncode::Output }
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
144
|
+
it { expect(subject.id).to eq "510582971" }
|
145
|
+
it { expect(subject.url).to eq "https://zencoder-temp-storage-us-east-1.s3.amazonaws.com/o/20150609/48a6907086c012f68b9ca43461280515/1726d7ec3e24f2171bd07b2abb807b6c.mp4?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=vSvlxU94wlQLEbpG3Zs8ibp4MoY%3D&Expires=1433953106" }
|
146
|
+
it { expect(subject.label).to be_blank }
|
147
|
+
it { expect(subject.width).to be_blank }
|
148
|
+
it { expect(subject.height).to be_blank }
|
149
|
+
it { expect(subject.frame_rate).to be_blank }
|
150
|
+
it { expect(subject.duration).to be_blank }
|
151
|
+
it { expect(subject.file_size).to be_blank }
|
152
|
+
it { expect(subject.checksum).to be_blank }
|
153
|
+
it { expect(subject.audio_codec).to be_blank }
|
154
|
+
it { expect(subject.video_codec).to be_blank }
|
155
|
+
it { expect(subject.audio_bitrate).to be_blank }
|
156
|
+
it { expect(subject.video_bitrate).to be_blank }
|
157
|
+
it { expect(subject.state).to eq :running }
|
158
|
+
it { expect(subject.created_at).to eq "2015-06-09T16:18:26Z" }
|
159
|
+
it { expect(subject.updated_at).to eq "2015-06-09T16:18:32Z" }
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
@@ -166,33 +166,33 @@ describe ActiveEncode::EngineAdapters::ZencoderAdapter do
|
|
166
166
|
let(:progress_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_progress_cancelled.json'))) }
|
167
167
|
|
168
168
|
it { is_expected.to be_a ActiveEncode::Base }
|
169
|
-
|
169
|
+
it { expect(subject.id).to eq '165866551' }
|
170
170
|
it { is_expected.to be_cancelled }
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
171
|
+
it { expect(subject.current_operations).to be_empty }
|
172
|
+
it { expect(subject.percent_complete).to eq 0 }
|
173
|
+
it { expect(subject.errors).to be_empty }
|
174
|
+
it { expect(subject.created_at).to eq '2015-06-08T20:43:23Z' }
|
175
|
+
it { expect(subject.updated_at).to eq '2015-06-08T20:43:26Z' }
|
176
176
|
|
177
177
|
context 'input' do
|
178
178
|
subject { ActiveEncode::Base.find('165866551').input }
|
179
179
|
|
180
180
|
it { is_expected.to be_a ActiveEncode::Input }
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
181
|
+
it { expect(subject.id).to eq "165837500" }
|
182
|
+
it { expect(subject.url).to eq "https://archive.org/download/LuckyStr1948_2/LuckyStr1948_2_512kb.mp4" }
|
183
|
+
it { expect(subject.width).to be_blank }
|
184
|
+
it { expect(subject.height).to be_blank }
|
185
|
+
it { expect(subject.frame_rate).to be_blank }
|
186
|
+
it { expect(subject.duration).to be_blank }
|
187
|
+
it { expect(subject.file_size).to be_blank }
|
188
|
+
it { expect(subject.checksum).to be_blank }
|
189
|
+
it { expect(subject.audio_codec).to be_blank }
|
190
|
+
it { expect(subject.video_codec).to be_blank }
|
191
|
+
it { expect(subject.audio_bitrate).to be_blank }
|
192
|
+
it { expect(subject.video_bitrate).to be_blank }
|
193
|
+
it { expect(subject.state).to eq :cancelled }
|
194
|
+
it { expect(subject.created_at).to eq "2015-06-08T20:43:23Z" }
|
195
|
+
it { expect(subject.updated_at).to eq "2015-06-08T20:43:26Z" }
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
@@ -204,34 +204,34 @@ describe ActiveEncode::EngineAdapters::ZencoderAdapter do
|
|
204
204
|
# let(:completed_tech_metadata) { { audio_bitrate: "52", audio_codec: "aac", audio_channels: "2", duration: "57992", mime_type: "mpeg4", video_framerate: "29.97", height: "240", video_bitrate: "535", video_codec: "h264", width: "320" } }
|
205
205
|
|
206
206
|
it { is_expected.to be_a ActiveEncode::Base }
|
207
|
-
|
207
|
+
it { expect(subject.id).to eq '165839139' }
|
208
208
|
it { is_expected.to be_completed }
|
209
|
-
#
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
209
|
+
# it { expect(subject.output).to include completed_output }
|
210
|
+
it { expect(subject.current_operations).to be_empty }
|
211
|
+
it { expect(subject.percent_complete).to eq 100 }
|
212
|
+
it { expect(subject.errors).to be_empty }
|
213
|
+
it { expect(subject.created_at).to eq '2015-06-08T18:13:53Z' }
|
214
|
+
it { expect(subject.updated_at).to eq '2015-06-08T18:14:06Z' }
|
215
215
|
|
216
216
|
context 'input' do
|
217
217
|
subject { ActiveEncode::Base.find('165839139').input }
|
218
218
|
|
219
219
|
it { is_expected.to be_a ActiveEncode::Input }
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
220
|
+
it { expect(subject.id).to eq "165810088" }
|
221
|
+
it { expect(subject.url).to eq "https://archive.org/download/LuckyStr1948_2/LuckyStr1948_2_512kb.mp4" }
|
222
|
+
it { expect(subject.width).to eq 320 }
|
223
|
+
it { expect(subject.height).to eq 240 }
|
224
|
+
it { expect(subject.frame_rate).to eq 29.97 }
|
225
|
+
it { expect(subject.duration).to eq 57_992 }
|
226
|
+
it { expect(subject.file_size).to be_blank }
|
227
|
+
it { expect(subject.checksum).to be_blank }
|
228
|
+
it { expect(subject.audio_codec).to eq "aac" }
|
229
|
+
it { expect(subject.video_codec).to eq "h264" }
|
230
|
+
it { expect(subject.audio_bitrate).to eq 52 }
|
231
|
+
it { expect(subject.video_bitrate).to eq 535 }
|
232
|
+
it { expect(subject.state).to eq :completed }
|
233
|
+
it { expect(subject.created_at).to eq "2015-06-08T18:13:53Z" }
|
234
|
+
it { expect(subject.updated_at).to eq "2015-06-08T18:14:06Z" }
|
235
235
|
end
|
236
236
|
|
237
237
|
context 'output' do
|
@@ -242,22 +242,22 @@ describe ActiveEncode::EngineAdapters::ZencoderAdapter do
|
|
242
242
|
expect(output).to be_a Array
|
243
243
|
end
|
244
244
|
it { is_expected.to be_a ActiveEncode::Output }
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
245
|
+
it { expect(subject.id).to eq "509856876" }
|
246
|
+
it { expect(subject.url).to eq "https://zencoder-temp-storage-us-east-1.s3.amazonaws.com/o/20150608/ebbe865f8ef1b960d7c2bb0663b88a12/0f1948dcb2fd701fba30ff21908fe460.mp4?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=1LgIyl/el9E7zeyPxzd/%2BNwez6Y%3D&Expires=1433873646" }
|
247
|
+
it { expect(subject.label).to be_blank }
|
248
|
+
it { expect(subject.width).to eq 320 }
|
249
|
+
it { expect(subject.height).to eq 240 }
|
250
|
+
it { expect(subject.frame_rate).to eq 29.97 }
|
251
|
+
it { expect(subject.duration).to eq 5000 }
|
252
|
+
it { expect(subject.file_size).to be_blank }
|
253
|
+
it { expect(subject.checksum).to be_blank }
|
254
|
+
it { expect(subject.audio_codec).to eq "aac" }
|
255
|
+
it { expect(subject.video_codec).to eq "h264" }
|
256
|
+
it { expect(subject.audio_bitrate).to eq 53 }
|
257
|
+
it { expect(subject.video_bitrate).to eq 549 }
|
258
|
+
it { expect(subject.state).to eq :completed }
|
259
|
+
it { expect(subject.created_at).to eq "2015-06-08T18:13:53Z" }
|
260
|
+
it { expect(subject.updated_at).to eq "2015-06-08T18:14:06Z" }
|
261
261
|
end
|
262
262
|
end
|
263
263
|
|
@@ -269,34 +269,34 @@ describe ActiveEncode::EngineAdapters::ZencoderAdapter do
|
|
269
269
|
let(:failed_errors) { "The file is an XML file, and doesn't contain audio or video tracks." }
|
270
270
|
|
271
271
|
it { is_expected.to be_a ActiveEncode::Base }
|
272
|
-
|
272
|
+
it { expect(subject.id).to eq '166079902' }
|
273
273
|
it { is_expected.to be_failed }
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
274
|
+
it { expect(subject.current_operations).to be_empty }
|
275
|
+
it { expect(subject.percent_complete).to eq 0 }
|
276
|
+
it { expect(subject.errors).to be_empty }
|
277
|
+
it { expect(subject.created_at).to eq '2015-06-09T20:52:57Z' }
|
278
|
+
it { expect(subject.updated_at).to eq '2015-06-09T20:53:00Z' }
|
279
279
|
|
280
280
|
context 'input' do
|
281
281
|
subject { ActiveEncode::Base.find('165866551').input }
|
282
282
|
|
283
283
|
it { is_expected.to be_a ActiveEncode::Input }
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
284
|
+
it { expect(subject.id).to eq "166050851" }
|
285
|
+
it { expect(subject.url).to eq "s3://zencoder-customer-ingest/uploads/2015-06-09/240330/187007/682c2d90-0eea-11e5-84c9-f158f44c3d50.xml" }
|
286
|
+
it { expect(subject.errors).to include failed_errors }
|
287
|
+
it { expect(subject.width).to be_blank }
|
288
|
+
it { expect(subject.height).to be_blank }
|
289
|
+
it { expect(subject.frame_rate).to be_blank }
|
290
|
+
it { expect(subject.duration).to be_blank }
|
291
|
+
it { expect(subject.file_size).to be_blank }
|
292
|
+
it { expect(subject.checksum).to be_blank }
|
293
|
+
it { expect(subject.audio_codec).to be_blank }
|
294
|
+
it { expect(subject.video_codec).to be_blank }
|
295
|
+
it { expect(subject.audio_bitrate).to be_blank }
|
296
|
+
it { expect(subject.video_bitrate).to be_blank }
|
297
|
+
it { expect(subject.state).to eq :failed }
|
298
|
+
it { expect(subject.created_at).to eq "2015-06-09T20:52:57Z" }
|
299
|
+
it { expect(subject.updated_at).to eq "2015-06-09T20:53:00Z" }
|
300
300
|
end
|
301
301
|
end
|
302
302
|
end
|
@@ -315,7 +315,7 @@ describe ActiveEncode::EngineAdapters::ZencoderAdapter do
|
|
315
315
|
|
316
316
|
let(:encode) { ActiveEncode::Base.create(file) }
|
317
317
|
it { is_expected.to be_a ActiveEncode::Base }
|
318
|
-
|
318
|
+
it { expect(subject.id).to eq '165866551' }
|
319
319
|
it { is_expected.to be_cancelled }
|
320
320
|
end
|
321
321
|
|
@@ -332,34 +332,34 @@ describe ActiveEncode::EngineAdapters::ZencoderAdapter do
|
|
332
332
|
# let(:reload_tech_metadata) { { audio_bitrate: "52", audio_codec: "aac", audio_channels: "2", duration: "57992", mime_type: "mpeg4", video_framerate: "29.97", height: "240", video_bitrate: "535", video_codec: "h264", width: "320" } }
|
333
333
|
|
334
334
|
it { is_expected.to be_a ActiveEncode::Base }
|
335
|
-
|
335
|
+
it { expect(subject.id).to eq '166019107' }
|
336
336
|
it { is_expected.to be_running }
|
337
|
-
#
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
337
|
+
# it { expect(subject.output).to eq reload_output }
|
338
|
+
it { expect(subject.current_operations).to be_empty }
|
339
|
+
it { expect(subject.percent_complete).to eq 30.0 }
|
340
|
+
it { expect(subject.errors).to be_empty }
|
341
|
+
it { expect(subject.created_at).to eq '2015-06-09T16:18:26Z' }
|
342
|
+
it { expect(subject.updated_at).to eq '2015-06-09T16:18:28Z' }
|
343
343
|
|
344
344
|
context 'input' do
|
345
345
|
subject { ActiveEncode::Base.find('166019107').reload.input }
|
346
346
|
|
347
347
|
it { is_expected.to be_a ActiveEncode::Input }
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
348
|
+
it { expect(subject.id).to eq "165990056" }
|
349
|
+
it { expect(subject.url).to eq "https://archive.org/download/LuckyStr1948_2/LuckyStr1948_2_512kb.mp4" }
|
350
|
+
it { expect(subject.width).to eq 320 }
|
351
|
+
it { expect(subject.height).to eq 240 }
|
352
|
+
it { expect(subject.frame_rate).to eq 29.97 }
|
353
|
+
it { expect(subject.duration).to eq 57_992 }
|
354
|
+
it { expect(subject.file_size).to be_blank }
|
355
|
+
it { expect(subject.checksum).to be_blank }
|
356
|
+
it { expect(subject.audio_codec).to eq "aac" }
|
357
|
+
it { expect(subject.video_codec).to eq "h264" }
|
358
|
+
it { expect(subject.audio_bitrate).to eq 52 }
|
359
|
+
it { expect(subject.video_bitrate).to eq 535 }
|
360
|
+
it { expect(subject.state).to eq :completed }
|
361
|
+
it { expect(subject.created_at).to eq "2015-06-09T16:18:26Z" }
|
362
|
+
it { expect(subject.updated_at).to eq "2015-06-09T16:18:32Z" }
|
363
363
|
end
|
364
364
|
|
365
365
|
context 'output' do
|
@@ -370,22 +370,22 @@ describe ActiveEncode::EngineAdapters::ZencoderAdapter do
|
|
370
370
|
expect(output).to be_a Array
|
371
371
|
end
|
372
372
|
it { is_expected.to be_a ActiveEncode::Output }
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
373
|
+
it { expect(subject.id).to eq "510582971" }
|
374
|
+
it { expect(subject.url).to eq "https://zencoder-temp-storage-us-east-1.s3.amazonaws.com/o/20150609/48a6907086c012f68b9ca43461280515/1726d7ec3e24f2171bd07b2abb807b6c.mp4?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=vSvlxU94wlQLEbpG3Zs8ibp4MoY%3D&Expires=1433953106" }
|
375
|
+
it { expect(subject.label).to be_blank }
|
376
|
+
it { expect(subject.width).to be_blank }
|
377
|
+
it { expect(subject.height).to be_blank }
|
378
|
+
it { expect(subject.frame_rate).to be_blank }
|
379
|
+
it { expect(subject.duration).to be_blank }
|
380
|
+
it { expect(subject.file_size).to be_blank }
|
381
|
+
it { expect(subject.checksum).to be_blank }
|
382
|
+
it { expect(subject.audio_codec).to be_blank }
|
383
|
+
it { expect(subject.video_codec).to be_blank }
|
384
|
+
it { expect(subject.audio_bitrate).to be_blank }
|
385
|
+
it { expect(subject.video_bitrate).to be_blank }
|
386
|
+
it { expect(subject.state).to eq :running }
|
387
|
+
it { expect(subject.created_at).to eq "2015-06-09T16:18:26Z" }
|
388
|
+
it { expect(subject.updated_at).to eq "2015-06-09T16:18:32Z" }
|
389
389
|
end
|
390
390
|
end
|
391
391
|
end
|