Class: VideoConverter::LiveSegmenter

Inherits:
Object
  • Object
show all
Defined in:
lib/video_converter/live_segmenter.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.chunks_patternObject

Returns the value of attribute chunks_pattern.



6
7
8
# File 'lib/video_converter/live_segmenter.rb', line 6

def chunks_pattern
  @chunks_pattern
end

.commandObject

Returns the value of attribute command.



6
7
8
# File 'lib/video_converter/live_segmenter.rb', line 6

def command
  @command
end

Class Method Details

.run(outputs) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/video_converter/live_segmenter.rb', line 12

def self.run(outputs)
  success = true
  threads = []
  p = Proc.new do |output|
    Command.new(command, prepare_params(output)).execute
  end
  outputs.select { |output| output.type != 'playlist' }.each do |output|
    if VideoConverter.paral
      threads << Thread.new { success &&= p.call(output) }
    else
      success &&= p.call(output)
    end
  end
  success &&= gen_group_playlist(outputs.detect { |output| output.type == 'playlist' })
  threads.each { |t| t.join } if VideoConverter.paral
  success
end