awslive-inputlooper 0.1.9 → 0.2.0
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 34c42835fefb68681c4cb5c5a30bcf86b2f07a69359d17f25d7ef33f0fbb79e1
|
|
4
|
+
data.tar.gz: 64d6ea47aa196236dd23a0bbe6142502e78dce9c3e60289d1008cb3ed2e520c3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0a73e00dc2f4b7c8edd491e9a7206ebb2b257eea96568b67cfbb3e66964443bb7a1b9282d3946cfc3dd29735ac5256669def897ec11cc359034e28e1aece6cf1
|
|
7
|
+
data.tar.gz: a1faf5d6fdd71591166fbac43a7aa7114134ad07f6cc50a801d10ca0b5165e38bfc8e18774b96bb83c9307598bec3aa0267b9f8cd51ac18999a606ca4feac009
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module Awslive
|
|
2
|
+
class AdMarkerScheduledAction
|
|
3
|
+
FOLLOW_HASH = {
|
|
4
|
+
action_name: "f1",
|
|
5
|
+
schedule_action_start_settings: {
|
|
6
|
+
follow_mode_schedule_action_start_settings: {
|
|
7
|
+
reference_action_name: "imm",
|
|
8
|
+
follow_point: "END"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
schedule_action_settings: {
|
|
12
|
+
:scte_35_splice_insert_settings => {
|
|
13
|
+
:duration => 1,
|
|
14
|
+
:splice_event_id => 1
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
IMMEDIATE_HASH = {
|
|
20
|
+
:action_name => "action_name",
|
|
21
|
+
:schedule_action_start_settings => {
|
|
22
|
+
:immediate_mode_schedule_action_start_settings => {}
|
|
23
|
+
},
|
|
24
|
+
:schedule_action_settings => {
|
|
25
|
+
:scte_35_splice_insert_settings => {
|
|
26
|
+
:duration => 1,
|
|
27
|
+
:splice_event_id => 1
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
def get_immediate_schedule_action( ad_duration )
|
|
33
|
+
action_hash = IMMEDIATE_HASH.clone
|
|
34
|
+
action_hash[:action_name] = "#{get_action_id}-ad"
|
|
35
|
+
action_hash[:schedule_action_settings][:scte_35_splice_insert_settings][:duration] = ad_duration * 90000
|
|
36
|
+
action_hash[:schedule_action_settings][:scte_35_splice_insert_settings][:splice_event_id] = get_action_id
|
|
37
|
+
action_hash
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def get_follow_schedule_action(follow_input, ad_duration)
|
|
41
|
+
action_hash = FOLLOW_HASH.clone
|
|
42
|
+
action_hash[:action_name] = "#{get_action_id}-ad"
|
|
43
|
+
action_hash[:schedule_action_start_settings][:follow_mode_schedule_action_start_settings][:reference_action_name] = "#{follow_input}"
|
|
44
|
+
action_hash[:schedule_action_settings][:scte_35_splice_insert_settings][:duration] = ad_duration * 90000
|
|
45
|
+
action_hash[:schedule_action_settings][:scte_35_splice_insert_settings][:splice_event_id] = get_action_id
|
|
46
|
+
action_hash
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def get_action_id
|
|
50
|
+
Time.now.to_i
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -2,6 +2,9 @@ require_relative '../awslive-common/action_type'
|
|
|
2
2
|
require_relative '../awslive-common/start_type'
|
|
3
3
|
require_relative 'input_switch_schedule_action'
|
|
4
4
|
require_relative 'pause_schedule_action'
|
|
5
|
+
require_relative 'ad_marker_scheduled_action'
|
|
6
|
+
require 'uri'
|
|
7
|
+
require 'cgi'
|
|
5
8
|
|
|
6
9
|
require 'aws-sdk-medialive'
|
|
7
10
|
|
|
@@ -19,6 +22,7 @@ module Awslive
|
|
|
19
22
|
end
|
|
20
23
|
@input_switch_schedule_action = Awslive::InputSwitchScheduleAction.new
|
|
21
24
|
@pause_schedule_action = Awslive::PauseScheduleAction.new
|
|
25
|
+
@ad_marker_schedule_action = Awslive::AdMarkerScheduledAction.new
|
|
22
26
|
end
|
|
23
27
|
|
|
24
28
|
def create_schedule(channel_id, scheduled_actions )
|
|
@@ -60,13 +64,39 @@ module Awslive
|
|
|
60
64
|
follow_schedule
|
|
61
65
|
end
|
|
62
66
|
|
|
67
|
+
def get_type_duration(url)
|
|
68
|
+
type = nil
|
|
69
|
+
duration = nil
|
|
70
|
+
if !url.nil?
|
|
71
|
+
uri = URI.parse(url) rescue nil
|
|
72
|
+
params = CGI.parse(uri.query) unless uri.nil?
|
|
73
|
+
if !params.nil?
|
|
74
|
+
type = params["type"].first rescue nil
|
|
75
|
+
duration = params["duration"].first rescue nil
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
return type, duration
|
|
79
|
+
end
|
|
80
|
+
|
|
63
81
|
def create(channel_id, start_type, action_type, data)
|
|
64
82
|
scheduled_action = []
|
|
83
|
+
ad_scheduled_action = []
|
|
84
|
+
create_response = []
|
|
85
|
+
|
|
65
86
|
if action_type == INPUT_SWITCH
|
|
66
87
|
if start_type == IMMEDIATE
|
|
67
88
|
scheduled_action << @input_switch_schedule_action.get_immediate_schedule_action(data[:input_ref_name], data[:url_path])
|
|
89
|
+
type, duration = get_type_duration(data[:url_path])
|
|
90
|
+
if !type.nil? && !duration.nil? && type == "ad_marker"
|
|
91
|
+
ad_scheduled_action << @ad_marker_schedule_action.get_immediate_schedule_action(duration)
|
|
92
|
+
end
|
|
68
93
|
elsif start_type == FOLLOW
|
|
69
94
|
scheduled_action << @input_switch_schedule_action.get_follow_schedule_action(data[:follow_input], data[:trigger_input], data[:url_path])
|
|
95
|
+
type, duration = get_type_duration(data[:url_path])
|
|
96
|
+
if !type.nil? && !duration.nil? && type == "ad_marker"
|
|
97
|
+
puts "Duration => #{duration}"
|
|
98
|
+
ad_scheduled_action << @ad_marker_schedule_action.get_follow_schedule_action(data[:follow_input], duration.to_i)
|
|
99
|
+
end
|
|
70
100
|
end
|
|
71
101
|
elsif action_type == PAUSE
|
|
72
102
|
if start_type == FIXED
|
|
@@ -77,9 +107,16 @@ module Awslive
|
|
|
77
107
|
scheduled_action << @pause_schedule_action.get_unpause_schedule_action
|
|
78
108
|
end
|
|
79
109
|
end
|
|
110
|
+
|
|
111
|
+
|
|
80
112
|
unless scheduled_action.empty?
|
|
81
|
-
create_response
|
|
113
|
+
create_response << create_schedule(channel_id, scheduled_action)
|
|
114
|
+
unless ad_scheduled_action.empty?
|
|
115
|
+
puts "Ad Schedule Action #{ad_scheduled_action}"
|
|
116
|
+
create_response << create_schedule(channel_id, ad_scheduled_action) rescue nil
|
|
117
|
+
end
|
|
82
118
|
end
|
|
119
|
+
|
|
83
120
|
create_response
|
|
84
121
|
end
|
|
85
122
|
|
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.
|
|
4
|
+
version: 0.2.0
|
|
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-
|
|
11
|
+
date: 2020-04-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -83,6 +83,7 @@ files:
|
|
|
83
83
|
- lib/awslive-common/start_type.rb
|
|
84
84
|
- lib/awslive-inputlooper.rb
|
|
85
85
|
- lib/awslive-inputlooper/input_looper.rb
|
|
86
|
+
- lib/awslive-scheduler/ad_marker_scheduled_action.rb
|
|
86
87
|
- lib/awslive-scheduler/input_switch_schedule_action.rb
|
|
87
88
|
- lib/awslive-scheduler/pause_schedule_action.rb
|
|
88
89
|
- lib/awslive-scheduler/schedule_action.rb
|