awslive-inputlooper 0.2.5 → 0.2.6

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
  SHA256:
3
- metadata.gz: e8738776e52d594dd5a5f7b908f30083b997e45f2c5c9196193a5e354c679421
4
- data.tar.gz: a51099ed71b64c501e48b337391b5eee69ec342b976af959aa9793c70e069212
3
+ metadata.gz: d9d5e1cccddf98cc55107733f14256f531af1aeff0bb6e50e2b183897dd69052
4
+ data.tar.gz: 6540207814106773f683346f7425d84170e7bf46e07c4875270f87c2bf6b991d
5
5
  SHA512:
6
- metadata.gz: 927dc2676f45235f34d437df9260e1b61d1ca56a8e7ad582ca24aeb5c15259b7013994024f72ebee9990e17ae6b09409a23e8cfa6c73cdfb1de6f1a39a783fc9
7
- data.tar.gz: 656e4b17e513a56ae85a4697da179c86ee81a618a39c9e8fd12848598b59e9c6636c77dd7e3909c67a616f39311e78ae6489d3dca72d38deb53408d4d2d6c3a2
6
+ metadata.gz: 5357250243ae0a7b6c146e1351c604208b189f24ea9e9d07e317a1c504e4f0e4ddd227a9c89fea8b2f2e901c3abee2152bf0b84635c9cff05e8cec9c3e2c088b
7
+ data.tar.gz: fe1748e93bdb22ca0f27191ae0392445df6ce416c78176d1ad7755fbb0c521ce5f7498f6346bfc842e3e6f4c94486225de27c707148b4f4bbb78abe41dc4931f
@@ -1,5 +1,7 @@
1
1
  module ActionType
2
- INPUT_SWITCH = "Input Switch"
3
- PAUSE = "pause"
4
- UNPAUSE = "unpause"
2
+ INPUT_SWITCH = "input_switch"
3
+ PAUSE = "pause_state"
4
+ UNPAUSE = "unpause_state"
5
+ INPUT_PREPARE = "input_prepare"
6
+ SCTE35_SPLICE_INSERT = "scte_35_splice_insert"
5
7
  end
@@ -90,7 +90,7 @@ module Awslive
90
90
 
91
91
  current_input_name = get_current_input_name(channel_info)
92
92
  current_input_action_name = get_current_action(channel_info)
93
- sc_action = @scheduler.get_scheudle_action(@channel_id, current_input_action_name)
93
+ sc_action = @scheduler.get_schedule_action(@channel_id, current_input_action_name)
94
94
  log( "Current input #{current_input_name} #{current_input_action_name}")
95
95
  if force_immed || sc_action.nil? || is_schedule_empty?
96
96
  log( "Schedule is empty or schedule does not exist; Hence creating one immediate action with static input")
@@ -0,0 +1,26 @@
1
+ module Awslive
2
+ class InputPrepareScheduleAction
3
+ IMMEDIATE_HASH = {
4
+ :action_name => "action_name",
5
+ :schedule_action_start_settings => {
6
+ :immediate_mode_schedule_action_start_settings => {}
7
+ },
8
+ :schedule_action_settings => {
9
+ :input_prepare_settings => {
10
+ :input_attachment_name_reference => "input_name"
11
+ }
12
+ }
13
+ }
14
+
15
+ def get_immediate_schedule_action( input_ref_name)
16
+ action_hash = IMMEDIATE_HASH.clone
17
+ action_hash[:action_name] = "#{get_action_id}"
18
+ action_hash[:schedule_action_settings][:input_prepare_settings][:input_attachment_name_reference] = "#{input_ref_name}"
19
+ action_hash
20
+ end
21
+
22
+ def get_action_id
23
+ Time.now.to_i
24
+ end
25
+ end
26
+ end
@@ -3,6 +3,7 @@ require_relative '../awslive-common/start_type'
3
3
  require_relative 'input_switch_schedule_action'
4
4
  require_relative 'pause_schedule_action'
5
5
  require_relative 'ad_marker_scheduled_action'
6
+ require_relative 'input_prepare_schedule_action'
6
7
  require 'uri'
7
8
  require 'cgi'
8
9
 
@@ -23,6 +24,7 @@ module Awslive
23
24
  @input_switch_schedule_action = Awslive::InputSwitchScheduleAction.new
24
25
  @pause_schedule_action = Awslive::PauseScheduleAction.new
25
26
  @ad_marker_schedule_action = Awslive::AdMarkerScheduledAction.new
27
+ @input_prepare_schedule_action = Awslive::InputPrepareScheduleAction.new
26
28
  end
27
29
 
28
30
  def create_schedule(channel_id, scheduled_actions )
@@ -112,9 +114,14 @@ module Awslive
112
114
  if start_type == FIXED
113
115
  scheduled_action << @pause_schedule_action.get_unpause_schedule_action
114
116
  end
117
+ elsif action_type == INPUT_PREPARE
118
+ if start_type == IMMEDIATE
119
+ scheduled_action << @input_prepare_schedule_action.get_immediate_schedule_action(data[:input_ref_name])
120
+ end
115
121
  end
116
122
 
117
123
 
124
+
118
125
  unless scheduled_action.empty?
119
126
  create_response << create_schedule(channel_id, scheduled_action)
120
127
  unless ad_scheduled_action.empty?
@@ -126,7 +133,7 @@ module Awslive
126
133
  create_response
127
134
  end
128
135
 
129
- def get_scheudle_action(channel_id, action_name)
136
+ def get_schedule_action(channel_id, action_name)
130
137
  sc_action = nil
131
138
  response = @mediaclient.describe_schedule({
132
139
  channel_id: "#{channel_id}", max_results: 100
@@ -144,6 +151,35 @@ module Awslive
144
151
  sc_action
145
152
  end
146
153
 
154
+ def get_schedule_action_type(schedule_action)
155
+ action_type = nil
156
+ schedule_action[:schedule_action_settings].each_pair do | key, value |
157
+ if !value.nil?
158
+ action_type = key.to_s.sub!("_settings","")
159
+ break
160
+ end
161
+ end
162
+ action_type
163
+ end
164
+
165
+ def get_schedule_actions_by_type(channel_id, action_type)
166
+ sc_actions = []
167
+ response = @mediaclient.describe_schedule({
168
+ channel_id: "#{channel_id}", max_results: 100
169
+ })
170
+ loop do
171
+ response[:schedule_actions].each do | schedule_action |
172
+ current_action_type = get_schedule_action_type(schedule_action)
173
+ if current_action_type == action_type
174
+ sc_actions << schedule_action
175
+ end
176
+ end
177
+ break if response[:next_token].nil?
178
+ response = @mediaclient.describe_schedule({channel_id: "#{channel_id}", max_results: 100, next_token: response[:next_token] } )
179
+ end
180
+ sc_actions
181
+ end
182
+
147
183
  def get_follow_action_url(channel_id, action_name)
148
184
  url = nil
149
185
  follow_schedule = get_follow_schedule(channel_id, action_name)
@@ -153,7 +189,7 @@ module Awslive
153
189
 
154
190
  def get_action_url(channel_id, action_name)
155
191
  url = nil
156
- follow_schedule = get_scheudle_action(channel_id, action_name)
192
+ follow_schedule = get_schedule_action(channel_id, action_name)
157
193
  url = follow_schedule[:schedule_action_settings][:input_switch_settings][:url_path] unless follow_schedule.nil?
158
194
  url
159
195
  end
@@ -166,4 +202,4 @@ module Awslive
166
202
  @mediaclient.delete_schedule({ channel_id: channel_id })
167
203
  end
168
204
  end
169
- end
205
+ end
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.2.5
4
+ version: 0.2.6
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-05-21 00:00:00.000000000 Z
11
+ date: 2020-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -84,6 +84,7 @@ files:
84
84
  - lib/awslive-inputlooper.rb
85
85
  - lib/awslive-inputlooper/input_looper.rb
86
86
  - lib/awslive-scheduler/ad_marker_scheduled_action.rb
87
+ - lib/awslive-scheduler/input_prepare_schedule_action.rb
87
88
  - lib/awslive-scheduler/input_switch_schedule_action.rb
88
89
  - lib/awslive-scheduler/pause_schedule_action.rb
89
90
  - lib/awslive-scheduler/schedule_action.rb