Sha256: f44db10b8af2349c205dce05858293d143a353624555c094c9115e12c8f69da8

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

#!/usr/bin/env ruby

require "gli"
require "fileutils"

require_relative "../lib/tlapse"

include GLI::App
include Tlapse

program_desc "Automated time lapse photography via gphoto2"
version Tlapse::VERSION

desc "Determine whether you are ready to start capturing"
command :doctor do |c|
  c.action do |global_options, options, args|
    doctor
  end
end

desc "Capture a single photo, saving it to the current directory"
command :single do |c|
  c.action do |global_options, options, args|
    capture_single
  end
end


desc "Use ffmpeg to combine all .jpg files in the current directory"
command :compile do |c|

  c.switch :f, :force,
    desc:     "Force overwrite existing output files",
    negatable: false

  c.flag :o, :out,
    desc:          "The desired output filename",
    default_value: "out.mkv",
    arg_name:      "outfile"

  c.action do |global_options, options, args|
    video = Video.new options

    if video.outfile_exists?
      if options[:force]
        FileUtils.rm video.outfile
        puts "Removed file #{video.outfile}"
      else
        raise "#{video.outfile} exists. Use -f to overwrite or " \
          "-o to specify a different output file."
      end
    end
    video.create!
  end
end

exit run(ARGV)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tlapse-0.1.2 bin/tlapse