adobe_media_encoder 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/.gitignore +15 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +98 -0
- data/Rakefile +2 -0
- data/adobe_media_encoder.gemspec +25 -0
- data/bin/ame_api +8 -0
- data/lib/adobe_media_encoder.rb +5 -0
- data/lib/adobe_media_encoder/api/cli.rb +97 -0
- data/lib/adobe_media_encoder/api/client.rb +250 -0
- data/lib/adobe_media_encoder/version.rb +3 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '089631b4dd833020bc8e6e471852701e01bd9355dcf1770480a7c8ae31109668'
|
4
|
+
data.tar.gz: 21a8d51f1e12d65f4263dca135a32ae18c961e23956b17f94e8ccbcfd47cc156
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 38b2bb824a77052772f572949df9761cc0b527650079a8ad49e595d2bbe1fb70b914e8f593f7a3aa6db9ea4431218116df1636861a2f10e41c6564d74e26bb95
|
7
|
+
data.tar.gz: cf9093dfa2d94d6257d6a5f8b8765ce8937a6893a428e9f045ef9e9c33ac8f0bad12758dba4ae5020cc9805d0d3779e7d80930634e362e704623688bb731275a
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 John Whitson
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
# Adobe Media Encoder (AME)
|
2
|
+
|
3
|
+
A library for interacting with the Adobe Media Encoder API
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'adobe_media_encoder'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install adobe_media_encoder
|
20
|
+
|
21
|
+
## Command Line Utilitie(s)
|
22
|
+
|
23
|
+
### AME API CLI [bin/ame_api](./bin/ame_api)
|
24
|
+
An executable to interact with the Adobe Media Encoder API using a Command Line Interface
|
25
|
+
|
26
|
+
### ADOBE MEDIA ENCODER 2015
|
27
|
+
|
28
|
+
### Start AME service from the Mac Command Line
|
29
|
+
|
30
|
+
cd '/Applications/Adobe Media Encoder CC 2015.3/Adobe Media Encoder CC 2015.app/Contents/ame_webservice_console.app/Contents/MacOS/';./ame_webservice_console
|
31
|
+
|
32
|
+
|
33
|
+
### Configure the Web Server ports
|
34
|
+
|
35
|
+
vi /Applications/Adobe\ Media\ Encoder\ CC\ 2015.3/Adobe\ Media\ Encoder\ CC\ 2015.app/Contents/Resources/ame_webservice_config.ini
|
36
|
+
|
37
|
+
|
38
|
+
### ADOBE MEDIA ENCODER 2017
|
39
|
+
|
40
|
+
### Start AME service from the Mac Command Line
|
41
|
+
|
42
|
+
cd '/Applications/Adobe Media Encoder CC 2017/Adobe Media Encoder CC 2017.app/Contents/ame_webservice_console.app/Contents/MacOS/';./ame_webservice_console
|
43
|
+
|
44
|
+
|
45
|
+
### Configure the Web Server ports
|
46
|
+
|
47
|
+
vi /Applications/Adobe\ Media\ Encoder\ CC\ 2017/Adobe\ Media\ Encoder\ CC\ 2017.app/Contents/Resources/ame_webservice_config.ini
|
48
|
+
|
49
|
+
|
50
|
+
#### Usage
|
51
|
+
--host-address HOSTADDRESS The AME API server address.
|
52
|
+
default: localhost
|
53
|
+
--host-port PORT The port on the AME API server to connect to.
|
54
|
+
default: 8080
|
55
|
+
--method-name METHODNAME
|
56
|
+
--method-arguments JSON
|
57
|
+
--pretty-print
|
58
|
+
--log-to FILENAME Log file location.
|
59
|
+
default: STDERR
|
60
|
+
--log-level LEVEL Logging level. Available Options: debug, info, warn, error, fatal
|
61
|
+
default: warn
|
62
|
+
--[no-]options-file [FILENAME]
|
63
|
+
Path to a file which contains default command line arguments.
|
64
|
+
default: ~/.options/ame_api
|
65
|
+
-h, --help Show this message.
|
66
|
+
|
67
|
+
#### Examples of Usage
|
68
|
+
|
69
|
+
job_abort
|
70
|
+
ame_api --host-address localhost --host-port 8080 --method-name job_abort
|
71
|
+
ame_api --host-address localhost --host-port 8080 --method-name job_abort --method-arguments '{"jobId":""}'
|
72
|
+
|
73
|
+
job_history
|
74
|
+
ame_api --host-address localhost --host-port 8080 --method-name job_history
|
75
|
+
|
76
|
+
job_status
|
77
|
+
ame_api --host-address localhost --host-port 8080 --method-name job_status
|
78
|
+
|
79
|
+
job_submit
|
80
|
+
ame_api --host-address localhost --host-port 8080 --method-name job_status --method-arguments '{"SourcePresetPath":"","SourceFilePath":"","DestinationPath":"","OverwriteDestinationIfPresent":"","NotificationTarget":"","BackupNotificationTarget":"","NotificationRateInMilliseconds":""}'
|
81
|
+
|
82
|
+
server_kill
|
83
|
+
ame_api --host-address localhost --host-port 8080 --method-name server_kill
|
84
|
+
|
85
|
+
server_restart
|
86
|
+
ame_api --host-address localhost --host-port 8080 --method-name server_restart
|
87
|
+
|
88
|
+
server_status
|
89
|
+
ame_api --host-address localhost --host-port 8080 --method-name server_status
|
90
|
+
|
91
|
+
|
92
|
+
## Contributing
|
93
|
+
|
94
|
+
1. Fork it ( https://github.com/XPlatform-Consulting/adobe_media_encoder.git/fork )
|
95
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
96
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
97
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
98
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'adobe_media_encoder/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'adobe_media_encoder'
|
8
|
+
spec.version = AdobeMediaEncoder::VERSION
|
9
|
+
spec.authors = ['John Whitson']
|
10
|
+
spec.email = ['john.whitson@gmail.com']
|
11
|
+
spec.summary = %q{A library for interacting with the Adobe Media Encoder API}
|
12
|
+
# spec.description = %q{}
|
13
|
+
spec.homepage = 'https://github.com/XPlatform-Consulting/adobe_media_encoder'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
+
|
24
|
+
# spec.add_development_dependency 'sinatra'
|
25
|
+
end
|
data/bin/ame_api
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'logger'
|
3
|
+
require 'optparse'
|
4
|
+
require 'pp'
|
5
|
+
|
6
|
+
require 'adobe_media_encoder/api/client'
|
7
|
+
|
8
|
+
module AdobeMediaEncoder
|
9
|
+
|
10
|
+
module API
|
11
|
+
|
12
|
+
class CLI
|
13
|
+
|
14
|
+
LOGGING_LEVELS = {
|
15
|
+
:debug => Logger::DEBUG,
|
16
|
+
:info => Logger::INFO,
|
17
|
+
:warn => Logger::WARN,
|
18
|
+
:error => Logger::ERROR,
|
19
|
+
:fatal => Logger::FATAL
|
20
|
+
}
|
21
|
+
|
22
|
+
attr_accessor :logger, :api
|
23
|
+
|
24
|
+
def parse_arguments
|
25
|
+
arguments = {
|
26
|
+
:log_to => STDERR,
|
27
|
+
:log_level => Logger::WARN,
|
28
|
+
:options_file_path => File.expand_path(File.basename($0, '.*'), '~/.options'),
|
29
|
+
:host => AdobeMediaEncoder::API::Client::HTTPClient::DEFAULT_HTTP_HOST_ADDRESS,
|
30
|
+
:port => AdobeMediaEncoder::API::Client::HTTPClient::DEFAULT_HTTP_HOST_PORT,
|
31
|
+
}
|
32
|
+
op = OptionParser.new
|
33
|
+
op.on('--host-address HOSTADDRESS', 'The AdobeAnywhere server address.',
|
34
|
+
"\tdefault: #{arguments[:host]}") { |v| arguments[:host] = v }
|
35
|
+
op.on('--host-port PORT', 'The port on the AdobeAnywhere server to connect to.',
|
36
|
+
"\tdefault: #{arguments[:port]}") { |v| arguments[:port] = v }
|
37
|
+
op.on('--method-name METHODNAME', '') { |v| arguments[:method_name] = v }
|
38
|
+
op.on('--method-arguments JSON', '') { |v| arguments[:method_arguments] = v }
|
39
|
+
op.on('--pretty-print', '') { |v| arguments[:pretty_print] = v }
|
40
|
+
op.on('--log-to FILENAME', 'Log file location.', "\tdefault: STDERR") { |v| arguments[:log_to] = v }
|
41
|
+
op.on('--log-level LEVEL', LOGGING_LEVELS.keys, "Logging level. Available Options: #{LOGGING_LEVELS.keys.join(', ')}",
|
42
|
+
"\tdefault: #{LOGGING_LEVELS.invert[arguments[:log_level]]}") { |v| arguments[:log_level] = LOGGING_LEVELS[v] }
|
43
|
+
op.on('--[no-]options-file [FILENAME]', 'Path to a file which contains default command line arguments.', "\tdefault: #{arguments[:options_file_path]}" ) { |v| arguments[:options_file_path] = v}
|
44
|
+
op.on_tail('-h', '--help', 'Show this message.') { puts op; exit }
|
45
|
+
op.parse!(ARGV.dup)
|
46
|
+
|
47
|
+
arguments_file_path = arguments[:options_file_path]
|
48
|
+
# Make sure that arguments from the command line override those from the arguments file
|
49
|
+
op.parse!(ARGV.dup) if op.load(arguments_file_path)
|
50
|
+
arguments
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
def initialize(args = {})
|
55
|
+
args = parse_arguments.merge(args)
|
56
|
+
@logger = Logger.new(args[:log_to])
|
57
|
+
logger.level = args[:log_level] if args[:log_level]
|
58
|
+
args[:logger] = logger
|
59
|
+
|
60
|
+
@api = AdobeMediaEncoder::API::Client.new(args)
|
61
|
+
|
62
|
+
## LIST METHODS
|
63
|
+
#methods = api.methods; methods -= Object.methods; methods.sort.each { |method| puts "#{method} #{api.method(method).parameters rescue ''}" }; exit
|
64
|
+
|
65
|
+
# http.log_request_body = true
|
66
|
+
# http.log_response_body = true
|
67
|
+
# http.log_pretty_print_body = true
|
68
|
+
|
69
|
+
|
70
|
+
method_name = args[:method_name]
|
71
|
+
send(method_name, args[:method_arguments], :pretty_print => args[:pretty_print]) if method_name
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
def send(method_name, method_arguments, args = {})
|
76
|
+
method_name = method_name.to_sym
|
77
|
+
logger.debug { "Executing Method: #{method_name}" }
|
78
|
+
|
79
|
+
send_arguments = [ method_name ]
|
80
|
+
|
81
|
+
if method_arguments
|
82
|
+
method_arguments = JSON.parse(method_arguments) if method_arguments.is_a?(String) and method_arguments.start_with?('{', '[')
|
83
|
+
send_arguments << method_arguments
|
84
|
+
end
|
85
|
+
|
86
|
+
response = api.__send__(*send_arguments)
|
87
|
+
puts response.respond_to?(:body) ? response.body : response
|
88
|
+
|
89
|
+
exit
|
90
|
+
end
|
91
|
+
|
92
|
+
# CLI
|
93
|
+
end
|
94
|
+
# API
|
95
|
+
end
|
96
|
+
# AdobeMediaEncoder
|
97
|
+
end
|
@@ -0,0 +1,250 @@
|
|
1
|
+
require 'logger'
|
2
|
+
require 'net/http'
|
3
|
+
require 'net/https'
|
4
|
+
require 'rexml/document'
|
5
|
+
|
6
|
+
require 'adobe_media_encoder'
|
7
|
+
|
8
|
+
class String
|
9
|
+
|
10
|
+
def camel_case
|
11
|
+
return self if self !~ /_/ && self =~ /[A-Z]+.*/
|
12
|
+
split('_').collect(&:capitalize).join
|
13
|
+
end
|
14
|
+
alias :camelize :camel_case
|
15
|
+
|
16
|
+
def camel_case_lower
|
17
|
+
camel_case.uncapitalize
|
18
|
+
end
|
19
|
+
|
20
|
+
def snake_case
|
21
|
+
self.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').tr('-', '_').downcase
|
22
|
+
end
|
23
|
+
alias :snakeize :snake_case
|
24
|
+
|
25
|
+
def uncapitalize
|
26
|
+
self[0, 1].downcase + self[1..-1]
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
module AdobeMediaEncoder
|
32
|
+
|
33
|
+
module API
|
34
|
+
|
35
|
+
class Client
|
36
|
+
|
37
|
+
class XMLHelper
|
38
|
+
|
39
|
+
def self.create_manifest(data)
|
40
|
+
<<-XML
|
41
|
+
<?xml version='1.0'?>
|
42
|
+
<manifest version='1.0'>#{ data.map { |k,v| _k = k.to_s.camel_case; "\n\t<#{_k}>#{v.to_s}</#{_k}>"}.join }
|
43
|
+
</manifest>
|
44
|
+
XML
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.parse_payload(xml)
|
48
|
+
doc = REXML::Document.new(xml)
|
49
|
+
Hash[doc.elements['/payload'].elements.map { |e| [ e.name, e.text ] } ]
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
class HTTPClient
|
55
|
+
|
56
|
+
DEFAULT_HTTP_HOST_ADDRESS = 'localhost'
|
57
|
+
DEFAULT_HTTP_HOST_PORT = 8080
|
58
|
+
|
59
|
+
attr_accessor :logger, :log_request_body, :log_response_body, :log_pretty_print_body,
|
60
|
+
|
61
|
+
:host, :port, :http, :request, :response, :default_request_headers,
|
62
|
+
|
63
|
+
:base_uri
|
64
|
+
|
65
|
+
def initialize(args = { })
|
66
|
+
initialize_logger(args)
|
67
|
+
initialize_http(args)
|
68
|
+
|
69
|
+
@default_request_headers = {
|
70
|
+
'Content-Type' => 'application/xml; charset=utf-8',
|
71
|
+
'Accept' => 'application/xml',
|
72
|
+
}
|
73
|
+
@parse_response = true
|
74
|
+
|
75
|
+
@base_uri = "http://#{host}:#{port}/"
|
76
|
+
|
77
|
+
@log_request_body = args.fetch(:log_request_body, true)
|
78
|
+
@log_response_body = args.fetch(:log_response_body, true)
|
79
|
+
@log_pretty_print_body = args.fetch(:log_pretty_print_body, true)
|
80
|
+
end
|
81
|
+
|
82
|
+
def initialize_logger(args = { })
|
83
|
+
@logger = args[:logger] ||= Logger.new(args[:log_to] || STDERR)
|
84
|
+
log_level = args[:log_level]
|
85
|
+
if log_level
|
86
|
+
@logger.level = log_level
|
87
|
+
args[:logger] = @logger
|
88
|
+
end
|
89
|
+
@logger
|
90
|
+
end
|
91
|
+
|
92
|
+
def initialize_http(args = { })
|
93
|
+
@host = args[:host] ||= DEFAULT_HTTP_HOST_ADDRESS
|
94
|
+
@port = args[:port] ||= DEFAULT_HTTP_HOST_PORT
|
95
|
+
@http = Net::HTTP.new(host, port)
|
96
|
+
end
|
97
|
+
|
98
|
+
# Formats a HTTPRequest or HTTPResponse body for log output.
|
99
|
+
# @param [HTTPRequest|HTTPResponse] obj
|
100
|
+
# @return [String]
|
101
|
+
def format_body_for_log_output(obj)
|
102
|
+
output = ''
|
103
|
+
if obj.content_type == 'application/json'
|
104
|
+
if @log_pretty_print_body
|
105
|
+
_body = obj.body
|
106
|
+
output << "\n"
|
107
|
+
output << JSON.pretty_generate(JSON.parse(_body)) rescue _body
|
108
|
+
return output
|
109
|
+
else
|
110
|
+
return obj.body
|
111
|
+
end
|
112
|
+
else
|
113
|
+
return obj.body.inspect
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def send_request(request)
|
118
|
+
@request = request
|
119
|
+
logger.debug { %(REQUEST: #{request.method} http#{http.use_ssl? ? 's' : ''}://#{http.address}:#{http.port}#{request.path} HEADERS: #{request.to_hash.inspect} #{log_request_body and request.request_body_permitted? ? "BODY: #{format_body_for_log_output(request)}" : ''}) }
|
120
|
+
|
121
|
+
@response = http.request(request)
|
122
|
+
logger.debug { %(RESPONSE: #{response.inspect} HEADERS: #{response.to_hash.inspect} #{log_response_body and response.respond_to?(:body) ? "BODY: #{format_body_for_log_output(response)}" : ''}) }
|
123
|
+
|
124
|
+
@parse_response ? response_parsed : response.body
|
125
|
+
end
|
126
|
+
|
127
|
+
def response_parsed
|
128
|
+
XMLHelper.parse_payload(response.body) #rescue response
|
129
|
+
end
|
130
|
+
|
131
|
+
def build_uri(path = '', query = { })
|
132
|
+
_query = query.is_a?(Hash) ? query.map { |k,v| "#{CGI.escape(k)}=#{CGI.escape(v)}" }.join('&') : query
|
133
|
+
_path = "#{path}#{_query and _query.respond_to?(:empty?) and !_query.empty? ? "?#{_query}" : ''}"
|
134
|
+
URI.parse(File.join(base_uri, _path))
|
135
|
+
end
|
136
|
+
|
137
|
+
def delete(path, options = { })
|
138
|
+
query = options.fetch(:query, { })
|
139
|
+
@uri = build_uri(path, query)
|
140
|
+
request = Net::HTTP::Delete.new(@uri.request_uri, default_request_headers)
|
141
|
+
send_request(request)
|
142
|
+
end
|
143
|
+
|
144
|
+
def get(path, query = nil, options = { })
|
145
|
+
query ||= options.fetch(:query, { })
|
146
|
+
@uri = build_uri(path, query)
|
147
|
+
request = Net::HTTP::Get.new(@uri.request_uri, default_request_headers)
|
148
|
+
send_request(request)
|
149
|
+
end
|
150
|
+
|
151
|
+
def put(path, body, options = { })
|
152
|
+
query = options.fetch(:query, { })
|
153
|
+
@uri = build_uri(path, query)
|
154
|
+
#body = JSON.generate(body) unless body.is_a?(String)
|
155
|
+
|
156
|
+
request = Net::HTTP::Put.new(@uri.request_uri, default_request_headers)
|
157
|
+
request.body = body
|
158
|
+
send_request(request)
|
159
|
+
end
|
160
|
+
|
161
|
+
def post(path, body = nil, options = { })
|
162
|
+
query = options.fetch(:query, { })
|
163
|
+
@uri = build_uri(path, query)
|
164
|
+
#body = JSON.generate(body) unless body.is_a?(String)
|
165
|
+
|
166
|
+
request = Net::HTTP::Post.new(@uri.request_uri, default_request_headers)
|
167
|
+
request.body = body
|
168
|
+
send_request(request)
|
169
|
+
end
|
170
|
+
|
171
|
+
end
|
172
|
+
|
173
|
+
attr_accessor :http
|
174
|
+
|
175
|
+
def initialize(args = { })
|
176
|
+
initialize_logger(args)
|
177
|
+
@http = HTTPClient.new(args)
|
178
|
+
end
|
179
|
+
|
180
|
+
def initialize_logger(args = { })
|
181
|
+
@logger = args[:logger] ||= Logger.new(args[:log_to] || STDOUT)
|
182
|
+
log_level = args[:log_level]
|
183
|
+
if log_level
|
184
|
+
@logger.level = log_level
|
185
|
+
args[:logger] = @logger
|
186
|
+
end
|
187
|
+
@logger
|
188
|
+
end
|
189
|
+
|
190
|
+
def normalize_args(args = { }, options = { })
|
191
|
+
case args
|
192
|
+
when Array
|
193
|
+
[*args].map { |a| normalize_args(a, options) } if normalize_args.is_a?(Array)
|
194
|
+
when Hash
|
195
|
+
symbolize_keys = options.fetch(:symbolize_keys, true)
|
196
|
+
camelize_keys = options.fetch(:camelize_keys, false)
|
197
|
+
uncapitalize_keys = options.fetch(:uncapitalize_keys, false)
|
198
|
+
downcase_keys = options.fetch(:downcase_keys, false)
|
199
|
+
Hash[args.map do |k, v|
|
200
|
+
_k = k.dup rescue k
|
201
|
+
_k = _k.to_s.camel_case if camelize_keys rescue _k
|
202
|
+
_k = _k.to_s.uncapitalize if uncapitalize_keys rescue _k
|
203
|
+
_k = _k.to_s.downcase if downcase_keys rescue _k
|
204
|
+
_k = symbolize_keys ? _k.to_sym : _k.to_s rescue _k
|
205
|
+
[_k, v ]
|
206
|
+
end]
|
207
|
+
else
|
208
|
+
args
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
def job_abort(args = { })
|
213
|
+
args = normalize_args(args, :symbolize_keys => true, :downcase_keys => true)
|
214
|
+
job_id = args[:id] || args[:job_id] || args[:jobid]
|
215
|
+
http.delete("job#{job_id ? "?jobID=#{job_id}" : ''}")
|
216
|
+
end
|
217
|
+
|
218
|
+
def job_history(args = { })
|
219
|
+
args = normalize_args(args, :symbolize_keys => true, :downcase_keys => true)
|
220
|
+
max_completed_jobs = args[:jobs] || args[:maxcompletedjobs]
|
221
|
+
http.get("history#{max_completed_jobs ? "?maxCompletedJobs=#{max_completed_jobs}" : ''}")
|
222
|
+
end
|
223
|
+
|
224
|
+
def job_status(args = { })
|
225
|
+
http.get('job')
|
226
|
+
end
|
227
|
+
|
228
|
+
def job_submit(args = { })
|
229
|
+
args = normalize_args(args, :symbolize_keys => false, :camelize_keys => true)
|
230
|
+
xml = XMLHelper.create_manifest(args)
|
231
|
+
http.post('job', xml)
|
232
|
+
end
|
233
|
+
|
234
|
+
def server_kill(args = { })
|
235
|
+
http.delete('server')
|
236
|
+
end
|
237
|
+
|
238
|
+
def server_restart(args = { })
|
239
|
+
http.post('server')
|
240
|
+
end
|
241
|
+
|
242
|
+
def server_status(args = { })
|
243
|
+
http.get('server')
|
244
|
+
end
|
245
|
+
|
246
|
+
end
|
247
|
+
|
248
|
+
end
|
249
|
+
|
250
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: adobe_media_encoder
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- John Whitson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- john.whitson@gmail.com
|
44
|
+
executables:
|
45
|
+
- ame_api
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- adobe_media_encoder.gemspec
|
55
|
+
- bin/ame_api
|
56
|
+
- lib/adobe_media_encoder.rb
|
57
|
+
- lib/adobe_media_encoder/api/cli.rb
|
58
|
+
- lib/adobe_media_encoder/api/client.rb
|
59
|
+
- lib/adobe_media_encoder/version.rb
|
60
|
+
homepage: https://github.com/XPlatform-Consulting/adobe_media_encoder
|
61
|
+
licenses:
|
62
|
+
- MIT
|
63
|
+
metadata: {}
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
requirements: []
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 2.7.6
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: A library for interacting with the Adobe Media Encoder API
|
84
|
+
test_files: []
|