bitmovin-api 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79ce2c3a5e332e098999ffcc89ea82ff4c2577ed
4
- data.tar.gz: 547ef7e7c343ab404b9b820adc900c3e67820e7c
3
+ metadata.gz: 58e5ab7b4b53603b42d600ff0c9d340146ca314e
4
+ data.tar.gz: 49a36d3533b21cedc463fec732b8c19bbdb986ea
5
5
  SHA512:
6
- metadata.gz: b6b0fc491aa097221c41d389df9a076078295d51273f5f3a2b8408ae37442de83228486b60e72c59e337593139e92af61da9dfdf4968f958ad1baefc2ef439eb
7
- data.tar.gz: 646897cc58b81af3c0fd5d4428af6e4c6170d95ea48a9d19f36b76972a9bb6619e1ae0e7dc2a73c1abaf2d37b43ace57813cc4fdaa9c37d304034e0e04bbef07
6
+ metadata.gz: e3b87a0032f649fe8a81349fd8ce6dfe8af02cb659ea6aada4bcb439b8dcbe395e9d486ee3870817cb0a565402defb6d974c91595973f9f7b55ffa9d36332717
7
+ data.tar.gz: a05f6bab22f76a9bb97bd53d22fbc7c929586b78ece8ba0257340b5988724322f95e467a1df7de88b8f02eb27c9a30e3527890d256fae1582c7ea9fa74bbbe9f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bitmovin-api (0.0.1.pre.pre2)
4
+ bitmovin-api (0.0.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -8,10 +8,10 @@ require 'bitmovin/transfer_job'
8
8
  require 'bitmovin/job'
9
9
 
10
10
  module Bitmovin
11
-
11
+
12
12
  API_URL = 'https://portal.bitcodin.com/api'
13
13
  API_URI = URI(API_URL)
14
-
14
+
15
15
  @@api_key = nil
16
16
  @@http = Net::HTTP.new API_URI.host, API_URI.port
17
17
  @@http.use_ssl = API_URI.scheme == "https"
@@ -0,0 +1,220 @@
1
+ module Bitmovin
2
+
3
+ class Client
4
+
5
+ def initialize(api_key)
6
+ Bitmovin.api_key = api_key
7
+ end
8
+
9
+ ##
10
+ # Creates a new encoding job
11
+ # @param params [Hash] Job details
12
+ # @option params input_id [Integer] Job input id
13
+ # @option params output_id [Integer] Job output id
14
+ # @option params encoding_profile_id [Integer] Encoding profile id
15
+ # @option params audio_meta_data [Hash] Meta data of the audio streams (Only available when using standard as speed setting)
16
+ # * :default_stream_id (Integer) - Default stream id of the audio stream
17
+ # * :language (String) - Language abbreviation [ISO 639-1]
18
+ # * :label (String) - Label of the language field
19
+ # @option params manifest_types [Array<String>] Available values: mpd | m3u8
20
+ # @option params extract_closed_captinos [Boolean] Extract closed captions from the input file
21
+ # @option params deinterlace [Boolean] Create de-interlaced output
22
+ # @option params merge_audio_channel_configs [Hash] Merge multiple mono audio input streams to stereo or 5.1 audio streams (Only available when using standard as speed setting)
23
+ # * :audio_channels [Array] - Array of mono input streams
24
+ #
25
+ # @return [Bitmovin::Job] a Bitmovin job details
26
+ #
27
+ # @example
28
+ # client = Bitmovin::Client.new "somefuncykey"
29
+ #
30
+ # job = client.create_job(
31
+ # input_id: 1,
32
+ # output_id: 1,
33
+ # encoding_profile_id: 1,
34
+ # manifest_types: ["mpd", "m3u8"]
35
+ # )
36
+ #
37
+ def create_job(params = {})
38
+ Bitmovin::Job.create(params)
39
+ end
40
+
41
+ ##
42
+ # Create new encoding profile
43
+ # @param params Encoding profile video & audio configurations
44
+ # @option params [String] :name Name of new Encoding profile
45
+ # @option params [Number] :rotation Rotation of the video in degrees. A positive value will rotate the video clockwise and a negative one counter clockwise.
46
+ # @option params [Hash] :segment_length Only available using standard speed. Defines the length of a segment. Must be a value between 1 and 9 seconds.
47
+ # @option params [Array<Hash>] :video_stream_configs An array of video profile configs
48
+ # * :default_stream_id ID of the video stream which should be encoded
49
+ # * :representation_id ID of the video stream config
50
+ # * :bitrate Bitrate of the video stream. Value must be in the range from 32000 to 20000000
51
+ # * :profile Profile which should be used to encode video stream. Possible values are: baseline, main, high
52
+ # * :preset Preset which should be used to encode video stream. Possible values are: standard, professional, premium
53
+ # * :height Video-Width in px, must be in the range from 128 to 7680
54
+ # * :width Video-Height in px, must be in the range from 96 to 4320
55
+ # * :rate Only available using standard speed. The sample rate the encoded video should have in FPS. Values must be in the range from 1 to 120
56
+ # * :codec Only available using premium speed. Sets the video codec used for encoding. Possible values are: h264, hevc. Default value is h264.
57
+ # * :b_frames Sets the amount of B-Frames. Valid value range: 0 - 16
58
+ # * :ref_frames Sets the amount of Reference-Frames. Valid value range: 0 - 16
59
+ # * :qp_min Sets the minimum of quantization-factor. Valid value range: 0 - 69
60
+ # * :qp_max Sets the maximum of quantization-factor. Valid value range: 0 - 69
61
+ # * :mv_prediction_mode Sets the Motion Vector Prediction Mode. Valid values: none, spatial, temporal, auto
62
+ # * :mv_search_range_max Sets the maximum Motion-Vector-Search-Range. Valid value range: 16 - 24
63
+ # * :no_cabac Disable CABAC.
64
+ # @option params [Array<Hash>] :audio_stream_configs An array of audio profile configs
65
+ # * :default_stream_id ID of the audio stream which should be encoded
66
+ # * :representation_id ID of the audio stream config
67
+ # * :bitrate Bitrate of the audio stream. Values must be in the range from 8000 to 256000
68
+ # * :rate The sample rate the encoded audio should have in Hz. Possible values are: 0, 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000
69
+ # @option params [Hash] :watermark_config A watermark config
70
+ # * :top Distance between the top of the watermark image and the top of the input video
71
+ # * :left Distance between the left side of the watermark image and the left side of the input video
72
+ # * :bottom Distance between the bottom of the watermark image and the bottom of the input video
73
+ # * :right Distance between the right of the watermark image and the right of the input video
74
+ # @option params [Hash] :cropping_config crop configuration
75
+ # * :top Amount of pixel which will be cropped of the input video from the top.
76
+ # * :left Amount of pixel which will be cropped of the input video from the left side.
77
+ # * :bottom Amount of pixel which will be cropped of the input video from the bottom.
78
+ # * :right Amount of pixel which will be cropped of the input video from the right side.
79
+ #
80
+ # @return [Bitmovin::EncodingProfile] a bitmovin encoding profile details
81
+ #
82
+ # @example
83
+ # client = Bitmovin::Client.new "somefuncykey"
84
+ #
85
+ # encoding_profile = client.create_encoding_profile(
86
+ # name: "New profile",
87
+ # video_stream_configs: [
88
+ # {
89
+ # default_stream_id: 0,
90
+ # bitrate: 1024000,
91
+ # profile: "Main",
92
+ # preset: "Standard",
93
+ # codec: "h264",
94
+ # height: 480,
95
+ # width: 204
96
+ # }
97
+ # ],
98
+ # audio_stream_configs: [
99
+ # {
100
+ # default_stream_id: 0,
101
+ # bitrate: 256000
102
+ # }
103
+ # ]
104
+ # )
105
+
106
+ def create_encoding_profile(params = {})
107
+ Bitmovin::EncodingProfile.create(params)
108
+ end
109
+
110
+ ##
111
+ #Creates new input
112
+ # @overload create_input(url, params)
113
+ # @param url [String] url of input for URL, S3 or Aspera inputs
114
+ # @param params [String] input params
115
+ # @option params {Boolean] :async Create input async
116
+ # @option params [String] :type Type of input
117
+ # @option params [String] :username Basic auth username
118
+ # @option params [String] :password Basic auth password
119
+ # @option params [String] :region ('us-east-1') S3 bucket region
120
+ # @option params [String] :bucket S3 bucket name for s3 input, also can be infered from url
121
+ # @option params [String] :object_key S3 object name with containing folder, can be infered from url
122
+ # @option params [String] :access_key S3 or GCS access key, required for S3 or GCS inputs
123
+ # @option params [String] :secret_key S3 or GCS secret, required for S3 or GCS inputs
124
+ # @option params [String] :account_name MS Azure account name, required for Azure inputs
125
+ # @option params [String] :account_key MS Azure account key, required for Azure inputs
126
+ # @option params [String] :container MS Azure storage container name
127
+ # @option params [String] :min_bandwidth, Minimal download bandwidth
128
+ # @option params [String] :max_bandwidth, Maximal download bandwidth
129
+ #
130
+ # @example
131
+ # client = Bitmovin::Client.new "somefuncykey"
132
+ # input = client.create_input("https://bucket-name.s3.amazonaws.com/path/to/file.txt",
133
+ # type: 's3',
134
+ # access_key: "awsS3Key",
135
+ # secret_key: "awsS3Secret"
136
+ # )
137
+ #
138
+ # @overload create_input(params)
139
+ # @param params [String] input params
140
+ # @option params {Boolean] :async Create input async
141
+ # @option params [String] :type Type of input
142
+ # @option params [String] :url Aspera/Azure file url
143
+ # @option params [String] :username Basic auth username
144
+ # @option params [String] :password Basic auth password
145
+ # @option params [String] :region ('us-east-1') S3 bucket region
146
+ # @option params [String] :bucket S3 bucket name for s3 input, also can be infered from url
147
+ # @option params [String] :object_key S3 object name with containing folder, can be infered from url
148
+ # @option params [String] :access_key S3 or GCS access key, required for S3 or GCS inputs
149
+ # @option params [String] :secret_key S3 or GCS secret, required for S3 or GCS inputs
150
+ # @option params [String] :account_name MS Azure account name, required for Azure inputs
151
+ # @option params [String] :account_key MS Azure account key, required for Azure inputs
152
+ # @option params [String] :container MS Azure storage container name
153
+ # @option params [String] :min_bandwidth, Minimal download bandwidth
154
+ # @option params [String] :max_bandwidth, Maximal download bandwidth
155
+ #
156
+ # @example
157
+ # client = Bitmovin::Client.new "somefuncykey"
158
+ #
159
+ # client.create_input(
160
+ # bucket: "bucket-name",
161
+ # object_key: "/path/to/file.txt",
162
+ # type: 's3',
163
+ # access_key: "awsS3Key",
164
+ # secret_key: "awsS3Secret"
165
+ # )
166
+ #
167
+ #
168
+ # @return [Bitmovin::Input] a bitmovin input details
169
+ #
170
+ def create_input(*args)
171
+ Bitmovin::Input.create(*args)
172
+ end
173
+
174
+ ##
175
+ # Create a new Bitmovin Output
176
+ # @param params [Hash] Output details
177
+ # @option params [String] :type Type of Output
178
+ # @option params [String] :name Name of output profile
179
+ # @option params [String] :bucket S3 Bucket name for s3 output
180
+ # @option params [String] :region ('us-east-1') S3 region of bucket, required for S3 outputs
181
+ # @option params [String] :access_key S3/GCS Access Key, required for S3 outputs
182
+ # @option params [String] :secret_key S3/GCS Secret key, required for S3 outputs
183
+ # @option params [String] :account_name MS Azure account name, required for Azure outputs
184
+ # @option params [String] :account_key MS Azure account key, required for Azure outputs
185
+ # @option params [String] :container Name of Azure storage container
186
+ # @option params [String] :prefix Virtual sub-directory for file
187
+ # @option params [Boolean] :make_public If true, all transfered files can be accessed by their respective URL from anyone
188
+ # @option params [Boolean] :create_sub_directory (true) if true, create a sub directory for your job (<job_id>_<hash>)
189
+ #
190
+ # @example
191
+ # client = Bitmovin::Client.new "somefuncykey"
192
+ #
193
+ # client.create_input(
194
+ # type: 's3',
195
+ # access_key: 'awsS3Key',
196
+ # secret_key: 'aswS3Secret',
197
+ # name: 'file.txt',
198
+ # prefix: '/path/to',
199
+ # bucket: "bucket-name"
200
+ # )
201
+ #
202
+ #
203
+ # @return [Bitmovin::Output] Bitmovin Output details
204
+ #
205
+ def create_output(params = {})
206
+ Bitmovin::Output.create(params)
207
+ end
208
+
209
+ ##
210
+ # Transfer job result to destination outputs
211
+ # @option params job_id [Integer] Job-ID
212
+ # @option params output_id [Integer] Output-ID
213
+ #
214
+ # @return [Bitmovin::TransferJob] Transfer job details
215
+ #
216
+ def transfer_job(params={})
217
+ Bitmovin::TransferJob.create(params)
218
+ end
219
+ end
220
+ end
@@ -16,6 +16,7 @@ module Bitmovin
16
16
  url
17
17
  username
18
18
  password
19
+ created_at
19
20
  region
20
21
  bucket
21
22
  object_key
@@ -24,6 +24,7 @@ module Bitmovin
24
24
  prefix
25
25
  make_public
26
26
  create_sub_directory
27
+ created_at
27
28
  }
28
29
 
29
30
  ATTRIBUTES.each do |_attr|
@@ -1,3 +1,3 @@
1
1
  module Bitmovin
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,10 +1,16 @@
1
- require 'rack'
2
- require "apib/mock_server"
1
+ #!/usr/bin/env ruby
3
2
 
4
- base_url = "http://private-anon-6f2a0baf67-bitcodinrestapi.apiary-proxy.com/api"
5
- api_b = File.expand_path('../bitcodinrestapi.apib', __FILE__)
6
- blueprint = File.read(api_b)
3
+ require 'optparse'
7
4
 
8
- app = Apib::MockServer.new(base_url, blueprint)
5
+ options = {}
9
6
 
10
- Rack::Handler.default.run app
7
+ OptionParser.new do |opts|
8
+
9
+ opts.banner = "Usage: bitmovin [options]"
10
+
11
+ opts.on("-v", "--version", "Print client version") do
12
+ options[:version] = true
13
+ end
14
+ end.parse!
15
+ p options
16
+ p ARGV
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitmovin-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - DevilsNightsix