evostream-event 0.1.0.pre.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 +7 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +36 -0
- data/Rakefile +8 -0
- data/lib/evostream/commands.rb +19 -0
- data/lib/evostream/commands/create.rb +97 -0
- data/lib/evostream/commands/create/dash.rb +28 -0
- data/lib/evostream/commands/create/hls.rb +108 -0
- data/lib/evostream/commands/destroy.rb +41 -0
- data/lib/evostream/events.rb +36 -0
- data/lib/evostream/events/in_stream_closed.rb +36 -0
- data/lib/evostream/events/in_stream_created.rb +45 -0
- data/lib/evostream/events/out_stream_created.rb +45 -0
- data/lib/evostream/info.rb +53 -0
- data/lib/evostream/service.rb +14 -0
- data/lib/evostream_event.rb +57 -0
- metadata +291 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e3b94c6c90f2000d81044e0890e9789be217ea5f
|
4
|
+
data.tar.gz: 28a0b4caf5a5e8501f976fcde7ad4e67b50ed16e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0730d9b7503b1065d00be9831dd8727d27427355b452ebaf58ec1a2712ffaf9f051764275fd68cca1aca6d8209b841de51f98605a5f8f076483bd2fc9d03c04c
|
7
|
+
data.tar.gz: e2b68b1a7e5a472896b97ac6cbb0016bd565bde94dd6c500dbde37b6c2349ddbe379d7aeddeba73da88f995ed886bb8c138120ccbf9d2a3fae5811b067ff39ef
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 Dazzl
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Evostream::Event | [](https://travis-ci.org/Dev-Crea/evostream-event)
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/evostream/event`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'evostream-event'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install evostream-event
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/evostream-event. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Evostream
|
4
|
+
# Manage command
|
5
|
+
module Commands
|
6
|
+
# Class parent for all command
|
7
|
+
class Command
|
8
|
+
def initialize(commands = {})
|
9
|
+
@command = []
|
10
|
+
commands.each do |command_name, command_param|
|
11
|
+
@command.push send(command_name, command_param)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'evostream/commands/create'
|
19
|
+
require 'evostream/commands/destroy'
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Evostream
|
4
|
+
# Concern all command sending to evoStream
|
5
|
+
module Commands
|
6
|
+
# Abstract class for create element
|
7
|
+
class Create < Command
|
8
|
+
def initialize(commands = {})
|
9
|
+
super(commands)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
attr_reader :command
|
15
|
+
|
16
|
+
# The stream(s) that will be used as the input. This is a comma-delimited
|
17
|
+
# list of active stream names (local stream names)
|
18
|
+
def local_stream_names(param = 'null')
|
19
|
+
"localStreamNames=#{param} "
|
20
|
+
end
|
21
|
+
|
22
|
+
# The folder where all the manifest and fragment files will be stored.
|
23
|
+
# This folder must be accessible by the DASH clients. It is usually in the
|
24
|
+
# web-root of the server
|
25
|
+
def target_folder(param = 'null')
|
26
|
+
"targetFolder=#{param} "
|
27
|
+
end
|
28
|
+
|
29
|
+
# The corresponding bandwidths for each stream listed in localStreamNames.
|
30
|
+
# Again, this can be a comma-delimited list
|
31
|
+
def bandwidths(param = 0)
|
32
|
+
"bandwidths=#{param} "
|
33
|
+
end
|
34
|
+
|
35
|
+
# The name assigned to the DASH stream or group. If the localStreamNames
|
36
|
+
# parameter contains only one entry and groupName is not specified,
|
37
|
+
# groupName will have the value of the input stream name
|
38
|
+
def group_name(param)
|
39
|
+
"groupName=#{param} "
|
40
|
+
end
|
41
|
+
|
42
|
+
# Either `appending` or `rolling`
|
43
|
+
def playlist_type(param = 'appending')
|
44
|
+
"playlistType=#{param} "
|
45
|
+
end
|
46
|
+
|
47
|
+
# The number of fragments before the server starts to overwrite the older
|
48
|
+
# fragments. Used only when playlistType is 'rolling'. Ignored otherwise
|
49
|
+
def playlist_length(param = 10)
|
50
|
+
"playlistLength=#{param} "
|
51
|
+
end
|
52
|
+
|
53
|
+
# The length (in seconds) of fragments to be made
|
54
|
+
def chunk_length(param = 10)
|
55
|
+
"chunkLength=#{param} "
|
56
|
+
end
|
57
|
+
|
58
|
+
# If true, chunking is performed ONLY on IDR. Otherwise, chunking is
|
59
|
+
# performed whenever chunk length is achieved
|
60
|
+
def chunk_on_idr(param = 1)
|
61
|
+
"chunkOnIDR=#{param} "
|
62
|
+
end
|
63
|
+
|
64
|
+
# If true, the EMS will attempt to reconnect to the stream source if the
|
65
|
+
# connection is severed
|
66
|
+
def keep_alive(param = 1)
|
67
|
+
"keepAlive=#{param} "
|
68
|
+
end
|
69
|
+
|
70
|
+
# If true, it will allow overwrite of destination files
|
71
|
+
def overwrite_destination(param = 1)
|
72
|
+
"overwriteDestination=#{param} "
|
73
|
+
end
|
74
|
+
|
75
|
+
# How many old files are kept besides the ones present in the current
|
76
|
+
# version of the playlist. Only applicable for rolling playlists
|
77
|
+
def stale_retention_count(param)
|
78
|
+
"staleRetentionCount=#{param} "
|
79
|
+
end
|
80
|
+
|
81
|
+
# If true, all manifest and fragment files in the target folder will be
|
82
|
+
# removed before DASH creation is started
|
83
|
+
def cleanup_destination(param = 0)
|
84
|
+
"cleanupDestination=#{param} "
|
85
|
+
end
|
86
|
+
|
87
|
+
# Set this parameter to 1 (default) for a live DASH, otherwise set it to 0
|
88
|
+
# for a VOD
|
89
|
+
def dynamic_profile(param = 1)
|
90
|
+
"dynamicProfile=#{param} "
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
require 'evostream/commands/create/dash'
|
97
|
+
require 'evostream/commands/create/hls'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Evostream
|
4
|
+
module Commands
|
5
|
+
# Create flux DASH
|
6
|
+
class CreateDASH < Create
|
7
|
+
# Call default command for create DASH Stream
|
8
|
+
def initialize(commands = {
|
9
|
+
local_stream_names: 'null', target_folder: 'null'
|
10
|
+
})
|
11
|
+
super(commands)
|
12
|
+
end
|
13
|
+
|
14
|
+
def cmd
|
15
|
+
cmd_hash = command.join
|
16
|
+
Evostream.logger "createDASHStream : #{cmd_hash}"
|
17
|
+
"createDASHStream?params=#{Base64.urlsafe_encode64(cmd_hash)}"
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
# The manifest file name
|
23
|
+
def manifest_name(param = 'manifest.mpd')
|
24
|
+
"manifestName=#{param} "
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# :reek:TooManyMethods
|
4
|
+
|
5
|
+
module Evostream
|
6
|
+
module Commands
|
7
|
+
# Create flux HLS
|
8
|
+
class CreateHLS < Create
|
9
|
+
# Call default command for create DASH Stream
|
10
|
+
def initialize(commands = {
|
11
|
+
local_stream_names: 'null', target_folder: 'null'
|
12
|
+
})
|
13
|
+
super(commands)
|
14
|
+
end
|
15
|
+
|
16
|
+
def cmd
|
17
|
+
cmd_hash = command.join
|
18
|
+
Evostream.logger "createHLSStream : #{cmd_hash}"
|
19
|
+
"createHLSStream?params=#{Base64.urlsafe_encode64(cmd_hash)}"
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def create_master_playlist(param = 1)
|
25
|
+
"createMasterPlaylist=#{param} "
|
26
|
+
end
|
27
|
+
|
28
|
+
# The manifest file name
|
29
|
+
def playlist_name(param = 'playlist.m3u8')
|
30
|
+
"playlistName=#{param} "
|
31
|
+
end
|
32
|
+
|
33
|
+
# This parameter represents the maximum length, in seconds, the EMS will
|
34
|
+
# allow anysingle chunk to be. This is primarily in the case of
|
35
|
+
# chunkOnIDR=true where the EMS will wait for the next key-frame. If the
|
36
|
+
# maxChunkLength is less than chunkLength, the parameter shall be ignored
|
37
|
+
def max_chunk_length(param = 0)
|
38
|
+
"maxChunkLength=#{param} "
|
39
|
+
end
|
40
|
+
|
41
|
+
# The base name used to generate the *.ts chunks
|
42
|
+
def chunk_base_name(param = 'segment')
|
43
|
+
"chunkBaseName=#{param} "
|
44
|
+
end
|
45
|
+
|
46
|
+
# Sets the type of DRM encryption to use. Options are: none (no
|
47
|
+
# encryption), evo (AES Encryption), SAMPLE-AES (Sample-AES), verimatrix
|
48
|
+
# (Verimatrix DRM). For Verimatrix DRM, the 'drm' section of the
|
49
|
+
# config.lua file must be active and properly configured
|
50
|
+
def drm_type(param = 'none')
|
51
|
+
"drmType=#{param} "
|
52
|
+
end
|
53
|
+
|
54
|
+
# Specifies the number of keys that will be automatically generated and
|
55
|
+
# rotated over while encrypting this HLS stream
|
56
|
+
def aes_key_count(param = 5)
|
57
|
+
"AESKeyCount=#{param} "
|
58
|
+
end
|
59
|
+
|
60
|
+
# Specifies if the resulting stream will be audio only. A value of 1(true)
|
61
|
+
# will result in a stream without video
|
62
|
+
def audio_only(param = 0)
|
63
|
+
"audioOnly=#{param} "
|
64
|
+
end
|
65
|
+
|
66
|
+
# If true, HLS will resume in appending segments to previously created
|
67
|
+
# childplaylist even in cases of EMS shutdown or cut off stream source
|
68
|
+
def hls_resume(param = 0)
|
69
|
+
"hlsResume=#{param} "
|
70
|
+
end
|
71
|
+
|
72
|
+
# If true, corresponding hls files to a stream will be deleted if the said
|
73
|
+
# stream is removed or shut down or disconnected
|
74
|
+
def cleanup_on_close(param = 0)
|
75
|
+
"cleanupOnClose=#{param} "
|
76
|
+
end
|
77
|
+
|
78
|
+
# If true, will use the EXT-X-BYTERANGE feature of HLS (version 4 and up)
|
79
|
+
def use_byte_range(param = 0)
|
80
|
+
"useByteRange=#{param} "
|
81
|
+
end
|
82
|
+
|
83
|
+
# When using useByteRange=1, this parameter needs to be set too. This will
|
84
|
+
# be the size of file before chunking it to another file, this replace the
|
85
|
+
# chunkLength in case of EXT-X-BYTERANGE, since chunkLength will be the
|
86
|
+
# byte range chunk
|
87
|
+
def file_length(param = 0)
|
88
|
+
"fileLength=#{param} "
|
89
|
+
end
|
90
|
+
|
91
|
+
# If true, uses UTC in playlist time stamp otherwise will use the local
|
92
|
+
# server time
|
93
|
+
def use_system_time(param = 0)
|
94
|
+
"useSystemTime=#{param} "
|
95
|
+
end
|
96
|
+
|
97
|
+
def offset_time(param = 0)
|
98
|
+
"offsetTime=#{param} "
|
99
|
+
end
|
100
|
+
|
101
|
+
# A parameter valid only for HLS v.6 onwards. This will indicate the start
|
102
|
+
# offset time (in seconds) for the playback of the playlist
|
103
|
+
def start_offset(param = 0)
|
104
|
+
"startOffset=#{param} "
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Evostream
|
4
|
+
# Concern all command sending to evoStream
|
5
|
+
module Commands
|
6
|
+
# Abstract class for create element
|
7
|
+
class Destroy < Command
|
8
|
+
def initialize(commands = { group_name: 'null', remove_hls_hds_files: 1 })
|
9
|
+
super(commands)
|
10
|
+
end
|
11
|
+
|
12
|
+
def cmd
|
13
|
+
"removeConfig?params=#{Base64.urlsafe_encode64(command.join)}"
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
attr_reader :command
|
19
|
+
|
20
|
+
# The configId of the configuration that needs to be removed. ConfigIds
|
21
|
+
# can be obtained from the listConfig interface. Removing an inbound
|
22
|
+
# stream will also automatically remove all associated outbound streams.
|
23
|
+
def id(param = 'null')
|
24
|
+
"id=#{param} "
|
25
|
+
end
|
26
|
+
|
27
|
+
# The name of the group that needs to be removed (applicable to HLS, HDS
|
28
|
+
# and external processes). *Mandatory only if the id parameter is not
|
29
|
+
# specified.
|
30
|
+
def group_name(param = 'null')
|
31
|
+
"groupName=#{param} "
|
32
|
+
end
|
33
|
+
|
34
|
+
# If 1 (true) and the stream is HLS or HDS, the folder associated with it
|
35
|
+
# will be removed
|
36
|
+
def remove_hls_hds_files(param = 0)
|
37
|
+
"removeHlsHdsFiles=#{param} "
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Evostream
|
4
|
+
# Gem Evostream::Event
|
5
|
+
module Events
|
6
|
+
# Class parent for all event
|
7
|
+
class Event
|
8
|
+
def initialize(id_flux)
|
9
|
+
Evostream.logger "Initialize event #{class_name}"
|
10
|
+
@id_flux = id_flux
|
11
|
+
@model = Service.model.find_by(Service.model_id => id_flux)
|
12
|
+
end
|
13
|
+
|
14
|
+
def execute(type_flux = %w(hls dash))
|
15
|
+
Evostream.logger "Execute action for event #{class_name}"
|
16
|
+
type_flux.each { |flux| yield(flux) } if block_given?
|
17
|
+
end
|
18
|
+
|
19
|
+
def class_name
|
20
|
+
self.class.name.demodulize
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.descendants
|
24
|
+
ObjectSpace.each_object(Class).select { |klass| klass < self }
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
attr_reader :id_flux, :model
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
require 'evostream/events/in_stream_created'
|
35
|
+
require 'evostream/events/in_stream_closed'
|
36
|
+
require 'evostream/events/out_stream_created'
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Evostream
|
4
|
+
module Events
|
5
|
+
# Action inStreamClosed
|
6
|
+
class InStreamClosed < Event
|
7
|
+
def initialize(id_flux, config = {})
|
8
|
+
super(id_flux)
|
9
|
+
@config = config
|
10
|
+
end
|
11
|
+
|
12
|
+
def execute
|
13
|
+
super do |type_flux|
|
14
|
+
klass = Evostream::Commands::Destroy.new(remove_config(type_flux))
|
15
|
+
Evostream.send_command(klass.cmd)
|
16
|
+
yield if block_given?
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
attr_reader :config
|
23
|
+
|
24
|
+
# rubocop:disable Style/GuardClause
|
25
|
+
def remove_config(flux)
|
26
|
+
unless @config.empty?
|
27
|
+
{
|
28
|
+
group_name: "#{Evostream::Service.name}#{flux}",
|
29
|
+
remove_hls_hds_files: 1
|
30
|
+
}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
# rubocop:enable Style/GuardClause
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Evostream
|
4
|
+
module Events
|
5
|
+
# Action inStreamCreated
|
6
|
+
class InStreamCreated < Event
|
7
|
+
def execute
|
8
|
+
super do |type_flux|
|
9
|
+
klass = "Evostream::Commands::Create#{type_flux.upcase}".constantize
|
10
|
+
command = send(type_flux, type_flux)
|
11
|
+
Evostream.send_command(klass.new(command).cmd)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def hls(flux)
|
18
|
+
{
|
19
|
+
local_stream_names: stream_name,
|
20
|
+
target_folder: target_folder(flux),
|
21
|
+
cleanup_destination: 1,
|
22
|
+
group_name: group_name(flux),
|
23
|
+
keep_alive: 1,
|
24
|
+
chunk_length: 1,
|
25
|
+
playlist_length: 10,
|
26
|
+
playlist_type: 'rolling'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
alias dash hls
|
31
|
+
|
32
|
+
def target_folder(flux)
|
33
|
+
"#{Evostream::Service.web_root}#{group_name(flux)}/#{stream_name}"
|
34
|
+
end
|
35
|
+
|
36
|
+
def group_name(type_flux)
|
37
|
+
"#{Evostream::Service.name}#{type_flux}"
|
38
|
+
end
|
39
|
+
|
40
|
+
def stream_name
|
41
|
+
"#{Evostream::Service.name}#{id_flux}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Evostream
|
4
|
+
module Events
|
5
|
+
# Action OutStreamCreated
|
6
|
+
class OutStreamCreated < Event
|
7
|
+
def initialize(id_flux, request)
|
8
|
+
super(id_flux)
|
9
|
+
@request = request
|
10
|
+
end
|
11
|
+
|
12
|
+
def execute
|
13
|
+
super
|
14
|
+
stream = what_flux.constantize
|
15
|
+
model.streams.push(stream.new(config_id: ex_config, flux: ex_flux))
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def what_flux
|
21
|
+
@request.key?('hlsSettings') ? 'Hls' : 'Dash'
|
22
|
+
end
|
23
|
+
|
24
|
+
def name_flux
|
25
|
+
case what_flux
|
26
|
+
when 'Hls' then 'playlistName'
|
27
|
+
when 'Dash' then 'manifestName'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def name_settings
|
32
|
+
@request["#{what_flux.downcase}Settings"]
|
33
|
+
end
|
34
|
+
|
35
|
+
def ex_config
|
36
|
+
name_settings['configId']
|
37
|
+
end
|
38
|
+
|
39
|
+
def ex_flux
|
40
|
+
Evostream::Service.uri_out + '/' + name_settings['groupName'] + '/' +
|
41
|
+
@request['name'] + '/' + name_settings[name_flux]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# :reek:TooManyConstants
|
4
|
+
|
5
|
+
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
6
|
+
# Define constant to gem.
|
7
|
+
module Evostream
|
8
|
+
# Define version to gem
|
9
|
+
VERSION = '0.1.0'
|
10
|
+
|
11
|
+
# Name to gem
|
12
|
+
GEM_NAME = 'evostream-event'
|
13
|
+
|
14
|
+
# Authors
|
15
|
+
AUTHORS = ['VAILLANT Jeremy'].freeze
|
16
|
+
|
17
|
+
# Emails
|
18
|
+
EMAILS = ['jeremy@dazzl.tv'].freeze
|
19
|
+
|
20
|
+
# Licence
|
21
|
+
LICENSE = 'MIT'
|
22
|
+
|
23
|
+
# Define a summary description to gem
|
24
|
+
SUMMARY = 'EvoStream Event'
|
25
|
+
|
26
|
+
# Define a long description to gem
|
27
|
+
DESCRIPTION = <<-DESC
|
28
|
+
Manage evostream.
|
29
|
+
DESC
|
30
|
+
|
31
|
+
# Define homepage
|
32
|
+
HOMEPAGE = 'https://github.com/dazzl-tv/evostream-event'
|
33
|
+
|
34
|
+
# Define a post install message
|
35
|
+
POST_INSTALL = \
|
36
|
+
"# ====================================================== #\n" \
|
37
|
+
"# Thanks for installing EvoStream-Event ! #\n" \
|
38
|
+
"# #{HOMEPAGE}. #\n" \
|
39
|
+
"# ;;;;;;;;;;;:. #\n" \
|
40
|
+
"# ;;;;;;;;;;;;;;;;;; #\n" \
|
41
|
+
"# ;;;;;;;;;;;:;;;;;;;; #\n" \
|
42
|
+
"# ;;;;;;;;;;` ;;;;;;;; #\n" \
|
43
|
+
"# ;;;;;;;;; :;;;;;;;;. #\n" \
|
44
|
+
"# ;;;;;;;; :::::;;;;; #\n" \
|
45
|
+
"# ;;;;;;, ,;;;;;; #\n" \
|
46
|
+
"# ;;;;; ;;;;;;;; #\n" \
|
47
|
+
"# ;;;;;;;;; ;;;;;;;;, #\n" \
|
48
|
+
"# ;;;;;;;;; `;;;;;;;;; A ZZZZZZZ ZZZZZZZ LL #\n" \
|
49
|
+
"# ;;;;;;;;.:;;;;;;;;;; A A ZZZ ZZZ LL #\n" \
|
50
|
+
"# ;;;;;;;;;;;;;;;;; AAAAA ZZ ZZ LL #\n" \
|
51
|
+
"# ;;;;;;;;;;;;;, A A ZZZZZZZ ZZZZZZZ LLLLLLL #\n" \
|
52
|
+
'# ====================================================== #'
|
53
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# :reek:Attribute
|
4
|
+
|
5
|
+
module Evostream
|
6
|
+
# DSL configuration for this gem
|
7
|
+
class Service
|
8
|
+
mattr_accessor :web_root, :uri_in, :uri_out, :name, :model, :model_id
|
9
|
+
|
10
|
+
def self.configuration(&block)
|
11
|
+
block.call(self)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support'
|
4
|
+
require 'evostream/info'
|
5
|
+
require 'evostream/service'
|
6
|
+
require 'evostream/commands'
|
7
|
+
require 'evostream/events'
|
8
|
+
|
9
|
+
# Primary command to gem
|
10
|
+
module Evostream
|
11
|
+
def self.send_command(cmd)
|
12
|
+
uri = URI.parse(Evostream::Service.uri_in)
|
13
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
14
|
+
command_launch = "/#{cmd}"
|
15
|
+
Evostream.logger "Command : #{command_launch}"
|
16
|
+
http.request(Net::HTTP::Get.new(command_launch))
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.logger(message)
|
20
|
+
Rails.logger.debug "[#{Evostream::GEM_NAME}] #{message}"
|
21
|
+
end
|
22
|
+
|
23
|
+
# Endpoint to gem
|
24
|
+
class Event
|
25
|
+
EVENTS = Evostream::Events::Event.descendants
|
26
|
+
|
27
|
+
def initialize(type, payload)
|
28
|
+
@payload = payload
|
29
|
+
@model = type.sub(/^(\w)/, &:capitalize)
|
30
|
+
end
|
31
|
+
|
32
|
+
def execute_action
|
33
|
+
klass = "Evostream::Events::#{@model}".constantize
|
34
|
+
Evostream.logger "Execute Action : #{klass}"
|
35
|
+
execute_klass(klass) if EVENTS.include?(klass)
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def execute_klass(klass)
|
41
|
+
name_flux = extract_name_flux
|
42
|
+
Evostream.logger "Name Flux : #{name_flux}"
|
43
|
+
case [klass]
|
44
|
+
when [Evostream::Events::OutStreamCreated]
|
45
|
+
klass.new(name_flux, @payload).execute
|
46
|
+
else
|
47
|
+
# when [Evostream::Events::InStreamCreated]
|
48
|
+
# when [Evostream::Events::InStreamClosed]
|
49
|
+
klass.new(name_flux).execute
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def extract_name_flux
|
54
|
+
@payload[:name].gsub(Evostream::Service.name, '')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
metadata
ADDED
@@ -0,0 +1,291 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: evostream-event
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0.pre.6
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- VAILLANT Jeremy
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-03-13 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.13'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.13'
|
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
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.5'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 3.5.0
|
51
|
+
type: :development
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '3.5'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 3.5.0
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: overcommit
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 0.34.2
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 0.34.2
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rubocop
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 0.42.0
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 0.42.0
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: yard
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 0.9.5
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 0.9.5
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: reek
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '4.2'
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 4.2.4
|
113
|
+
type: :development
|
114
|
+
prerelease: false
|
115
|
+
version_requirements: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '4.2'
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 4.2.4
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
name: fuubar
|
125
|
+
requirement: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - "~>"
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '2.2'
|
130
|
+
type: :development
|
131
|
+
prerelease: false
|
132
|
+
version_requirements: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - "~>"
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '2.2'
|
137
|
+
- !ruby/object:Gem::Dependency
|
138
|
+
name: pry-byebug
|
139
|
+
requirement: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - "~>"
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '3.4'
|
144
|
+
type: :development
|
145
|
+
prerelease: false
|
146
|
+
version_requirements: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - "~>"
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '3.4'
|
151
|
+
- !ruby/object:Gem::Dependency
|
152
|
+
name: travis
|
153
|
+
requirement: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - "~>"
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '1.8'
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: 1.8.4
|
161
|
+
type: :development
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - "~>"
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '1.8'
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: 1.8.4
|
171
|
+
- !ruby/object:Gem::Dependency
|
172
|
+
name: rails
|
173
|
+
requirement: !ruby/object:Gem::Requirement
|
174
|
+
requirements:
|
175
|
+
- - "~>"
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '4.2'
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 4.2.8
|
181
|
+
type: :development
|
182
|
+
prerelease: false
|
183
|
+
version_requirements: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '4.2'
|
188
|
+
- - ">="
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: 4.2.8
|
191
|
+
- !ruby/object:Gem::Dependency
|
192
|
+
name: faker
|
193
|
+
requirement: !ruby/object:Gem::Requirement
|
194
|
+
requirements:
|
195
|
+
- - "~>"
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: '1.7'
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: 1.7.3
|
201
|
+
type: :development
|
202
|
+
prerelease: false
|
203
|
+
version_requirements: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - "~>"
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: '1.7'
|
208
|
+
- - ">="
|
209
|
+
- !ruby/object:Gem::Version
|
210
|
+
version: 1.7.3
|
211
|
+
- !ruby/object:Gem::Dependency
|
212
|
+
name: activesupport
|
213
|
+
requirement: !ruby/object:Gem::Requirement
|
214
|
+
requirements:
|
215
|
+
- - "~>"
|
216
|
+
- !ruby/object:Gem::Version
|
217
|
+
version: '4.2'
|
218
|
+
type: :runtime
|
219
|
+
prerelease: false
|
220
|
+
version_requirements: !ruby/object:Gem::Requirement
|
221
|
+
requirements:
|
222
|
+
- - "~>"
|
223
|
+
- !ruby/object:Gem::Version
|
224
|
+
version: '4.2'
|
225
|
+
description: 'Manage evostream.
|
226
|
+
|
227
|
+
'
|
228
|
+
email:
|
229
|
+
- jeremy@dazzl.tv
|
230
|
+
executables: []
|
231
|
+
extensions: []
|
232
|
+
extra_rdoc_files: []
|
233
|
+
files:
|
234
|
+
- Gemfile
|
235
|
+
- LICENSE
|
236
|
+
- README.md
|
237
|
+
- Rakefile
|
238
|
+
- lib/evostream/commands.rb
|
239
|
+
- lib/evostream/commands/create.rb
|
240
|
+
- lib/evostream/commands/create/dash.rb
|
241
|
+
- lib/evostream/commands/create/hls.rb
|
242
|
+
- lib/evostream/commands/destroy.rb
|
243
|
+
- lib/evostream/events.rb
|
244
|
+
- lib/evostream/events/in_stream_closed.rb
|
245
|
+
- lib/evostream/events/in_stream_created.rb
|
246
|
+
- lib/evostream/events/out_stream_created.rb
|
247
|
+
- lib/evostream/info.rb
|
248
|
+
- lib/evostream/service.rb
|
249
|
+
- lib/evostream_event.rb
|
250
|
+
homepage: https://github.com/dazzl-tv/evostream-event
|
251
|
+
licenses:
|
252
|
+
- MIT
|
253
|
+
metadata: {}
|
254
|
+
post_install_message: |-
|
255
|
+
# ====================================================== #
|
256
|
+
# Thanks for installing EvoStream-Event ! #
|
257
|
+
# https://github.com/dazzl-tv/evostream-event. #
|
258
|
+
# ;;;;;;;;;;;:. #
|
259
|
+
# ;;;;;;;;;;;;;;;;;; #
|
260
|
+
# ;;;;;;;;;;;:;;;;;;;; #
|
261
|
+
# ;;;;;;;;;;` ;;;;;;;; #
|
262
|
+
# ;;;;;;;;; :;;;;;;;;. #
|
263
|
+
# ;;;;;;;; :::::;;;;; #
|
264
|
+
# ;;;;;;, ,;;;;;; #
|
265
|
+
# ;;;;; ;;;;;;;; #
|
266
|
+
# ;;;;;;;;; ;;;;;;;;, #
|
267
|
+
# ;;;;;;;;; `;;;;;;;;; A ZZZZZZZ ZZZZZZZ LL #
|
268
|
+
# ;;;;;;;;.:;;;;;;;;;; A A ZZZ ZZZ LL #
|
269
|
+
# ;;;;;;;;;;;;;;;;; AAAAA ZZ ZZ LL #
|
270
|
+
# ;;;;;;;;;;;;;, A A ZZZZZZZ ZZZZZZZ LLLLLLL #
|
271
|
+
# ====================================================== #
|
272
|
+
rdoc_options: []
|
273
|
+
require_paths:
|
274
|
+
- lib
|
275
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
276
|
+
requirements:
|
277
|
+
- - ">="
|
278
|
+
- !ruby/object:Gem::Version
|
279
|
+
version: '0'
|
280
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
281
|
+
requirements:
|
282
|
+
- - ">"
|
283
|
+
- !ruby/object:Gem::Version
|
284
|
+
version: 1.3.1
|
285
|
+
requirements: []
|
286
|
+
rubyforge_project:
|
287
|
+
rubygems_version: 2.5.1
|
288
|
+
signing_key:
|
289
|
+
specification_version: 4
|
290
|
+
summary: EvoStream Event
|
291
|
+
test_files: []
|