active_encode 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +9 -11
  4. data/.travis.yml +2 -3
  5. data/CONTRIBUTING.md +159 -0
  6. data/Gemfile +1 -0
  7. data/README.md +11 -13
  8. data/lib/active_encode/engine_adapter.rb +2 -5
  9. data/lib/active_encode/engine_adapters.rb +1 -0
  10. data/lib/active_encode/engine_adapters/active_job_adapter.rb +6 -12
  11. data/lib/active_encode/engine_adapters/elastic_transcoder_adapter.rb +152 -0
  12. data/lib/active_encode/engine_adapters/inline_adapter.rb +1 -1
  13. data/lib/active_encode/engine_adapters/matterhorn_adapter.rb +6 -6
  14. data/lib/active_encode/engine_adapters/test_adapter.rb +2 -2
  15. data/lib/active_encode/engine_adapters/zencoder_adapter.rb +4 -4
  16. data/lib/active_encode/version.rb +1 -1
  17. data/spec/fixtures/elastic_transcoder/input_completed.json +1 -0
  18. data/spec/fixtures/elastic_transcoder/input_generic.json +1 -0
  19. data/spec/fixtures/elastic_transcoder/input_progressing.json +1 -0
  20. data/spec/fixtures/elastic_transcoder/job_canceled.json +1 -0
  21. data/spec/fixtures/elastic_transcoder/job_completed.json +1 -0
  22. data/spec/fixtures/elastic_transcoder/job_created.json +1 -0
  23. data/spec/fixtures/elastic_transcoder/job_failed.json +1 -0
  24. data/spec/fixtures/elastic_transcoder/job_progressing.json +1 -0
  25. data/spec/fixtures/elastic_transcoder/output_canceled.json +1 -0
  26. data/spec/fixtures/elastic_transcoder/output_completed.json +1 -0
  27. data/spec/fixtures/elastic_transcoder/output_failed.json +1 -0
  28. data/spec/fixtures/elastic_transcoder/output_progressing.json +1 -0
  29. data/spec/fixtures/elastic_transcoder/output_submitted.json +1 -0
  30. data/spec/integration/elastic_transcoder_adapter_spec.rb +207 -0
  31. data/spec/spec_helper.rb +6 -0
  32. metadata +32 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd86726dd90f3ffec25407a1450a80fdb606cdea
4
- data.tar.gz: aa31a70f81428b410bb5103c99a13a68ae90de19
3
+ metadata.gz: 03c144b848e422a6f99d8f102dc0fce7efe3a8aa
4
+ data.tar.gz: 7b4617a90685806b2d0fc7434955828bb7ebf0cd
5
5
  SHA512:
6
- metadata.gz: 0790ea34a31d9749268475dd1a8416f1b63bbc55559194fa5eba0348a740490c9d910d3b9c549ace98cf92e2e35be9f41ae92e9ef0fc50e206efec699b1abad3
7
- data.tar.gz: 818e6db3eb2508b65653269f53dc660de3d078eb497d68e490d54f8c05f525b7f829105ad2d7e0472fe7bfc147368c0f2296b5bb2af9703385f20ff608b30380
6
+ metadata.gz: d3a4a5d7f9b0edc0ea63022fe360c99e70953dc4adfd6cf6419e10c4940db68767a7a5715d5f075da27c4ad1630a6dfbf6fb3054f6c1c6a8d5f9194e7a3bd381
7
+ data.tar.gz: e2661ed0ebdd2e3b1eb16e85d63c5e812494fa2c538c944286629fe43b33c145a7d0de825e96b800e754c5d02216e247492e44c857a24c6686f7c62023a70cb3
data/.gitignore CHANGED
@@ -14,3 +14,4 @@
14
14
  mkmf.log
15
15
  coverage
16
16
  .ruby-version
17
+ .byebug_history
data/.rubocop.yml CHANGED
@@ -1,10 +1,15 @@
1
1
  require: rubocop-rspec
2
2
 
3
3
  AllCops:
4
- RunRailsCops: true
5
4
  DisplayCopNames: true
6
5
  Include:
7
6
  - '**/Rakefile'
7
+ Exclude:
8
+ - 'spec/**/*'
9
+ - 'vendor/**/*'
10
+
11
+ Rails:
12
+ Enabled: True
8
13
 
9
14
  Metrics/LineLength:
10
15
  Enabled: false
@@ -14,25 +19,18 @@ Metrics/AbcSize:
14
19
 
15
20
  Metrics/MethodLength:
16
21
  Exclude:
17
- - 'lib/active_encode/engine_adapters/matterhorn_adapter.rb'
18
- - 'lib/active_encode/engine_adapters/zencoder_adapter.rb'
19
- - 'lib/active_encode/engine_adapters/shingoncoder_adapter.rb'
22
+ - 'lib/active_encode/engine_adapters/*'
20
23
 
21
24
  Metrics/ClassLength:
22
25
  Exclude:
23
- - 'lib/active_encode/engine_adapters/matterhorn_adapter.rb'
24
- - 'lib/active_encode/engine_adapters/zencoder_adapter.rb'
25
- - 'lib/active_encode/engine_adapters/shingoncoder_adapter.rb'
26
+ - 'lib/active_encode/engine_adapters/*'
26
27
 
27
28
  Metrics/CyclomaticComplexity:
28
29
  Exclude:
29
- - 'lib/active_encode/engine_adapters/matterhorn_adapter.rb'
30
- - 'lib/active_encode/engine_adapters/zencoder_adapter.rb'
31
- - 'lib/active_encode/engine_adapters/shingoncoder_adapter.rb'
30
+ - 'lib/active_encode/engine_adapters/*'
32
31
 
33
32
  Style/FileName:
34
33
  Exclude:
35
- - 'lib/active-encode.rb' # Remove this when https://github.com/projecthydra-labs/active-encode/issues/1 is fixed
36
34
 
37
35
  Style/IndentationConsistency:
38
36
  EnforcedStyle: rails
data/.travis.yml CHANGED
@@ -2,9 +2,8 @@ language: ruby
2
2
  cache: bundler
3
3
  sudo: false
4
4
  rvm:
5
- - 2.0
6
- - 2.1
7
- - 2.2
5
+ - 2.2.5
6
+ - 2.3.1
8
7
  env:
9
8
  global:
10
9
  - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,159 @@
1
+ # How to Contribute
2
+
3
+ We want your help to make Project Hydra great.
4
+ There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
5
+
6
+ ## Code of Conduct
7
+
8
+ The Hydra community is dedicated to providing a welcoming and positive experience for all its
9
+ members, whether they are at a formal gathering, in a social setting, or taking part in activities
10
+ online. Please see our [Code of Conduct](https://wiki.duraspace.org/display/hydra/Code+of+Conduct)
11
+ for more information.
12
+
13
+ ## Hydra Project Intellectual Property Licensing and Ownership
14
+
15
+ All code contributors must have an Individual Contributor License Agreement (iCLA) on file with the Hydra Project Steering Group.
16
+ If the contributor works for an institution, the institution must have a Corporate Contributor License Agreement (cCLA) on file.
17
+
18
+ https://wiki.duraspace.org/display/hydra/Hydra+Project+Intellectual+Property+Licensing+and+Ownership
19
+
20
+ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the project.
21
+
22
+ ## Contribution Tasks
23
+
24
+ * Reporting Issues
25
+ * Making Changes
26
+ * Documenting Code
27
+ * Committing Changes
28
+ * Submitting Changes
29
+ * Reviewing and Merging Changes
30
+
31
+ ### Reporting Issues
32
+
33
+ * Make sure you have a [GitHub account](https://github.com/signup/free)
34
+ * Submit a [Github issue](./issues) by:
35
+ * Clearly describing the issue
36
+ * Provide a descriptive summary
37
+ * Explain the expected behavior
38
+ * Explain the actual behavior
39
+ * Provide steps to reproduce the actual behavior
40
+
41
+ ### Making Changes
42
+
43
+ * Fork the repository on GitHub
44
+ * Create a topic branch from where you want to base your work.
45
+ * This is usually the master branch.
46
+ * To quickly create a topic branch based on master; `git branch fix/master/my_contribution master`
47
+ * Then checkout the new branch with `git checkout fix/master/my_contribution`.
48
+ * Please avoid working directly on the `master` branch.
49
+ * You may find the [hub suite of commands](https://github.com/defunkt/hub) helpful
50
+ * Make sure you have added sufficient tests and documentation for your changes.
51
+ * Test functionality with RSpec; est features / UI with Capybara.
52
+ * Run _all_ the tests to assure nothing else was accidentally broken.
53
+
54
+ ### Documenting Code
55
+
56
+ * All new public methods, modules, and classes should include inline documentation in [YARD](http://yardoc.org/).
57
+ * Documentation should seek to answer the question "why does this code exist?"
58
+ * Document private / protected methods as desired.
59
+ * If you are working in a file with no prior documentation, do try to document as you gain understanding of the code.
60
+ * If you don't know exactly what a bit of code does, it is extra likely that it needs to be documented. Take a stab at it and ask for feedback in your pull request. You can use the 'blame' button on GitHub to identify the original developer of the code and @mention them in your comment.
61
+ * This work greatly increases the usability of the code base and supports the on-ramping of new committers.
62
+ * We will all be understanding of one another's time constraints in this area.
63
+ * YARD examples:
64
+ * [Hydra::Works::RemoveGenericFile](https://github.com/projecthydra-labs/hydra-works/blob/master/lib/hydra/works/services/generic_work/remove_generic_file.rb)
65
+ * [ActiveTriples::LocalName::Minter](https://github.com/ActiveTriples/active_triples-local_name/blob/master/lib/active_triples/local_name/minter.rb)
66
+ * [Getting started with YARD](http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md)
67
+
68
+ ### Committing changes
69
+
70
+ * Make commits of logical units.
71
+ * Your commit should include a high level description of your work in HISTORY.textile
72
+ * Check for unnecessary whitespace with `git diff --check` before committing.
73
+ * Make sure your commit messages are [well formed](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
74
+ * If you created an issue, you can close it by including "Closes #issue" in your commit message. See [Github's blog post for more details](https://github.com/blog/1386-closing-issues-via-commit-messages)
75
+
76
+ ```
77
+ Present tense short summary (50 characters or less)
78
+
79
+ More detailed description, if necessary. It should be wrapped to 72
80
+ characters. Try to be as descriptive as you can, even if you think that
81
+ the commit content is obvious, it may not be obvious to others. You
82
+ should add such description also if it's already present in bug tracker,
83
+ it should not be necessary to visit a webpage to check the history.
84
+
85
+ Include Closes #<issue-number> when relavent.
86
+
87
+ Description can have multiple paragraphs and you can use code examples
88
+ inside, just indent it with 4 spaces:
89
+
90
+ class PostsController
91
+ def index
92
+ respond_to do |wants|
93
+ wants.html { render 'index' }
94
+ end
95
+ end
96
+ end
97
+
98
+ You can also add bullet points:
99
+
100
+ - you can use dashes or asterisks
101
+
102
+ - also, try to indent next line of a point for readability, if it's too
103
+ long to fit in 72 characters
104
+ ```
105
+
106
+ ### Submitting Changes
107
+
108
+ * Read the article ["Using Pull Requests"](https://help.github.com/articles/using-pull-requests) on GitHub.
109
+ * Make sure your branch is up to date with its parent branch (i.e. master)
110
+ * `git checkout master`
111
+ * `git pull --rebase`
112
+ * `git checkout <your-branch>`
113
+ * `git rebase master`
114
+ * It is a good idea to run your tests again.
115
+ * If you've made more than one commit take a moment to consider whether squashing commits together would help improve their logical grouping.
116
+ * [Detailed Walkthrough of One Pull Request per Commit](http://ndlib.github.io/practices/one-commit-per-pull-request/)
117
+ * `git rebase --interactive master` ([See Github help](https://help.github.com/articles/interactive-rebase))
118
+ * Squashing your branch's changes into one commit is "good form" and helps the person merging your request to see everything that is going on.
119
+ * Push your changes to a topic branch in your fork of the repository.
120
+ * Submit a pull request from your fork to the project.
121
+
122
+ ### Reviewing and Merging Changes
123
+
124
+ We adopted [Github's Pull Request Review](https://help.github.com/articles/about-pull-request-reviews/) for our repositories.
125
+ Common checks that may occur in our repositories:
126
+
127
+ 1. Travis CI - where our automated tests are running
128
+ 2. Hound CI - where we check for style violations
129
+ 3. Approval Required - Github enforces at least one person approve a pull request. Also, all reviewers that have chimed in must approve.
130
+ 4. CodeClimate - is our code remaining healthy (at least according to static code analysis)
131
+
132
+ If one or more of the required checks failed (or are incomplete), the code should not be merged (and the UI will not allow it). If all of the checks have passed, then anyone on the project (including the pull request submitter) may merge the code.
133
+
134
+ *Example: Carolyn submits a pull request, Justin reviews the pull request and approves. However, Justin is still waiting on other checks (Travis CI is usually the culprit), so he does not merge the pull request. Eventually, all of the checks pass. At this point, Carolyn or anyone else may merge the pull request.*
135
+
136
+ #### Things to Consider When Reviewing
137
+
138
+ First, the person contributing the code is putting themselves out there. Be mindful of what you say in a review.
139
+
140
+ * Ask clarifying questions
141
+ * State your understanding and expectations
142
+ * Provide example code or alternate solutions, and explain why
143
+
144
+ This is your chance for a mentoring moment of another developer. Take time to give an honest and thorough review of what has changed. Things to consider:
145
+
146
+ * Does the commit message explain what is going on?
147
+ * Does the code changes have tests? _Not all changes need new tests, some changes are refactors_
148
+ * Do new or changed methods, modules, and classes have documentation?
149
+ * Does the commit contain more than it should? Are two separate concerns being addressed in one commit?
150
+ * Does the description of the new/changed specs match your understanding of what the spec is doing?
151
+
152
+ If you are uncertain, bring other contributors into the conversation by assigning them as a reviewer.
153
+
154
+ # Additional Resources
155
+
156
+ * [General GitHub documentation](http://help.github.com/)
157
+ * [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
158
+ * [Pro Git](http://git-scm.com/book) is both a free and excellent book about Git.
159
+ * [A Git Config for Contributing](http://ndlib.github.io/practices/my-typical-per-project-git-config/)
data/Gemfile CHANGED
@@ -9,3 +9,4 @@ gem 'rubocop-rspec', require: false
9
9
  gem 'rubyhorn', git: "https://github.com/avalonmediasystem/rubyhorn.git"
10
10
  gem 'zencoder'
11
11
  gem 'shingoncoder'
12
+ gem 'aws-sdk'
data/README.md CHANGED
@@ -29,14 +29,14 @@ ActiveEncode::Base.create(File.open('spec/fixtures/Bars_512kb.mp4'))
29
29
  Create returns an encoding job that has been submitted to the encoding engine for processing. At this point it will have an id, a state, the input, and any additional information the encoding engine returns.
30
30
 
31
31
  ```ruby
32
- #<ActiveEncode::Base:0x00000003f3cd90 @input="http://localhost:8080/files/mediapackage/edcac316-1f98-44b1-88ca-0ce6f80aebc0/ff43c56f-7b8f-4d9c-a846-6e51de2e8cb4/Bars_512kb.mp4", @options={:preset=>"avalon", :stream_base=>"file:///home/cjcolvar/Code/avalon/avalon/red5/webapps/avalon/streams"}, @id="12154", @state=:running, @current_operations=[], @percent_complete=0.0, @output=[], @errors=[], @tech_metadata={}>
32
+ #<ActiveEncode::Base:0x00000003f3cd90 @input="http://localhost:8080/files/mediapackage/edcac316-1f98-44b1-88ca-0ce6f80aebc0/ff43c56f-7b8f-4d9c-a846-6e51de2e8cb4/Bars_512kb.mp4", @options={:preset=>"avalon", :stream_base=>"file:///home/cjcolvar/Code/avalon/avalon/red5/webapps/avalon/streams"}, @id="12154", @state=:running, @current_operations=[], @percent_complete=0.0, @output=[], @errors=[], @tech_metadata={}>
33
33
  ```
34
34
  ```ruby
35
35
  encode.id # "12103"
36
36
  encode.state # :running
37
37
  ```
38
38
 
39
- This encode can be looked back up later using #find. Alternatively, use #reload to refresh an instance with the latest information from the
39
+ This encode can be looked back up later using #find. Alternatively, use #reload to refresh an instance with the latest information from the
40
40
 
41
41
  ```ruby
42
42
  encode = ActiveEncode::Base.find("12103")
@@ -85,17 +85,15 @@ end
85
85
 
86
86
  Engine adapters are shims between ActiveEncode and the back end encoding service. Each service has its own API and idiosyncracies so consult the table below to see what features are supported by each adapter. Add an additional engines by creating an engine adapter class that implements :create, :find, :list, :cancel, :purge, and :remove_output.
87
87
 
88
- | Feature | Matterhorn Adapter | Zencoder Adapter (prototype) | Shingoncoder | Inline Adapter (In progress) | Test Adapter |
89
- | --- | --- | --- | --- | --- |
90
- | Create | X | X | X | X | X |
91
- | Find | X | X | X | X | X |
92
- | List | | | | | |
93
- | Cancel | X | X | | | X |
94
- | Purge | X | | | | X |
95
- | Remove output | X | | | | |
96
- | Preset | X | | | | |
97
- | Multiple outputs | X (via preset) | | | | |
98
-
88
+ | Adapter/Feature | Create | Find | List | Cancel | Purge | Remove Output | Preset | Multiple Outputs |
89
+ |--------------------------|--------|------|------|--------|-------|---------------|--------|------------------|
90
+ | Matterhorn | X | X | | X | X | X | X | X |
91
+ | Zencoder | X | X | | X | | | | |
92
+ | Shingoncoder (prototype) | X | X | | | | | | |
93
+ | Shingoncoder | X | X | | | | | | |
94
+ | AWS Elastic Transcoder | X | X | | X | | | | |
95
+ | Inline | X | X | | | | | | |
96
+ | Test | X | X | | X | | X | | |
99
97
 
100
98
  ## Contributing
101
99
 
@@ -33,11 +33,8 @@ module ActiveEncode
33
33
  when Symbol, String
34
34
  ActiveEncode::EngineAdapters.lookup(name_or_adapter_or_class).new
35
35
  else
36
- if engine_adapter?(name_or_adapter_or_class)
37
- name_or_adapter_or_class
38
- else
39
- fail ArgumentError
40
- end
36
+ name_or_adapter_or_class if engine_adapter?(name_or_adapter_or_class)
37
+ raise ArgumentError unless engine_adapter?(name_or_adapter_or_class)
41
38
  end
42
39
  end
43
40
 
@@ -13,6 +13,7 @@ module ActiveEncode
13
13
  autoload :InlineAdapter
14
14
  autoload :ZencoderAdapter
15
15
  autoload :ShingoncoderAdapter
16
+ autoload :ElasticTranscoderAdapter
16
17
  autoload :TestAdapter
17
18
 
18
19
  ADAPTER = 'Adapter'.freeze
@@ -1,23 +1,17 @@
1
1
  module ActiveEncode
2
2
  module EngineAdapters
3
3
  class ActiveJobAdapter
4
- def create(_encode)
5
- end
4
+ def create(_encode) end
6
5
 
7
- def find(_id, _opts = {})
8
- end
6
+ def find(_id, _opts = {}) end
9
7
 
10
- def list(*_filters)
11
- end
8
+ def list(*_filters) end
12
9
 
13
- def cancel(_encode)
14
- end
10
+ def cancel(_encode) end
15
11
 
16
- def purge(_encode)
17
- end
12
+ def purge(_encode) end
18
13
 
19
- def remove_output(_encode, _output_id)
20
- end
14
+ def remove_output(_encode, _output_id) end
21
15
  end
22
16
  end
23
17
  end
@@ -0,0 +1,152 @@
1
+ module ActiveEncode
2
+ module EngineAdapters
3
+ class ElasticTranscoderAdapter
4
+ # TODO: add a stub for an input helper (supplied by an initializer) that transforms encode.input into a zencoder accepted url
5
+ def create(encode)
6
+ job = client.create_job(
7
+ input: { key: encode.input },
8
+ pipeline_id: encode.options[:pipeline_id],
9
+ output_key_prefix: encode.options[:output_key_prefix],
10
+ outputs: encode.options[:outputs],
11
+ user_metadata: encode.options[:user_metadata]
12
+ ).job
13
+
14
+ build_encode(get_job_details(job.id), encode.class)
15
+ end
16
+
17
+ def find(id, opts = {})
18
+ build_encode(get_job_details(id), opts[:cast])
19
+ end
20
+
21
+ # TODO: implement list_jobs_by_pipeline and list_jobs_by_status
22
+ def list(*_filters)
23
+ raise NotImplementedError
24
+ end
25
+
26
+ # Can only cancel jobs with status = "Submitted"
27
+ def cancel(encode)
28
+ response = client.cancel_job(id: encode.id)
29
+ build_encode(get_job_details(encode.id), encode.class) if response.successful?
30
+ end
31
+
32
+ def purge(_encode)
33
+ raise NotImplementedError
34
+ end
35
+
36
+ def remove_output(_encode, _output_id)
37
+ raise NotImplementedError
38
+ end
39
+
40
+ private
41
+
42
+ # Needs region and credentials setup per http://docs.aws.amazon.com/sdkforruby/api/Aws/ElasticTranscoder/Client.html
43
+ def client
44
+ @client ||= Aws::ElasticTranscoder::Client.new
45
+ end
46
+
47
+ def get_job_details(job_id)
48
+ client.read_job(id: job_id).job
49
+ end
50
+
51
+ def build_encode(job, cast)
52
+ return nil if job.nil?
53
+ encode = cast.new(convert_input(job), convert_options(job))
54
+ encode.id = job.id
55
+ encode.state = convert_state(job)
56
+ encode.current_operations = convert_current_operations(job)
57
+ encode.percent_complete = convert_percent_complete(job)
58
+ encode.created_at = convert_time(job.timing["submit_time_millis"])
59
+ encode.updated_at = convert_time(job.timing["start_time_millis"])
60
+ encode.finished_at = convert_time(job.timing["finish_time_millis"])
61
+ encode.output = convert_output(job)
62
+ encode.errors = convert_errors(job)
63
+ encode.tech_metadata = convert_tech_metadata(job.input.detected_properties)
64
+ encode
65
+ end
66
+
67
+ def convert_time(time_millis)
68
+ return nil if time_millis.nil?
69
+ Time.at(time_millis / 1000).iso8601
70
+ end
71
+
72
+ def convert_state(job)
73
+ case job.status
74
+ when "Submitted", "Progressing" # Should there be a queued state?
75
+ :running
76
+ when "Canceled"
77
+ :cancelled
78
+ when "Error"
79
+ :failed
80
+ when "Complete"
81
+ :completed
82
+ end
83
+ end
84
+
85
+ def convert_current_operations(_job)
86
+ current_ops = []
87
+ current_ops
88
+ end
89
+
90
+ def convert_percent_complete(job)
91
+ case job.status
92
+ when "Submitted"
93
+ 10
94
+ when "Progressing"
95
+ 50
96
+ when "Complete"
97
+ 100
98
+ else
99
+ 0
100
+ end
101
+ end
102
+
103
+ def convert_input(job)
104
+ job.input
105
+ end
106
+
107
+ def convert_options(_job_details)
108
+ {}
109
+ end
110
+
111
+ def convert_output(job)
112
+ output = []
113
+ job.outputs.each do |o|
114
+ # It is assumed that the first part of the output key can be used to label the output
115
+ # e.g. "quality-medium/somepath/filename.flv"
116
+ label = o.key.split("/", 2).first
117
+ url = job.output_key_prefix + o.key
118
+ extras = { id: o.id, url: url, label: label }
119
+ extras[:hls_url] = url + ".m3u8" if url.include?("/hls/") # TODO: find a better way to signal hls
120
+ output << convert_tech_metadata(o).merge(extras)
121
+ end
122
+ output
123
+ end
124
+
125
+ def convert_errors(job)
126
+ job.outputs.select { |o| o.status == "Error" }.collect(&:status_detail).compact
127
+ end
128
+
129
+ def convert_tech_metadata(props)
130
+ return {} if props.nil? || props.empty?
131
+ metadata_fields = {
132
+ file_size: { key: :file_size, method: :itself },
133
+ duration_millis: { key: :duration, method: :to_s },
134
+ frame_rate: { key: :video_framerate, method: :itself },
135
+ segment_duration: { key: :segment_duration, method: :itself },
136
+ width: { key: :width, method: :itself },
137
+ height: { key: :height, method: :itself }
138
+ }
139
+
140
+ metadata = {}
141
+ props.each_pair do |key, value|
142
+ next if value.nil?
143
+ conversion = metadata_fields[key.to_sym]
144
+ next if conversion.nil?
145
+ metadata[conversion[:key]] = value.send(conversion[:method])
146
+ end
147
+
148
+ metadata
149
+ end
150
+ end
151
+ end
152
+ end
@@ -17,7 +17,7 @@ module ActiveEncode
17
17
  end
18
18
 
19
19
  def list(*_filters)
20
- fail NotImplementedError
20
+ raise NotImplementedError
21
21
  end
22
22
 
23
23
  def cancel(encode)
@@ -3,7 +3,7 @@ require 'rubyhorn'
3
3
  module ActiveEncode
4
4
  module EngineAdapters
5
5
  class MatterhornAdapter
6
- DEFAULT_ARGS = { 'flavor' => 'presenter/source' }
6
+ DEFAULT_ARGS = { 'flavor' => 'presenter/source' }.freeze
7
7
 
8
8
  def create(encode)
9
9
  workflow_id = encode.options[:preset] || "full"
@@ -20,7 +20,7 @@ module ActiveEncode
20
20
  end
21
21
 
22
22
  def list(*_filters)
23
- fail NotImplementedError # TODO: implement this
23
+ raise NotImplementedError # TODO: implement this
24
24
  end
25
25
 
26
26
  def cancel(encode)
@@ -242,13 +242,13 @@ module ActiveEncode
242
242
 
243
243
  completed_transcode_operations = workflow.xpath('//operation[@id="compose" and (@state="SUCCEEDED" or @state="SKIPPED")]').size
244
244
  total_transcode_operations = workflow.xpath('//operation[@id="compose"]').size
245
- total_transcode_operations = 1 if total_transcode_operations == 0
245
+ total_transcode_operations = 1 if total_transcode_operations.zero?
246
246
  completed_distribution_operations = workflow.xpath('//operation[starts-with(@id,"distribute") and (@state="SUCCEEDED" or @state="SKIPPED")]').size
247
247
  total_distribution_operations = workflow.xpath('//operation[starts-with(@id,"distribute")]').size
248
- total_distribution_operations = 1 if total_distribution_operations == 0
248
+ total_distribution_operations = 1 if total_distribution_operations.zero?
249
249
  completed_other_operations = workflow.xpath('//operation[@id!="compose" and not(starts-with(@id,"distribute")) and (@state="SUCCEEDED" or @state="SKIPPED")]').size
250
250
  total_other_operations = workflow.xpath('//operation[@id!="compose" and not(starts-with(@id,"distribute"))]').size
251
- total_other_operations = 1 if total_other_operations == 0
251
+ total_other_operations = 1 if total_other_operations.zero?
252
252
 
253
253
  ((totals[:transcode].to_f / total_transcode_operations) * completed_transcode_operations) +
254
254
  ((totals[:distribution].to_f / total_distribution_operations) * completed_distribution_operations) +
@@ -317,7 +317,7 @@ module ActiveEncode
317
317
  MatterhornRtmpUrl.new match_data
318
318
  end
319
319
 
320
- alias_method :_binding, :binding
320
+ alias _binding binding
321
321
  def binding
322
322
  _binding
323
323
  end
@@ -17,7 +17,7 @@ module ActiveEncode
17
17
  end
18
18
 
19
19
  def list(*_filters)
20
- fail NotImplementedError
20
+ raise NotImplementedError
21
21
  end
22
22
 
23
23
  def cancel(encode)
@@ -31,7 +31,7 @@ module ActiveEncode
31
31
  end
32
32
 
33
33
  def remove_output(_encode, _output_id)
34
- fail NotImplementedError
34
+ raise NotImplementedError
35
35
  end
36
36
  end
37
37
  end
@@ -3,7 +3,7 @@ module ActiveEncode
3
3
  class ZencoderAdapter
4
4
  # TODO: add a stub for an input helper (supplied by an initializer) that transforms encode.input into a zencoder accepted url
5
5
  def create(encode)
6
- response = Zencoder::Job.create(input: "#{encode.input}")
6
+ response = Zencoder::Job.create(input: encode.input.to_s)
7
7
  build_encode(get_job_details(response.body["id"]), encode.class)
8
8
  end
9
9
 
@@ -12,7 +12,7 @@ module ActiveEncode
12
12
  end
13
13
 
14
14
  def list(*_filters)
15
- fail NotImplementedError
15
+ raise NotImplementedError
16
16
  end
17
17
 
18
18
  def cancel(encode)
@@ -21,11 +21,11 @@ module ActiveEncode
21
21
  end
22
22
 
23
23
  def purge(_encode)
24
- fail NotImplementedError
24
+ raise NotImplementedError
25
25
  end
26
26
 
27
27
  def remove_output(_encode, _output_id)
28
- fail NotImplementedError
28
+ raise NotImplementedError
29
29
  end
30
30
 
31
31
  private
@@ -1,3 +1,3 @@
1
1
  module ActiveEncode
2
- VERSION = '0.0.3'
2
+ VERSION = '0.1.0'.freeze
3
3
  end
@@ -0,0 +1 @@
1
+ {"key":"somefile.mp4","detected_properties":{"width":1280,"height":720,"frame_rate":"25","file_size":21069678,"duration_millis":117312}}
@@ -0,0 +1 @@
1
+ {"key":"somefile.mp4"}
@@ -0,0 +1 @@
1
+ {"key":"somefile.mp4","detected_properties":{"width":1280,"height":720,"frame_rate":"25","file_size":21069678,"duration_millis":117312}}
@@ -0,0 +1 @@
1
+ {"id":"1471963629141-kmcocm","arn":"arn:aws:elastictranscoder:us-west-2:039358184980:job/1471963629141-kmcocm","pipeline_id":"1470797373927-1ukxrn","output_key_prefix":"elastic-transcoder-samples/output/hls/","playlists":[],"status":"Canceled","timing":{"submit_time_millis":1471963629189,"finish_time_millis":1471975185271}}
@@ -0,0 +1 @@
1
+ {"id":"1471963629141-kmcocm","arn":"arn:aws:elastictranscoder:us-west-2:039358184980:job/1471963629141-kmcocm","pipeline_id":"1470797373927-1ukxrn","output_key_prefix":"elastic-transcoder-samples/output/hls/","playlists":[],"status":"Complete","timing":{"submit_time_millis":1471963629189,"start_time_millis":1471975169865,"finish_time_millis":1471975185271}}
@@ -0,0 +1 @@
1
+ {"id":"1471963629141-kmcocm","arn":"arn:aws:elastictranscoder:us-west-2:039358184980:job/1471963629141-kmcocm","pipeline_id":"1470797373927-1ukxrn","input":{"key":"somefile.mp4"},"output":{"id":"1","key":"hlsAudio/e8fe80f5b7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a","preset_id":"1351620000001-200071","segment_duration":"2.0","status":"Submitted","watermarks":[]},"output_key_prefix":"elastic-transcoder-samples/output/hls/","playlists":[],"status":"Submitted","timing":{"submit_time_millis":1471963629189}}
@@ -0,0 +1 @@
1
+ {"id":"1471963629141-kmcocm","arn":"arn:aws:elastictranscoder:us-west-2:039358184980:job/1471963629141-kmcocm","pipeline_id":"1470797373927-1ukxrn","output_key_prefix":"elastic-transcoder-samples/output/hls/","playlists":[],"status":"Error","timing":{"submit_time_millis":1471963629189,"start_time_millis":1471975169865,"finish_time_millis":1471975185271}}
@@ -0,0 +1 @@
1
+ {"id":"1471963629141-kmcocm","arn":"arn:aws:elastictranscoder:us-west-2:039358184980:job/1471963629141-kmcocm","pipeline_id":"1470797373927-1ukxrn","output_key_prefix":"elastic-transcoder-samples/output/hls/","playlists":[],"status":"Progressing","timing":{"submit_time_millis":1471963629189,"start_time_millis":1471975169865}}
@@ -0,0 +1 @@
1
+ {"id":"2","key":"hls0400k/e8fe80f5b7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a","preset_id":"1351620000001-200050","segment_duration":"2.0","status":"Canceled","watermarks":[]}
@@ -0,0 +1 @@
1
+ {"id":"2","key":"hls0400k/e8fe80f5b7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a","preset_id":"1351620000001-200050","segment_duration":"2.0","status":"Complete","status_detail":"The input file for this job contains 6 audio channels and the preset is configured for 2 audio channels. Amazon Elastic Transcoder audio-channel mapping may not result in the desired audio. Some individual segment files for this output have a higher bit rate than the average bit rate of the transcoded media. Playlists including this output will record a higher bit rate than the rate specified by the preset.","duration":118,"width":400,"height":224,"frame_rate":"25","file_size":6901104,"duration_millis":117353,"watermarks":[]}
@@ -0,0 +1 @@
1
+ {"id":"2","key":"hls0400k/e8fe80f5b7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a","preset_id":"1351620000001-200050","segment_duration":"2.0","status":"Error","status_detail":"3002 0419623b-342f-4bde-9e3a-439477a95f2c: The specified object could not be saved in the specified bucket because an object by that name already exists: bucket=elasticbeanstalk-us-west-2-039358184980, key=elastic-transcoder-samples/output/hls/hls0400k/e8fe80f5b7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a00000.ts.","watermarks":[]}
@@ -0,0 +1 @@
1
+ {"id":"2","key":"hls0400k/e8fe80f5b7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a","preset_id":"1351620000001-200050","segment_duration":"2.0","status":"Progressing","watermarks":[]}
@@ -0,0 +1 @@
1
+ {"id":"2","key":"hls0400k/e8fe80f5b7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a","preset_id":"1351620000001-200050","segment_duration":"2.0","status":"Submitted","watermarks":[]}
@@ -0,0 +1,207 @@
1
+ require 'spec_helper'
2
+ require 'aws-sdk'
3
+ require 'json'
4
+
5
+ describe ActiveEncode::EngineAdapters::ElasticTranscoderAdapter do
6
+ before(:all) do
7
+ ActiveEncode::Base.engine_adapter = :elastic_transcoder
8
+ end
9
+ after(:all) do
10
+ ActiveEncode::Base.engine_adapter = :inline
11
+ end
12
+
13
+ let(:client) { double(Aws::ElasticTranscoder::Client) }
14
+
15
+ before do
16
+ allow_any_instance_of(ActiveEncode::EngineAdapters::ElasticTranscoderAdapter).to receive(:client).and_return(client)
17
+ allow(client).to receive(:read_job).and_return(Aws::ElasticTranscoder::Types::ReadJobResponse.new(job: job))
18
+ allow(client).to receive(:create_job).and_return(Aws::ElasticTranscoder::Types::CreateJobResponse.new(job: job_created))
19
+ end
20
+
21
+ let(:job_created) do
22
+ j = Aws::ElasticTranscoder::Types::Job.new JSON.parse(File.read('spec/fixtures/elastic_transcoder/job_created.json'))
23
+ j.input = Aws::ElasticTranscoder::Types::JobInput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/input_generic.json')))
24
+ j.outputs = [ Aws::ElasticTranscoder::Types::JobOutput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/output_submitted.json')))]
25
+ j
26
+ end
27
+
28
+ describe "#create" do
29
+ let(:job) { job_created }
30
+ let(:create_output) { [{id: "2", url: "elastic-transcoder-samples/output/hls/hls0400k/e8fe80f5b7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a", hls_url: "elastic-transcoder-samples/output/hls/hls0400k/e8fe80f5b7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a.m3u8", label: "hls0400k", segment_duration: "2.0"}] }
31
+
32
+ subject { ActiveEncode::Base.create(
33
+ "somefile.mp4",
34
+ pipeline_id: "1471963629141-kmcocm",
35
+ output_key_prefix: "elastic-transcoder-samples/output/hls/",
36
+ outputs: [{
37
+ key: 'hls0400k/' + "e8fe80f5b7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a",
38
+ preset_id: "1351620000001-200050",
39
+ segment_duration: "2"
40
+ }])
41
+ }
42
+
43
+ it { is_expected.to be_a ActiveEncode::Base }
44
+ its(:id) { is_expected.not_to be_empty }
45
+ it { is_expected.to be_running }
46
+ its(:output) { is_expected.to eq create_output }
47
+ its(:current_operations) { is_expected.to be_empty }
48
+ its(:percent_complete) { is_expected.to eq 10 }
49
+ its(:errors) { is_expected.to be_empty }
50
+ its(:created_at) { is_expected.to be_the_same_time_as '2016-08-23T10:47:09-04:00' }
51
+ its(:updated_at) { is_expected.to be_nil }
52
+ its(:finished_at) { is_expected.to be_nil }
53
+ its(:tech_metadata) { is_expected.to be_empty }
54
+ end
55
+
56
+ describe "#find" do
57
+ context "a running encode" do
58
+ let(:job) do
59
+ j = Aws::ElasticTranscoder::Types::Job.new JSON.parse(File.read('spec/fixtures/elastic_transcoder/job_progressing.json'))
60
+ j.input = Aws::ElasticTranscoder::Types::JobInput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/input_progressing.json')))
61
+ j.outputs = [ Aws::ElasticTranscoder::Types::JobOutput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/output_progressing.json')))]
62
+ j
63
+ end
64
+
65
+ let(:running_output) { [{id: "2", url: "elastic-transcoder-samples/output/hls/hls0400k/e8fe80f5b7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a", hls_url: "elastic-transcoder-samples/output/hls/hls0400k/e8fe80f5b7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a.m3u8", label: "hls0400k", :segment_duration=>"2.0"}] }
66
+ let(:running_tech_metadata) { {:width=>1280, :height=>720, :video_framerate=>"25", :file_size=>21069678, :duration=>"117312"} }
67
+
68
+ subject { ActiveEncode::Base.find('1471963629141-kmcocm') }
69
+ it { is_expected.to be_a ActiveEncode::Base }
70
+ its(:id) { is_expected.to eq '1471963629141-kmcocm' }
71
+ it { is_expected.to be_running }
72
+ its(:output) { is_expected.to eq running_output }
73
+ its(:current_operations) { is_expected.to be_empty }
74
+ its(:percent_complete) { is_expected.to eq 50 }
75
+ its(:errors) { is_expected.to be_empty }
76
+ its(:created_at) { is_expected.to be_the_same_time_as '2016-08-23T10:47:09-04:00' }
77
+ its(:updated_at) { is_expected.to be_the_same_time_as '2016-08-23T13:59:29-04:00' }
78
+ its(:finished_at) { is_expected.to be_nil }
79
+ its(:tech_metadata) { is_expected.to eq running_tech_metadata }
80
+ end
81
+
82
+ context "a canceled encode" do
83
+ let(:job) do
84
+ j = Aws::ElasticTranscoder::Types::Job.new JSON.parse(File.read('spec/fixtures/elastic_transcoder/job_canceled.json'))
85
+ j.input = Aws::ElasticTranscoder::Types::JobInput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/input_generic.json')))
86
+ j.outputs = [ Aws::ElasticTranscoder::Types::JobOutput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/output_canceled.json')))]
87
+ j
88
+ end
89
+
90
+ subject { ActiveEncode::Base.find('1471963629141-kmcocm') }
91
+ it { is_expected.to be_a ActiveEncode::Base }
92
+ its(:id) { is_expected.to eq '1471963629141-kmcocm' }
93
+ it { is_expected.to be_cancelled }
94
+ its(:current_operations) { is_expected.to be_empty }
95
+ its(:percent_complete) { is_expected.to eq 0 }
96
+ its(:errors) { is_expected.to be_empty }
97
+ its(:created_at) { is_expected.to be_the_same_time_as '2016-08-23T10:47:09-04:00' }
98
+ its(:updated_at) { is_expected.to be_nil }
99
+ its(:finished_at) { is_expected.to be_the_same_time_as '2016-08-23T13:59:45-04:00' }
100
+ its(:tech_metadata) { is_expected.to be_empty }
101
+ end
102
+
103
+ context "a completed encode" do
104
+ let(:job) do
105
+ j = Aws::ElasticTranscoder::Types::Job.new JSON.parse(File.read('spec/fixtures/elastic_transcoder/job_completed.json'))
106
+ j.input = Aws::ElasticTranscoder::Types::JobInput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/input_completed.json')))
107
+ j.outputs = [ Aws::ElasticTranscoder::Types::JobOutput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/output_completed.json')))]
108
+ j
109
+ end
110
+ let(:completed_output) { [{id: "2", url: "elastic-transcoder-samples/output/hls/hls0400k/e8fe80f5b7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a", hls_url: "elastic-transcoder-samples/output/hls/hls0400k/e8fe80f5b7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a.m3u8", label: "hls0400k", :width=>400, :height=>224, :video_framerate=>"25", :file_size=>6901104, :duration=>"117353", :segment_duration=> "2.0"}] }
111
+ let(:completed_tech_metadata) { {:width=>1280, :height=>720, :video_framerate=>"25", :file_size=>21069678, :duration=>"117312"} }
112
+
113
+ subject { ActiveEncode::Base.find('1471963629141-kmcocm') }
114
+ it { is_expected.to be_a ActiveEncode::Base }
115
+ its(:id) { is_expected.to eq '1471963629141-kmcocm' }
116
+ it { is_expected.to be_completed }
117
+ its(:output) { is_expected.to eq completed_output }
118
+ its(:current_operations) { is_expected.to be_empty }
119
+ its(:percent_complete) { is_expected.to eq 100 }
120
+ its(:errors) { is_expected.to be_empty }
121
+ its(:created_at) { is_expected.to be_the_same_time_as '2016-08-23T10:47:09-04:00' }
122
+ its(:updated_at) { is_expected.to be_the_same_time_as '2016-08-23T13:59:29-04:00' }
123
+ its(:finished_at) { is_expected.to be_the_same_time_as '2016-08-23T13:59:45-04:00' }
124
+ its(:tech_metadata) { is_expected.to eq completed_tech_metadata }
125
+ end
126
+
127
+ context "a failed encode" do
128
+ let(:job) do
129
+ j = Aws::ElasticTranscoder::Types::Job.new JSON.parse(File.read('spec/fixtures/elastic_transcoder/job_failed.json'))
130
+ j.input = Aws::ElasticTranscoder::Types::JobInput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/input_generic.json')))
131
+ j.outputs = [ Aws::ElasticTranscoder::Types::JobOutput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/output_failed.json')))]
132
+ j
133
+ end
134
+ let(:failed_tech_metadata) { {} }
135
+
136
+ subject { ActiveEncode::Base.find('1471963629141-kmcocm') }
137
+ it { is_expected.to be_a ActiveEncode::Base }
138
+ its(:id) { is_expected.to eq '1471963629141-kmcocm' }
139
+ it { is_expected.to be_failed }
140
+ its(:current_operations) { is_expected.to be_empty }
141
+ its(:percent_complete) { is_expected.to eq 0 }
142
+ its(:errors) { is_expected.not_to be_empty }
143
+ its(:created_at) { is_expected.to be_the_same_time_as '2016-08-23T10:47:09-04:00' }
144
+ its(:updated_at) { is_expected.to be_the_same_time_as '2016-08-23T13:59:29-04:00' }
145
+ its(:finished_at) { is_expected.to be_the_same_time_as '2016-08-23T13:59:45-04:00' }
146
+ its(:tech_metadata) { is_expected.to be_empty }
147
+ end
148
+ end
149
+
150
+ describe "#cancel!" do
151
+ before do
152
+ allow(client).to receive(:cancel_job).and_return(cancel_response)
153
+ end
154
+
155
+ let(:cancel_response) do
156
+ res = double(Aws::ElasticTranscoder::Types::CancelJobResponse)
157
+ allow(res).to receive(:successful?).and_return(true)
158
+ res
159
+ end
160
+
161
+ let(:job) do
162
+ j = Aws::ElasticTranscoder::Types::Job.new JSON.parse(File.read('spec/fixtures/elastic_transcoder/job_canceled.json'))
163
+ j.input = Aws::ElasticTranscoder::Types::JobInput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/input_generic.json')))
164
+ j.outputs = [ Aws::ElasticTranscoder::Types::JobOutput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/output_canceled.json')))]
165
+ j
166
+ end
167
+
168
+ let(:encode) { ActiveEncode::Base.create(
169
+ "somefile.mp4",
170
+ pipeline_id: "1471963629141-kmcocm",
171
+ output_key_prefix: "elastic-transcoder-samples/output/hls/",
172
+ outputs: [{
173
+ key: 'hls0400k/' + "e8fe80f5b7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a",
174
+ preset_id: "1351620000001-200050",
175
+ segment_duration: "2"
176
+ }]) }
177
+ subject { encode.cancel! }
178
+ it { is_expected.to be_a ActiveEncode::Base }
179
+ its(:id) { is_expected.to eq '1471963629141-kmcocm' }
180
+ it { is_expected.to be_cancelled }
181
+ end
182
+
183
+ # describe "reload" do
184
+ # before do
185
+ # allow(ElasticTranscoder::Job).to receive(:details).and_return(details_response)
186
+ # allow(ElasticTranscoder::Job).to receive(:progress).and_return(progress_response)
187
+ # end
188
+ #
189
+ # let(:details_response) { ElasticTranscoder::Response.new(body: JSON.parse(File.read('spec/fixtures/elastic_transcoder/job_details_running.json'))) }
190
+ # let(:progress_response) { ElasticTranscoder::Response.new(body: JSON.parse(File.read('spec/fixtures/elastic_transcoder/job_progress_running.json'))) }
191
+ # let(:reload_output) { [{ id: "510582971", url: "https://elastic_transcoder-temp-storage-us-east-1.s3.amazonaws.com/o/20150609/48a6907086c012f68b9ca43461280515/1726d7ec3e24f2171bd07b2abb807b6c.mp4?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=vSvlxU94wlQLEbpG3Zs8ibp4MoY%3D&Expires=1433953106", label: nil }] }
192
+ # 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" } }
193
+ #
194
+ # subject { ActiveEncode::Base.find('166019107').reload }
195
+ # it { is_expected.to be_a ActiveEncode::Base }
196
+ # its(:id) { is_expected.to eq '166019107' }
197
+ # it { is_expected.to be_running }
198
+ # its(:output) { is_expected.to eq reload_output }
199
+ # its(:current_operations) { is_expected.to be_empty }
200
+ # its(:percent_complete) { is_expected.to eq 30.0 }
201
+ # its(:errors) { is_expected.to be_empty }
202
+ # its(:created_at) { is_expected.to eq '2015-06-09T16:18:26Z' }
203
+ # its(:updated_at) { is_expected.to eq '2015-06-09T16:18:28Z' }
204
+ # its(:finished_at) { is_expected.to be_nil }
205
+ # its(:tech_metadata) { is_expected.to eq reload_tech_metadata }
206
+ # end
207
+ end
data/spec/spec_helper.rb CHANGED
@@ -10,3 +10,9 @@ require 'active_encode'
10
10
 
11
11
  RSpec.configure do |_config|
12
12
  end
13
+
14
+ RSpec::Matchers.define :be_the_same_time_as do |expected|
15
+ match do |actual|
16
+ expect(Time.parse(expected)).to eq(Time.parse(actual))
17
+ end
18
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_encode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Klein, Chris Colvard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-29 00:00:00.000000000 Z
11
+ date: 2017-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -107,6 +107,7 @@ files:
107
107
  - ".gitignore"
108
108
  - ".rubocop.yml"
109
109
  - ".travis.yml"
110
+ - CONTRIBUTING.md
110
111
  - Gemfile
111
112
  - LICENSE
112
113
  - README.md
@@ -119,6 +120,7 @@ files:
119
120
  - lib/active_encode/engine_adapter.rb
120
121
  - lib/active_encode/engine_adapters.rb
121
122
  - lib/active_encode/engine_adapters/active_job_adapter.rb
123
+ - lib/active_encode/engine_adapters/elastic_transcoder_adapter.rb
122
124
  - lib/active_encode/engine_adapters/inline_adapter.rb
123
125
  - lib/active_encode/engine_adapters/matterhorn_adapter.rb
124
126
  - lib/active_encode/engine_adapters/shingoncoder_adapter.rb
@@ -128,6 +130,19 @@ files:
128
130
  - lib/active_encode/technical_metadata.rb
129
131
  - lib/active_encode/version.rb
130
132
  - spec/fixtures/Bars_512kb.mp4
133
+ - spec/fixtures/elastic_transcoder/input_completed.json
134
+ - spec/fixtures/elastic_transcoder/input_generic.json
135
+ - spec/fixtures/elastic_transcoder/input_progressing.json
136
+ - spec/fixtures/elastic_transcoder/job_canceled.json
137
+ - spec/fixtures/elastic_transcoder/job_completed.json
138
+ - spec/fixtures/elastic_transcoder/job_created.json
139
+ - spec/fixtures/elastic_transcoder/job_failed.json
140
+ - spec/fixtures/elastic_transcoder/job_progressing.json
141
+ - spec/fixtures/elastic_transcoder/output_canceled.json
142
+ - spec/fixtures/elastic_transcoder/output_completed.json
143
+ - spec/fixtures/elastic_transcoder/output_failed.json
144
+ - spec/fixtures/elastic_transcoder/output_progressing.json
145
+ - spec/fixtures/elastic_transcoder/output_submitted.json
131
146
  - spec/fixtures/matterhorn/cancelled_response.xml
132
147
  - spec/fixtures/matterhorn/completed_response.xml
133
148
  - spec/fixtures/matterhorn/create_response.xml
@@ -148,6 +163,7 @@ files:
148
163
  - spec/fixtures/zencoder/job_progress_create.json
149
164
  - spec/fixtures/zencoder/job_progress_failed.json
150
165
  - spec/fixtures/zencoder/job_progress_running.json
166
+ - spec/integration/elastic_transcoder_adapter_spec.rb
151
167
  - spec/integration/matterhorn_adapter_spec.rb
152
168
  - spec/integration/shingoncoder_adapter_spec.rb
153
169
  - spec/integration/zencoder_adapter_spec.rb
@@ -181,6 +197,19 @@ specification_version: 4
181
197
  summary: Declare encode job classes that can be run by a variety of encoding services
182
198
  test_files:
183
199
  - spec/fixtures/Bars_512kb.mp4
200
+ - spec/fixtures/elastic_transcoder/input_completed.json
201
+ - spec/fixtures/elastic_transcoder/input_generic.json
202
+ - spec/fixtures/elastic_transcoder/input_progressing.json
203
+ - spec/fixtures/elastic_transcoder/job_canceled.json
204
+ - spec/fixtures/elastic_transcoder/job_completed.json
205
+ - spec/fixtures/elastic_transcoder/job_created.json
206
+ - spec/fixtures/elastic_transcoder/job_failed.json
207
+ - spec/fixtures/elastic_transcoder/job_progressing.json
208
+ - spec/fixtures/elastic_transcoder/output_canceled.json
209
+ - spec/fixtures/elastic_transcoder/output_completed.json
210
+ - spec/fixtures/elastic_transcoder/output_failed.json
211
+ - spec/fixtures/elastic_transcoder/output_progressing.json
212
+ - spec/fixtures/elastic_transcoder/output_submitted.json
184
213
  - spec/fixtures/matterhorn/cancelled_response.xml
185
214
  - spec/fixtures/matterhorn/completed_response.xml
186
215
  - spec/fixtures/matterhorn/create_response.xml
@@ -201,6 +230,7 @@ test_files:
201
230
  - spec/fixtures/zencoder/job_progress_create.json
202
231
  - spec/fixtures/zencoder/job_progress_failed.json
203
232
  - spec/fixtures/zencoder/job_progress_running.json
233
+ - spec/integration/elastic_transcoder_adapter_spec.rb
204
234
  - spec/integration/matterhorn_adapter_spec.rb
205
235
  - spec/integration/shingoncoder_adapter_spec.rb
206
236
  - spec/integration/zencoder_adapter_spec.rb