awslive-inputlooper 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d419767541f1dad5b2d78c48e6bfbcaa2ddd5696927db79776182257457b8fa
4
- data.tar.gz: 3756e17fd1a8e81ff61fbeab5864bff7ec7417778a6d1e96d0f82215f3f95ea5
3
+ metadata.gz: b8f2fd1b146b3faa7ebb65e465d0df1d28412e084d397e27ba8d32cc43d6cfc3
4
+ data.tar.gz: 1004c929aaca79613773743f116b7f4119ecf91b26edee8bf6bd60267fa14551
5
5
  SHA512:
6
- metadata.gz: 5ebee223608ff8c27b0ce0498f180cf13cb44fd5bb0a909f067b2a0c56c95c3a91e1ee95f7e1effb3f686e51b49a73f7a4dd1e196e9cae97002a0461879e3b55
7
- data.tar.gz: 6711775e948903d5b0d21463598c152e0fe9339c5defbf84917e0f8b7c76568b612f76a86d88f2c1b45fa9e10665c2f625391434228448a6b5284930449426a9
6
+ metadata.gz: 971393b543078bff8652afe4d2c2aaa0a0cd2b2f3e7442b73628feb66a291233730af866bbd705a1336ea899b8f0e6d122790117a0b862ad94e4e3b7c38fdd27
7
+ data.tar.gz: 1a684303ba02c9eecb55ef576f3396c69fa1d6bdced54be53640e760df7821f7f9c213b493846932e0cd8acc667012783bbdbb3d4527e215c4e3a11faebd6798
@@ -1,4 +1,5 @@
1
1
  module ActionType
2
2
  INPUT_SWITCH = "Input Switch"
3
3
  PAUSE = "pause"
4
+ UNPAUSE = "unpause"
4
5
  end
@@ -18,9 +18,12 @@ module Awslive
18
18
 
19
19
  INITAL_INPUT_ACTION_NAME = "Initial Channel Input"
20
20
 
21
- def initialize(channel_id, playlist = nil)
21
+ def initialize(channel_id, playlist = nil, access_key=nil , access_secret =nil, region = nil)
22
22
  credentials = Aws::SharedCredentials.new
23
- if credentials.set?
23
+ if !access_key.nil? && !access_secret.nil?
24
+ aws_region = region.nil? ? 'us-east-1' : region
25
+ @medialiveclient = Aws::MediaLive::Client.new(:access_key_id => access_key, :secret_access_key => access_secret, :region => aws_region )
26
+ elsif credentials.set?
24
27
  @medialiveclient = Aws::MediaLive::Client.new(:credentials => credentials)
25
28
  else
26
29
  @medialiveclient = Aws::MediaLive::Client.new
@@ -84,7 +87,7 @@ module Awslive
84
87
  raise InvalidInputException.new("No Valid inputs; should be provisioned with one static and one dynamic Input")
85
88
  end
86
89
 
87
- current_input_name = get_current_input(channel_info)
90
+ current_input_name = get_current_input_name(channel_info)
88
91
  current_input_action_name = get_current_action(channel_info)
89
92
  sc_action = @scheduler.get_scheudle_action(@channel_id, current_input_action_name)
90
93
  log( "Current input #{current_input_name} #{current_input_action_name}")
@@ -189,12 +192,32 @@ module Awslive
189
192
  @medialiveclient.describe_channel({ :channel_id => "#{@channel_id}" })
190
193
  end
191
194
 
192
- def get_current_input(channel_info = nil )
195
+ def start_channel
196
+ res = @medialiveclient.start_channel({ :channel_id => "#{@channel_id}" })
197
+ puts "Start Channel Rsponse #{res}"
198
+ res
199
+ end
200
+
201
+ def stop_channel
202
+ res = @medialiveclient.stop_channel({ :channel_id => "#{@channel_id}" })
203
+ puts "Stop Channel Rsponse #{res}"
204
+ res
205
+ end
206
+
207
+ def get_current_input_name(channel_info = nil )
193
208
  channel_info = get_channel_info if channel_info.nil?
194
209
  current_input_name = channel_info[:pipeline_details][0][:active_input_attachment_name]
195
210
  current_input_name
196
211
  end
197
212
 
213
+ def get_current_input_url(channel_info = nil)
214
+ channel_info = get_channel_info if channel_info.nil?
215
+ get_current_input_name(channel_info)
216
+ current_url = @scheduler.get_action_url(@channel_id, current_input_action_name)
217
+ current_url
218
+ end
219
+
220
+
198
221
  def get_current_action(channel_info = nil )
199
222
  channel_info = get_channel_info if channel_info.nil?
200
223
  current_action_name = channel_info[:pipeline_details][0][:active_input_switch_action_name]
@@ -211,6 +234,9 @@ module Awslive
211
234
  @scheduler.create(@channel_id, IMMEDIATE, PAUSE, get_channel_class)
212
235
  end
213
236
 
214
- end
237
+ def unpause_channel
238
+ @scheduler.create(@channel_id, IMMEDIATE, UNPAUSE, get_channel_class)
239
+ end
215
240
 
216
- end
241
+ end
242
+ end
@@ -33,6 +33,14 @@ module Awslive
33
33
  action_hash
34
34
  end
35
35
 
36
+ def get_unpause_schedule_action
37
+ action_hash = PAUSE_HASH.clone
38
+ action_hash["actionName"] = "#{get_action_id}"
39
+ exec_time = ( Time.now + 10 ).iso8601
40
+ action_hash["scheduleActionStartSettings"]["fixedModeScheduleActionStartSettings"]["time"] = "#{exec_time}"
41
+ action_hash
42
+ end
43
+
36
44
  def get_action_id
37
45
  Time.now.to_i
38
46
  end
@@ -72,6 +72,10 @@ module Awslive
72
72
  if start_type == FIXED
73
73
  scheduled_action << @pause_scheduler.get_pause_schedule_action(data[:channel_class])
74
74
  end
75
+ elsif action_type == UNPAUSE
76
+ if start_type == FIXED
77
+ scheduled_action << @pause_scheduler.get_unpause_schedule_action(data[:channel_class])
78
+ end
75
79
  end
76
80
  unless scheduled_action.empty?
77
81
  create_response = create_schedule(channel_id, scheduled_action)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awslive-inputlooper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maheshwaran G
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-28 00:00:00.000000000 Z
11
+ date: 2020-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler