Sha256: a61391e756f2a6681041641b042f2b8f701b23e7213b4b58a866a1e2cf87e061

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

#!/usr/bin/env ruby

require 'optparse'
require 'methadone'
require 'construct'
require 'electric_eye.rb'
include ElectricEye

class App
  include Methadone::Main
  include Methadone::CLILogging

  main do |camera, url| # Add args you want: |like,so|
    @configEye = ConfigEye.new     # Initialize config
    @record = Record.new(@configEye) # Initialize record and pass in our config
    
    if options[:a]              # Add camera
      @configEye.add_camera(camera,url) 
    elsif options[:r]           # Remove camera
      @configEye.remove_camera(camera)
    elsif options[:l]           # List cameras
      @configEye.list_cameras
    elsif options[:d]           # Set duration
      @configEye.set_duration(options[:duration]) 
    elsif options[:p]           # Set path
      @configEye.set_path(options[:path]) 
    elsif options[:s]           # Start recording
      @record.start
    elsif options[:k]           # Stop recordings
      @record.stop
    end
    
    exit 0
  end


  
  description "Network Video Recorder"

  # Accept flags via:
  on("-a", "--add", "Add a camera") 
  on("-r", "--remove", "Remove a camera")
  on("-l", "--list", "List cameras")
  on("-d", "--duration SECONDS", "Set recording duration in seconds")
  on("-p", "--path DIR", "Set recordings path")
  on("-s", "--start", "Start recordings")
  on("-k", "--stop", "Stop recordings")

  # Arguments
  arg :camera, :optional
  arg :url, :optional

  version ElectricEye::VERSION
  use_log_level_option :toggle_debug_on_signal => 'USR1'

  go!
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
electric_eye-0.0.3 bin/electric_eye
electric_eye-0.0.2 bin/electric_eye
electric_eye-0.0.1 bin/electric_eye