tlapse 0.4.1 → 0.5.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: 095c172778da6f3d7aaf66156127eeac47d0413bbcf888b8288ed2d670024676
4
- data.tar.gz: 268453b146950a3bd23935fd1f5f777fb0f3934ea8b1893139f5146de2fca496
3
+ metadata.gz: 58a891c9f90caa86f4b404d405452349e0e87d0dd75d5a8fc886d5550aedda78
4
+ data.tar.gz: aebf38a3ea2df2077e05021c17a6adc6bf932f56aca19e9c62ec2712e00d8e56
5
5
  SHA512:
6
- metadata.gz: f83789b0cd13f58a8be385a8d10d920e5912154d13b699dc1902ba80e5e4e44ea800936b4ccc09e075d785f8f5bee5bf6985afc0b32233503617766f47a26fe7
7
- data.tar.gz: 97586ce4a34be667779a17333df117139575ed557c591de9d3f9528f01e73cb3cc26826fa18e88908c31ea0d25932e2460375714606c6b1d92c075d787981b95
6
+ metadata.gz: 170575a9b7dc5e242b808d49495295457ad7838532f81ea561a9dfb6c94cc9659c1f3b1b9552e69feaf2957b5295fc0b50b987a600a7f0f8cd1d71cfe021bacb
7
+ data.tar.gz: 9c23386e90c8f3ac2e9ebc87415faa36a74d6448c78e56d301cd1e261fb33613ccf26a3f1d67b11c82cf539e51e148c2d5e8fe1969571d150d1f2e71a70aec18
data/exe/tlapse CHANGED
@@ -1,91 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "gli"
4
- require "fileutils"
5
-
6
- require_relative "../lib/tlapse"
7
-
8
- include GLI::App
9
- include Tlapse
10
-
11
- program_desc "Automated time lapse photography via gphoto2"
12
- version Tlapse::VERSION
13
-
14
- desc "Determine whether you are ready to start capturing"
15
- command :doctor do |c|
16
- c.action do |global_options, options, args|
17
- doctor
18
- end
19
- end
20
-
21
- desc "Capture a single photo, saving it to the current directory"
22
- command :capture do |c|
23
- c.action do |global_options, options, args|
24
- Tlapse::Capture.capture_single
25
- end
26
- end
27
-
28
- desc "Start a drb server via which photo capturing may be performed remotely"
29
- command :serve do |c|
30
- c.flag :h, :host,
31
- desc: "The hostname on which the server is run",
32
- default_value: `hostname`.strip,
33
- arg_name: "host"
34
-
35
- c.flag :p, :port,
36
- desc: "The port on which the server is run",
37
- default_value: 9000,
38
- arg_name: "port"
39
-
40
- c.action do |global_options, options, args|
41
- server = Tlapse::Server.new(
42
- host: options[:host],
43
- port: options[:port]
44
- )
45
- puts "Serving on #{server.full_host}"
46
- server.serve
47
- end
48
- end
49
-
50
-
51
- desc "Use ffmpeg to combine all .jpg files in the current directory"
52
- command :compile do |c|
53
- c.switch :f, :force,
54
- desc: "Force overwrite existing output files",
55
- negatable: false
56
-
57
- c.flag :o, :out,
58
- desc: "The desired output filename",
59
- default_value: "out.mkv",
60
- arg_name: "outfile"
61
-
62
- c.action do |global_options, options, args|
63
- video = Video.new options
64
-
65
- if video.outfile_exists?
66
- if options[:force]
67
- FileUtils.rm video.outfile
68
- puts "Removed file #{video.outfile}"
69
- else
70
- raise "#{video.outfile} exists. Use -f to overwrite or " \
71
- "-o to specify a different output file."
72
- end
73
- end
74
- video.create!
75
- end
76
- end
77
-
78
- desc "Generate a gphoto2 command which captures photos from now until the sun sets (useful for cronjobs)"
79
- command :until_sunset do |c|
80
- c.flag :i, :interval,
81
- desc: "The interval (in minutes) at which pictures will be taken",
82
- default_value: "5"
83
-
84
- c.action do |global_options, options, args|
85
- interval = options[:interval].to_i.minutes
86
- puts Tlapse::Capture.timelapse_command_while_sun_is_up(interval: interval)
87
- end
88
- end
89
-
90
- exit run(ARGV)
3
+ require "tlapse/cli/cli"
91
4
 
5
+ Tlapse::CLI::CLI.start(ARGV)
@@ -0,0 +1,52 @@
1
+ require "thor"
2
+
3
+ module Tlapse::CLI
4
+ class Alpha < Thor
5
+ desc "serve", "Start a drb server via which photo capturing may be performed remotely"
6
+ option :host,
7
+ desc: "The hostname on which the server is run",
8
+ type: :string,
9
+ default: "localhost",
10
+ aliases: %i(H)
11
+ option :port,
12
+ desc: "The port on which the server is run",
13
+ type: :numeric,
14
+ default: 9000,
15
+ aliases: %i(p)
16
+ def serve
17
+ server = Tlapse::Server.new(
18
+ host: options[:host],
19
+ port: options[:port]
20
+ )
21
+ puts "Serving on #{server.full_host}"
22
+ server.serve
23
+ end
24
+
25
+ desc "compile", "Use ffmpeg to combine all .jpg files in the current directory"
26
+ option :force,
27
+ desc: "Force overwrite any existing output files",
28
+ type: :boolean,
29
+ default: false,
30
+ aliases: %i(f)
31
+ option :out,
32
+ desc: "The desired output filename",
33
+ type: :string,
34
+ default: "out.mkv",
35
+ aliases: %i(o)
36
+ def compile
37
+ video = Video.new out: options[:out]
38
+
39
+ if video.outfile_exists?
40
+ if options[:force]
41
+ FileUtils.rm video.outfile
42
+ puts "Removed file #{video.outfile}"
43
+ else
44
+ raise "#{video.outfile} exists. Use -f to overwrite or " \
45
+ "-o to specify a different output file."
46
+ end
47
+ end
48
+
49
+ video.create!
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,37 @@
1
+ require "thor"
2
+ require "active_support/core_ext/numeric/time.rb"
3
+ require "tlapse"
4
+ require "tlapse/cli/alpha"
5
+
6
+ module Tlapse::CLI
7
+ class CLI < Thor
8
+ desc "doctor", "Perform checks to see if you're ready to tlapse"
9
+ def doctor
10
+ Tlapse::Doctor.doctor
11
+ end
12
+
13
+ desc "version", "Print the version number and exit"
14
+ def version
15
+ puts Tlapse::VERSION
16
+ end
17
+
18
+ desc "capture", "Capture a single photo, saving it to the current directory"
19
+ def capture
20
+ Tlapse::Capture.capture_single
21
+ end
22
+
23
+ desc "until_sunset", "Generate a gphoto2 command to capture photos from now until the sun sets (useful for cronjobs)"
24
+ option :interval,
25
+ desc: "The interval (in minutes) at which picturs will be taken",
26
+ type: :numeric,
27
+ default: 5,
28
+ aliases: %i(i)
29
+ def until_sunset
30
+ interval = options[:interval].minutes
31
+ puts Tlapse::Capture.timelapse_command_while_sun_is_up(interval: interval)
32
+ end
33
+
34
+ desc "alpha", "Get early access to in-development (and likely unstable) commands"
35
+ subcommand "alpha", Tlapse::CLI::Alpha
36
+ end
37
+ end
@@ -1,3 +1,3 @@
1
1
  module Tlapse
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  end
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 "gli", "~> 2.13"
28
27
  spec.add_dependency "activesupport", ">= 5.0.0.beta3", "< 5.1"
29
28
  spec.add_dependency "RubySunrise", "~> 0.3"
29
+ spec.add_dependency "thor", "~> 0.20"
30
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tlapse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Toniazzo
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.8'
83
- - !ruby/object:Gem::Dependency
84
- name: gli
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '2.13'
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '2.13'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: activesupport
99
85
  requirement: !ruby/object:Gem::Requirement
@@ -128,6 +114,20 @@ dependencies:
128
114
  - - "~>"
129
115
  - !ruby/object:Gem::Version
130
116
  version: '0.3'
117
+ - !ruby/object:Gem::Dependency
118
+ name: thor
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '0.20'
124
+ type: :runtime
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '0.20'
131
131
  description:
132
132
  email:
133
133
  - jutonz42@gmail.com
@@ -150,6 +150,8 @@ files:
150
150
  - exe/tlapse
151
151
  - lib/tlapse.rb
152
152
  - lib/tlapse/capture.rb
153
+ - lib/tlapse/cli/alpha.rb
154
+ - lib/tlapse/cli/cli.rb
153
155
  - lib/tlapse/doctor.rb
154
156
  - lib/tlapse/server.rb
155
157
  - lib/tlapse/solar_event.rb