class ActiveVlc::CLI::Pipe

Public Instance Methods

dump(path, *inputs) click to toggle source
# File lib/activevlc/cli/pipe.rb, line 27
def dump(path, *inputs)
  _load_pipe(path, *inputs) { |pipe| pipe.dump }
end
exec(path, *inputs) click to toggle source
# File lib/activevlc/cli/pipe.rb, line 14
def exec(path, *inputs)
  _load_pipe(path, *inputs) do |pipe|
    fragment = pipe.fragment
    if options[:cmd]
      Kernel.exec "vlc -I dummy -vvv #{fragment} vlc://quit"
    else
      ActiveVlc::Runner.new(pipe).run
    end
  end

end
fragment(path, *inputs) click to toggle source
# File lib/activevlc/cli/pipe.rb, line 8
def fragment(path, *inputs)
  _load_pipe(path, *inputs) { |pipe| puts pipe.fragment }
end
test() click to toggle source
# File lib/activevlc/cli/pipe.rb, line 33
def test
  puts options.inspect
end

Protected Instance Methods

_load_pipe(path, *inputs) { |pipe| ... } click to toggle source
# File lib/activevlc/cli/pipe.rb, line 38
def _load_pipe(path, *inputs)
  if File.readable?(path)
    begin
      pipe = eval(File.read(path))
      pipe.input << inputs
      pipe.params(options[:params]) if options[:params]
      yield pipe if block_given?
    rescue
      puts "Error while parsing pipe file: #{$!}"
      puts $!.backtrace.join("\n")
      exit 43
    end
  else
    puts "Error: file [#{path}] doesn't exist or reading permission denied."
    exit 42
  end
end