tlapse 0.0.6 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/tlapse +32 -2
- data/lib/tlapse/capture.rb +1 -2
- data/lib/tlapse/doctor.rb +24 -4
- data/lib/tlapse/version.rb +1 -1
- data/lib/tlapse/video.rb +32 -0
- data/lib/tlapse.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e3dade67d2c7f9af917ccf9b982edf95ded5632
|
4
|
+
data.tar.gz: 601892decfc0671d8747d5d365c0ef97d5744666
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3413e6f93ea1ba1119534df0184de5fe23b80a5ac31f4576e78ddb0155d6d2fe5efa667498c46a3bf36995123e097eb6183778d7ca85549e4aecf5ed6b1c9c9
|
7
|
+
data.tar.gz: e3275c1753c619db557cee7bf2722ff7ea9d0461849ac4124c1600b11021533e186087ee761fb2692c471f1ac902c62a8598aa3993f060bae49c0a79cd6c9b99
|
data/bin/tlapse
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require "gli"
|
4
|
+
require "fileutils"
|
4
5
|
require "byebug"
|
5
6
|
|
6
7
|
require_relative "../lib/tlapse"
|
@@ -13,17 +14,46 @@ version Tlapse::VERSION
|
|
13
14
|
|
14
15
|
desc "Determine whether you are ready to start capturing"
|
15
16
|
command :doctor do |c|
|
16
|
-
c.action do |global_options,options,args|
|
17
|
+
c.action do |global_options, options, args|
|
17
18
|
doctor
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
21
22
|
desc "Capture a single photo, saving it to the current directory"
|
22
23
|
command :single do |c|
|
23
|
-
c.action do |global_options,options,args|
|
24
|
+
c.action do |global_options, options, args|
|
24
25
|
capture_single
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
29
|
+
|
30
|
+
desc "Use ffmpeg to combine all .jpg files in the current directory"
|
31
|
+
command :compile do |c|
|
32
|
+
|
33
|
+
c.switch :f, :force,
|
34
|
+
desc: "Force overwrite existing output files",
|
35
|
+
negatable: false
|
36
|
+
|
37
|
+
c.flag :o, :out,
|
38
|
+
desc: "The desired output filename",
|
39
|
+
default_value: "out.mkv",
|
40
|
+
arg_name: "outfile"
|
41
|
+
|
42
|
+
c.action do |global_options, options, args|
|
43
|
+
video = Video.new options
|
44
|
+
|
45
|
+
if video.outfile_exists?
|
46
|
+
if options[:force]
|
47
|
+
FileUtils.rm video.outfile
|
48
|
+
puts "Removed file #{video.outfile}"
|
49
|
+
else
|
50
|
+
raise "#{video.outfile} exists. Use -f to overwrite or " \
|
51
|
+
"-o to specify a different output file."
|
52
|
+
end
|
53
|
+
end
|
54
|
+
video.create!
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
28
58
|
exit run(ARGV)
|
29
59
|
|
data/lib/tlapse/capture.rb
CHANGED
data/lib/tlapse/doctor.rb
CHANGED
@@ -2,16 +2,36 @@ module Tlapse
|
|
2
2
|
module Doctor
|
3
3
|
def doctor
|
4
4
|
print "Checking gphoto2..."
|
5
|
-
|
6
|
-
raise "Could not find gphoto2 :("
|
7
|
-
end
|
5
|
+
check_gphoto2!
|
8
6
|
puts "ok!"
|
9
7
|
|
10
8
|
print "Checking camera..."
|
11
|
-
|
9
|
+
check_camera!
|
12
10
|
puts "ok!"
|
13
11
|
|
14
12
|
puts "Looks good!"
|
15
13
|
end
|
14
|
+
|
15
|
+
private ###################################################################
|
16
|
+
|
17
|
+
def check_gphoto2!
|
18
|
+
raise "Could not find gphoto2 :(" if `which gphoto2`.empty?
|
19
|
+
end
|
20
|
+
|
21
|
+
def check_camera!
|
22
|
+
cameras = `gphoto2 --auto-detect`
|
23
|
+
|
24
|
+
# Output looks like this:
|
25
|
+
#
|
26
|
+
# Model Port
|
27
|
+
# --------------------
|
28
|
+
# Camera :usb
|
29
|
+
#
|
30
|
+
# If there is a third line, a camera was detected
|
31
|
+
|
32
|
+
unless cameras.split("\n").length > 2
|
33
|
+
raise "gphoto2 couldn't find a camera :("
|
34
|
+
end
|
35
|
+
end
|
16
36
|
end # Doctor
|
17
37
|
end # Tlapse
|
data/lib/tlapse/version.rb
CHANGED
data/lib/tlapse/video.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
module Tlapse
|
2
|
+
class Video
|
3
|
+
|
4
|
+
attr_accessor *%i(size framerate codec outfile)
|
5
|
+
|
6
|
+
def initialize(opts)
|
7
|
+
@size = opts.fetch :size, "1920x1080"
|
8
|
+
@framerate = opts.fetch :framerate, "60"
|
9
|
+
@codec = opts.fetch :codec, "libx264"
|
10
|
+
@outfile = opts.fetch :out, "out.mkv"
|
11
|
+
end
|
12
|
+
|
13
|
+
def create!
|
14
|
+
command = "ffmpeg"
|
15
|
+
command += " -pattern_type glob"
|
16
|
+
command += " -i '*.jpg'"
|
17
|
+
command += " -s #{@size}"
|
18
|
+
command += " -r #{@framerate}"
|
19
|
+
command += " -vcodec #{@codec}"
|
20
|
+
command += " #{@outfile}"
|
21
|
+
puts command
|
22
|
+
exec command
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# @return whether the output file already exists
|
27
|
+
def outfile_exists?
|
28
|
+
File.exist? @outfile
|
29
|
+
end
|
30
|
+
|
31
|
+
end # Video
|
32
|
+
end # Tlapse
|
data/lib/tlapse.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tlapse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Toniazzo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- lib/tlapse/capture.rb
|
104
104
|
- lib/tlapse/doctor.rb
|
105
105
|
- lib/tlapse/version.rb
|
106
|
+
- lib/tlapse/video.rb
|
106
107
|
- tlapse.gemspec
|
107
108
|
homepage: https://github.com/jutonz/tlapse
|
108
109
|
licenses:
|