Class: ActiveVlc::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/activevlc/runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(pipeline, *args) ⇒ Runner

Returns a new instance of Runner.



9
10
11
12
# File 'lib/activevlc/runner.rb', line 9

def initialize(pipeline, *args)
  @pipeline = pipeline
  @args = args
end

Instance Method Details

#run(opts = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/activevlc/runner.rb', line 19

def run(opts = {})
  opts = {type: :process}
  if opts[:type] == :form and Process.respond_to? :fork
    pid = Process.fork { _run; exit 0 }
    Process.wait pid
  elsif opts[:type] == :system
    fragment = @pipeline.fragment
    vlc_path = opts[:vlc_path]
    vlc_path ||= 'vlc'
    `#{vlc_path} #{@args.join ' '} #{fragment} vlc://quit`
  elsif opts[:type] == :process
    _run
  end
end

#stop_runner!Object

Nobody can escape his faith.



15
16
17
# File 'lib/activevlc/runner.rb', line 15

def stop_runner!
  @running = false
end