tlapse 0.6.3 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/tlapse/cli/alpha.rb +56 -0
- data/lib/tlapse/cli/cli.rb +2 -2
- data/lib/tlapse/version.rb +1 -1
- data/lib/tlapse/video.rb +8 -3
- data/tlapse.gemspec +1 -1
- metadata +6 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b430e71598aedbebbca7591db61fafc406df196a4f6e052156f45acd570a9775
|
4
|
+
data.tar.gz: 57d8a73fc5d746bed749f51107d7880ea1bdafd67e2175285fa4ad61abc20404
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbe3f73147112a94f2384826d463f0f0b169a6517251919fffc544a0e8b479fe892a154e59e68cdffbf733464c65318a6473bec3f869aad29f8c4918b3b580df
|
7
|
+
data.tar.gz: 241a51427ccd092e73cadbe84b5e6416118a80f3baf2e0cba02213d79a42d59e926c09f2744d020ef5ffb2853ba993c2f001938db3a0647afa1f4039f8eaee4d
|
data/README.md
CHANGED
@@ -23,7 +23,7 @@ Automated time lapse photography using gphoto2.
|
|
23
23
|
|
24
24
|
Find better documentation by running `tlapse help` or `tlapse help SUBCOMMAND`
|
25
25
|
|
26
|
-
* `tlapse
|
26
|
+
* `tlapse capture_single` - Capture an image using the tethered camera
|
27
27
|
* `tlapse until_sunset` - Generate a gphoto2 command which captures images until sunset
|
28
28
|
|
29
29
|
## API
|
data/lib/tlapse/cli/alpha.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "thor"
|
2
2
|
require "rainbow"
|
3
|
+
require "fileutils"
|
3
4
|
|
4
5
|
module Tlapse::CLI
|
5
6
|
class Alpha < Thor
|
@@ -58,5 +59,60 @@ module Tlapse::CLI
|
|
58
59
|
def organize
|
59
60
|
Tlapse::Util.organize! dry_run: options[:dry_run]
|
60
61
|
end
|
62
|
+
|
63
|
+
desc "capture", "Capture a series of timelapse photos"
|
64
|
+
option :interval,
|
65
|
+
desc: "The interval (in minutes) at which pictures will be taken",
|
66
|
+
type: :numeric,
|
67
|
+
default: 5,
|
68
|
+
aliases: %i(i)
|
69
|
+
option :until,
|
70
|
+
desc: %(Time to stop capturing. Can use special "sunset" or "sunrise"),
|
71
|
+
type: :string,
|
72
|
+
default: "sunset"
|
73
|
+
option :compile,
|
74
|
+
desc: "When done capturing, compile photos into a video",
|
75
|
+
type: :boolean,
|
76
|
+
default: false
|
77
|
+
option :compile_out,
|
78
|
+
desc: "Specify the name for the generated video file",
|
79
|
+
type: :string,
|
80
|
+
default: "out.mkv"
|
81
|
+
def capture
|
82
|
+
dirname = Time.now.strftime(Tlapse::Capture.capture_dirname)
|
83
|
+
FileUtils.mkdir_p dirname
|
84
|
+
Dir.chdir dirname
|
85
|
+
|
86
|
+
cmd = Tlapse::Capture.timelapse_command(
|
87
|
+
to: parse_time(options[:until]),
|
88
|
+
interval: options[:interval].minutes
|
89
|
+
)
|
90
|
+
|
91
|
+
if options[:compile]
|
92
|
+
video = Tlapse::Video.new(
|
93
|
+
outfile: options[:compile_out]
|
94
|
+
)
|
95
|
+
|
96
|
+
if video.outfile_exists?
|
97
|
+
Tlapse::Logger.error! "The file #{video.outfile} already exists in" \
|
98
|
+
" the directory #{dirname}. Please delete it or use the" \
|
99
|
+
" --compile-out option to specify a different filename."
|
100
|
+
end
|
101
|
+
|
102
|
+
cmd += " && #{video.create_command}"
|
103
|
+
end
|
104
|
+
|
105
|
+
exec cmd
|
106
|
+
end
|
107
|
+
|
108
|
+
no_commands do
|
109
|
+
def parse_time(time)
|
110
|
+
case time
|
111
|
+
when "sunset" then Tlapse::SolarEvent.sunset
|
112
|
+
when "sunrise" then Tlapse::SolarEvent.sunrise
|
113
|
+
else Time.parse(time)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
61
117
|
end
|
62
118
|
end
|
data/lib/tlapse/cli/cli.rb
CHANGED
@@ -15,8 +15,8 @@ module Tlapse::CLI
|
|
15
15
|
puts Tlapse::VERSION
|
16
16
|
end
|
17
17
|
|
18
|
-
desc "
|
19
|
-
def
|
18
|
+
desc "capture_single", "Capture a single photo, saving it to the current directory"
|
19
|
+
def capture_single
|
20
20
|
Tlapse::Capture.capture_single
|
21
21
|
end
|
22
22
|
|
data/lib/tlapse/version.rb
CHANGED
data/lib/tlapse/video.rb
CHANGED
@@ -9,7 +9,7 @@ module Tlapse
|
|
9
9
|
@outfile = opts.fetch :out, "out.mkv"
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
12
|
+
def create_command
|
13
13
|
command = "ffmpeg"
|
14
14
|
command += " -pattern_type glob"
|
15
15
|
command += " -i '*.jpg'"
|
@@ -17,8 +17,13 @@ module Tlapse
|
|
17
17
|
command += " -r #{@framerate}"
|
18
18
|
command += " -vcodec #{@codec}"
|
19
19
|
command += " #{@outfile}"
|
20
|
-
|
21
|
-
|
20
|
+
command
|
21
|
+
end
|
22
|
+
|
23
|
+
def create!
|
24
|
+
cmd = create_command
|
25
|
+
puts cmd
|
26
|
+
exec cmd
|
22
27
|
end
|
23
28
|
|
24
29
|
def outfile_exists?
|
data/tlapse.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "byebug", "~> 8.2"
|
25
25
|
spec.add_development_dependency "timecop", "~> 0.8"
|
26
26
|
|
27
|
-
spec.add_dependency "activesupport", "
|
27
|
+
spec.add_dependency "activesupport", "~> 5"
|
28
28
|
spec.add_dependency "RubySunrise", "~> 0.3"
|
29
29
|
spec.add_dependency "thor", "~> 0.20"
|
30
30
|
spec.add_dependency "rainbow", "~> 3"
|
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.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Toniazzo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -84,22 +84,16 @@ dependencies:
|
|
84
84
|
name: activesupport
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 5.0.0.beta3
|
90
|
-
- - "<"
|
87
|
+
- - "~>"
|
91
88
|
- !ruby/object:Gem::Version
|
92
|
-
version: '5
|
89
|
+
version: '5'
|
93
90
|
type: :runtime
|
94
91
|
prerelease: false
|
95
92
|
version_requirements: !ruby/object:Gem::Requirement
|
96
93
|
requirements:
|
97
|
-
- - "
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: 5.0.0.beta3
|
100
|
-
- - "<"
|
94
|
+
- - "~>"
|
101
95
|
- !ruby/object:Gem::Version
|
102
|
-
version: '5
|
96
|
+
version: '5'
|
103
97
|
- !ruby/object:Gem::Dependency
|
104
98
|
name: RubySunrise
|
105
99
|
requirement: !ruby/object:Gem::Requirement
|