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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95f3adbb41bc2f796a89682bce9c9acc2f0ff157b64f76ecaab982bc8d45410c
4
- data.tar.gz: f6a341d65c081eea20ea5c6308f5c480cfe30b9a479dfc8ba5393c4a23e63c78
3
+ metadata.gz: b430e71598aedbebbca7591db61fafc406df196a4f6e052156f45acd570a9775
4
+ data.tar.gz: 57d8a73fc5d746bed749f51107d7880ea1bdafd67e2175285fa4ad61abc20404
5
5
  SHA512:
6
- metadata.gz: 2718ee2c921fcf2aed699c76244989b50296f39fe187d057a7243c4933ad44c0e5295fef503749f4da194e3180f6bdf56d3b260de93d3825a97844d74be4c715
7
- data.tar.gz: 633b08728398c25eb02c0e595b09ffcbafaff222beccc7d6abef730f0d92ab325a4c01ea542aa3506a5c75f9e9acb234b84f2c85df819261e703cd8606fba8f8
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 capture` - Capture an image using the tethered camera
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
@@ -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
@@ -15,8 +15,8 @@ module Tlapse::CLI
15
15
  puts Tlapse::VERSION
16
16
  end
17
17
 
18
- desc "capture", "Capture a single photo, saving it to the current directory"
19
- def capture
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
 
@@ -1,3 +1,3 @@
1
1
  module Tlapse
2
- VERSION = "0.6.3"
2
+ VERSION = "0.7.0"
3
3
  end
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 create!
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
- puts command
21
- exec command
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", ">= 5.0.0.beta3", "< 5.1"
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.6.3
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-22 00:00:00.000000000 Z
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.1'
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.1'
96
+ version: '5'
103
97
  - !ruby/object:Gem::Dependency
104
98
  name: RubySunrise
105
99
  requirement: !ruby/object:Gem::Requirement