class Tlapse::CLI::Alpha
Public Instance Methods
capture()
click to toggle source
# File lib/tlapse/cli/alpha.rb, line 81 def capture dirname = Time.now.strftime(Tlapse::Capture.capture_dirname) FileUtils.mkdir_p dirname Dir.chdir dirname cmd = Tlapse::Capture.timelapse_command( to: parse_time(options[:until]), interval: options[:interval].minutes ) if options[:compile] video = Tlapse::Video.new( outfile: options[:compile_out] ) if video.outfile_exists? Tlapse::Logger.error! "The file #{video.outfile} already exists in" \ " the directory #{dirname}. Please delete it or use the" \ " --compile-out option to specify a different filename." end cmd += " && #{video.create_command}" end exec cmd end
compile()
click to toggle source
# File lib/tlapse/cli/alpha.rb, line 38 def compile video = Tlapse::Video.new out: options[:out] if video.outfile_exists? if options[:force] FileUtils.rm video.outfile puts "Removed file #{video.outfile}" else Tlapse::Logger.error! "#{video.outfile} exists. Use -f to overwrite or " \ "-o to specify a different output file." end end video.create! end
organize()
click to toggle source
# File lib/tlapse/cli/alpha.rb, line 59 def organize Tlapse::Util.organize! dry_run: options[:dry_run] end
parse_time(time)
click to toggle source
# File lib/tlapse/cli/alpha.rb, line 109 def parse_time(time) case time when "sunset" then Tlapse::SolarEvent.sunset when "sunrise" then Tlapse::SolarEvent.sunrise else Time.parse(time) end end
serve()
click to toggle source
# File lib/tlapse/cli/alpha.rb, line 18 def serve server = Tlapse::Server.new( host: options[:host], port: options[:port] ) puts "Serving on #{server.full_host}" server.serve end