Class: ActiveVlc::Cli
- Inherits:
-
Thor
- Object
- Thor
- ActiveVlc::Cli
- Defined in:
- lib/activevlc/cli.rb
Instance Method Summary collapse
- #dump(path) ⇒ Object
- #exec(path, *inputs) ⇒ Object
- #fragment(path) ⇒ Object
- #run(path, *inputs) ⇒ Object
- #version ⇒ Object
Instance Method Details
#dump(path) ⇒ Object
83 84 85 86 87 88 89 90 |
# File 'lib/activevlc/cli.rb', line 83 def dump(path) if File.readable?(path) puts eval(File.read(path)).dump else puts "Error: file [#{path}] doesn't exist or reading permission denied." exit 42 end end |
#exec(path, *inputs) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/activevlc/cli.rb', line 47 def exec(path, *inputs) if File.readable?(path) begin pipe = ActiveVlc::parse(path) pipe.inputs << inputs fragment = pipe.fragment rescue puts "Error while parsing pipe file" exit 43 end Kernel.exec "cvlc -vvv --play-and-exit #{fragment}" else puts "Error: file [#{path}] doesn't exist or reading permission denied." end exit $?.exitstatus end |
#fragment(path) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/activevlc/cli.rb', line 36 def fragment(path) if File.readable?(path) pipe = eval(File.read(path)) puts pipe.fragment else puts "Error: file [#{path}] doesn't exist or reading permission denied." exit 42 end end |
#run(path, *inputs) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/activevlc/cli.rb', line 65 def run(path, *inputs) if File.readable?(path) begin pipe = ActiveVlc::parse(path) pipe.inputs << inputs fragment = pipe.fragment rescue puts "Error while parsing pipe file" exit 43 end ActiveVlc::Runner.new(pipe).run else puts "Error: file [#{path}] doesn't exist or reading permission denied." end exit 0 end |
#version ⇒ Object
28 29 30 |
# File 'lib/activevlc/cli.rb', line 28 def version puts "ActiveVlc version #{ActiveVlc::VERSION}" end |