lolcommits 0.13.1 → 0.14.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.
Files changed (43) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +1 -0
  3. data/.rubocop_todo.yml +3 -3
  4. data/CHANGELOG.md +18 -7
  5. data/Gemfile +2 -0
  6. data/README.md +101 -76
  7. data/Rakefile +3 -1
  8. data/bin/console +1 -0
  9. data/bin/lolcommits +37 -32
  10. data/config/cucumber.yml +1 -1
  11. data/features/bugs.feature +2 -2
  12. data/features/lolcommits.feature +42 -17
  13. data/features/step_definitions/lolcommits_steps.rb +7 -3
  14. data/lib/lolcommits/animated_gif.rb +77 -0
  15. data/lib/lolcommits/backends/git_info.rb +15 -11
  16. data/lib/lolcommits/backends/installation_git.rb +4 -3
  17. data/lib/lolcommits/backends/installation_mercurial.rb +1 -1
  18. data/lib/lolcommits/backends/mercurial_info.rb +13 -9
  19. data/lib/lolcommits/capturer.rb +14 -6
  20. data/lib/lolcommits/capturer/capture_cygwin.rb +3 -14
  21. data/lib/lolcommits/capturer/capture_fake.rb +8 -2
  22. data/lib/lolcommits/capturer/capture_linux.rb +11 -10
  23. data/lib/lolcommits/capturer/capture_linux_video.rb +15 -0
  24. data/lib/lolcommits/capturer/capture_mac.rb +6 -11
  25. data/lib/lolcommits/capturer/capture_mac_video.rb +23 -0
  26. data/lib/lolcommits/capturer/capture_windows.rb +14 -9
  27. data/lib/lolcommits/capturer/capture_windows_video.rb +46 -0
  28. data/lib/lolcommits/cli/fatals.rb +1 -1
  29. data/lib/lolcommits/cli/launcher.rb +1 -1
  30. data/lib/lolcommits/cli/timelapse_gif.rb +28 -12
  31. data/lib/lolcommits/configuration.rb +4 -26
  32. data/lib/lolcommits/platform.rb +4 -4
  33. data/lib/lolcommits/plugin/base.rb +2 -2
  34. data/lib/lolcommits/plugin/configuration_helper.rb +1 -1
  35. data/lib/lolcommits/runner.rb +138 -69
  36. data/lib/lolcommits/version.rb +2 -2
  37. data/lolcommits.gemspec +4 -2
  38. data/test/assets/test_image.jpg +0 -0
  39. data/test/assets/test_video.mp4 +0 -0
  40. metadata +12 -9
  41. data/lib/lolcommits/capturer/capture_linux_animated.rb +0 -74
  42. data/lib/lolcommits/capturer/capture_mac_animated.rb +0 -75
  43. data/lib/lolcommits/capturer/capture_windows_animated.rb +0 -110
@@ -1,2 +1,2 @@
1
1
  ---
2
- default: <%= (RbConfig::CONFIG['host_os'] =~ /darwin/) ? 'features' : '--tags ~@mac-only' %>
2
+ default: <%= ENV['TRAVIS'] == 'true' ? '--tags ~@requires_ffmpeg' : 'features' %>
@@ -21,9 +21,9 @@ Feature: Bug regression testing
21
21
  @fake-interactive-rebase @slow_process
22
22
  Scenario: Don't trigger capture during a git rebase
23
23
  Given I am in a git repo named "yuh8history" with lolcommits enabled
24
- And I do 3 git commits
24
+ And I do 2 git commits
25
25
  When I run `git rebase -i HEAD~2`
26
- Then there should be exactly 3 jpgs in "~/.lolcommits/yuh8history"
26
+ Then there should be exactly 2 jpgs in "~/.lolcommits/yuh8history"
27
27
 
28
28
  #
29
29
  # issue #87, https://github.com/lolcommits/lolcommits/issues/87
@@ -8,6 +8,11 @@ Feature: Basic UI functionality
8
8
  Then the exit status should be 0
9
9
  And the banner should be present
10
10
 
11
+ Scenario: Shows version information
12
+ When I run `lolcommits --version`
13
+ Then the output should show the version number
14
+ And the exit status should be 0
15
+
11
16
  Scenario: Help should show the animate option on a Mac platform
12
17
  Given I am using a "darwin" platform
13
18
  When I get help for "lolcommits"
@@ -75,7 +80,7 @@ Feature: Basic UI functionality
75
80
  # Then there should be exactly 1 pid in "~/.lolcommits/forked"
76
81
  # When I wait for the child process to exit in "forked"
77
82
  # Then a directory named "~/.lolcommits/forked" should exist
78
- # And a file named "~/.lolcommits/forked/tmp_snapshot.jpg" should not exist
83
+ # And a file named "~/.lolcommits/forked/raw_capture.jpg" should not exist
79
84
  # And there should be exactly 1 jpg in "~/.lolcommits/forked"
80
85
 
81
86
  Scenario: Commiting in an enabled git repo triggers successful capture
@@ -83,7 +88,7 @@ Feature: Basic UI functionality
83
88
  When I do a git commit
84
89
  Then the output should contain "*** Preserving this moment in history."
85
90
  And a directory named "~/.lolcommits/myrepo" should exist
86
- And a file named "~/.lolcommits/myrepo/tmp_snapshot.jpg" should not exist
91
+ And a file named "~/.lolcommits/myrepo/raw_capture.jpg" should not exist
87
92
  And there should be exactly 1 jpg in "~/.lolcommits/myrepo"
88
93
 
89
94
  Scenario: Commiting in enabled git repo subdirectory triggers successful capture
@@ -124,8 +129,8 @@ Feature: Basic UI functionality
124
129
  When I run `lolcommits --test --show-config`
125
130
  Then the output should match /loltext:\s+:enabled: false/
126
131
 
127
- Scenario: test capture should work regardless of whether in a lolrepo
128
- Given I am in a directory named "nothingtoseehere"
132
+ Scenario: test capture should work regardless of whether in a vcs repo
133
+ Given I am in a directory named "not_a_vcs_repo"
129
134
  When I run `lolcommits --test --capture`
130
135
  Then the output should contain "*** Capturing in test mode."
131
136
  And the output should not contain "path does not exist (ArgumentError)"
@@ -216,30 +221,50 @@ Feature: Basic UI functionality
216
221
  Then the exit status should be 0
217
222
  And there should be exactly 1 jpg in its loldir
218
223
 
219
- Scenario: generate gif should store in its own archive directory
224
+ Scenario: generate gif should store in the timelapses directory
220
225
  Given I am in a git repo named "giffy" with lolcommits enabled
221
226
  And a loldir named "giffy" with 2 lolimages
222
227
  When I run `lolcommits --timelapse`
223
- Then the output should contain "Generating animated gif."
224
- And a directory named "~/.lolcommits/giffy/archive" should exist
225
- And a file named "~/.lolcommits/giffy/archive/archive.gif" should exist
228
+ Then the output should contain "Generating animated timelapse gif."
229
+ And a directory named "~/.lolcommits/giffy/timelapses" should exist
230
+ And there should be exactly 1 gif in "~/.lolcommits/giffy/timelapses"
226
231
 
227
232
  Scenario: generate gif with argument 'today'
228
233
  Given I am in a git repo named "sunday" with lolcommits enabled
229
234
  And a loldir named "sunday" with 2 lolimages
230
235
  When I run `lolcommits --timelapse --period today`
231
- Then there should be exactly 1 gif in "~/.lolcommits/sunday/archive"
236
+ Then there should be exactly 1 gif in "~/.lolcommits/sunday/timelapses"
232
237
 
233
- @mac-only
234
- Scenario: should generate an animated gif on the Mac platform
235
- Given I am in a git repo named "animate"
238
+ @requires_ffmpeg @slow_process
239
+ Scenario: should generate a lolcommit animated gif
240
+ Given I am in a git repo named "gif"
236
241
  And I do a git commit
237
242
  When I run `lolcommits --capture --animate=1`
238
243
  Then the output should contain "*** Preserving this moment in history."
239
- And a directory named "~/.lolcommits/animate" should exist
240
- And a file named "~/.lolcommits/animate/tmp_video.mov" should not exist
241
- And a directory named "~/.lolcommits/animate/tmp_frames" should not exist
242
- And there should be exactly 1 gif in "~/.lolcommits/animate"
244
+ And a directory named "~/.lolcommits/gif" should exist
245
+ And a file named "~/.lolcommits/animate/raw_capture.mp4" should not exist
246
+ And there should be exactly 1 gif in "~/.lolcommits/gif"
247
+
248
+ @requires_ffmpeg @slow_process
249
+ Scenario: should generate a lolcommit video
250
+ Given I am in a git repo named "video"
251
+ And I do a git commit
252
+ When I run `lolcommits --capture --video=1`
253
+ Then the output should contain "*** Preserving this moment in history."
254
+ And a directory named "~/.lolcommits/video" should exist
255
+ And a file named "~/.lolcommits/animate/raw_capture.mp4" should not exist
256
+ And there should be exactly 1 mp4 in "~/.lolcommits/video"
257
+
258
+ @requires_ffmpeg @slow_process
259
+ Scenario: should generate a lolcommit video and animated gif
260
+ Given I am in a git repo named "video-and-gif"
261
+ And I do a git commit
262
+ When I run `lolcommits --capture -v1 -a1`
263
+ Then the output should contain "*** Preserving this moment in history."
264
+ And a directory named "~/.lolcommits/video-and-gif" should exist
265
+ And a file named "~/.lolcommits/animate/raw_capture.mp4" should not exist
266
+ And there should be exactly 1 mp4 in "~/.lolcommits/video-and-gif"
267
+ And there should be exactly 1 gif in "~/.lolcommits/video-and-gif"
243
268
 
244
269
  @fake-no-ffmpeg
245
270
  Scenario: gracefully fail when ffmpeg not installed and --animate is used
@@ -292,7 +317,7 @@ Feature: Basic UI functionality
292
317
  When I do a mercurial commit
293
318
  Then the output should contain "*** Preserving this moment in history."
294
319
  And a directory named "~/.lolcommits/myrepo" should exist
295
- And a file named "~/.lolcommits/myrepo/tmp_snapshot.jpg" should not exist
320
+ And a file named "~/.lolcommits/myrepo/raw_capture.jpg" should not exist
296
321
  And there should be exactly 1 jpg in "~/.lolcommits/myrepo"
297
322
 
298
323
  Scenario: Commiting in enabled mercurial repo subdirectory triggers successful capture
@@ -147,17 +147,17 @@ Given(/^a loldir named "(.*?)" with (\d+) lolimages$/) do |repo, num_images|
147
147
  FileUtils.mkdir_p loldir
148
148
  num_images.to_i.times do
149
149
  hex = format('%011x', (rand * 0xfffffffffff)).to_s
150
- FileUtils.cp 'test/images/test_image.jpg', File.join(loldir, "#{hex}.jpg")
150
+ FileUtils.cp 'test/assets/test_image.jpg', File.join(loldir, "#{hex}.jpg")
151
151
  end
152
152
  end
153
153
 
154
- Then(/^there should be exactly (.*?) (jpg|gif|pid)s? in its loldir$/) do |n, type|
154
+ Then(/^there should be exactly (.*?) (mp4|jpg|gif|pid)s? in its loldir$/) do |n, type|
155
155
  steps %(
156
156
  Then there should be exactly #{n} #{type} in "#{default_loldir}"
157
157
  )
158
158
  end
159
159
 
160
- Then(/^there should be exactly (.*?) (jpg|gif|pid)s? in "(.*?)"$/) do |n, type, folder|
160
+ Then(/^there should be exactly (.*?) (mp4|jpg|gif|pid)s? in "(.*?)"$/) do |n, type, folder|
161
161
  expect(Dir[expand_path("#{folder}/*.#{type}")].count).to eq(n.to_i)
162
162
  end
163
163
 
@@ -166,6 +166,10 @@ Then(/^the output should contain a list of plugins$/) do
166
166
  step %(the output should contain "[*] loltext")
167
167
  end
168
168
 
169
+ Then(/^the output should show the version number$/) do
170
+ step %(the output should match /^#{Lolcommits::VERSION}$/)
171
+ end
172
+
169
173
  When(/^I do a git commit with commit message "(.*?)"$/) do |commit_msg|
170
174
  filename = FFaker::Lorem.words(1).first
171
175
  steps %(
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lolcommits
4
+ class AnimatedGif
5
+ def create(video_path:, output_path:)
6
+ unless File.exist?(video_path)
7
+ debug "**warning** unable to create animated gif, no video at #{video_path}"
8
+ return
9
+ end
10
+
11
+ debug "creating animated gif at #{output_path}"
12
+ system_call "ffmpeg -nostats -v quiet -i \"#{video_path}\" \"#{frames_dir}/%09d.png\" > #{null_string}"
13
+
14
+ # use fps to set delay and number of frames to skip (for lower filesized gifs)
15
+ fps = video_fps(video_path)
16
+ skip = frame_skip(fps)
17
+ delay = frame_delay(fps, skip)
18
+ debug "animated gif choosing every #{skip} frames with a frame delay of #{delay} (video fps: #{fps})"
19
+
20
+ # create the looping animated gif from frames (delete frame files except every #{skip} frame)
21
+ Dir["#{frames_dir}/*.png"].each do |frame_filename|
22
+ basename = File.basename(frame_filename)
23
+ frame_number = basename.split('.').first.to_i
24
+ File.delete(frame_filename) if frame_number % skip != 0
25
+ end
26
+
27
+ # convert to animated gif with delay and gif optimisation
28
+ system_call "convert -layers OptimizeTransparency -delay #{delay} -loop 0 \"#{frames_dir}/*.png\" -coalesce \"#{output_path}\""
29
+
30
+ # remove tmp frames dir
31
+ FileUtils.rm_rf(frames_dir)
32
+ end
33
+
34
+ private
35
+
36
+ def frames_dir
37
+ @frames_dir ||= Dir.mktmpdir
38
+ end
39
+
40
+ def null_string
41
+ Lolcommits::Platform.platform_windows? ? 'nul' : '/dev/null'
42
+ end
43
+
44
+ def frame_delay(fps, skip)
45
+ # calculate frame delay
46
+ delay = ((100.0 * skip) / fps.to_f).to_i
47
+ delay < 6 ? 6 : delay # hard limit for IE browsers
48
+ end
49
+
50
+ def video_fps(file)
51
+ # inspect fps of the captured video file (default to 29.97)
52
+ fps = system_call("ffmpeg -nostats -v quiet -i \"#{file}\" 2>&1 | sed -n \"s/.*, \\(.*\\) fp.*/\\1/p\"", true)
53
+ fps.to_i < 1 ? 29.97 : fps.to_f
54
+ end
55
+
56
+ def frame_skip(fps)
57
+ # of frames to skip depends on video fps
58
+ case fps
59
+ when 0..15
60
+ 2
61
+ when 16..28
62
+ 3
63
+ else
64
+ 4
65
+ end
66
+ end
67
+
68
+ def system_call(call_str, capture_output = false)
69
+ debug "making system call for \n #{call_str}"
70
+ capture_output ? `#{call_str}` : system(call_str)
71
+ end
72
+
73
+ def debug(message)
74
+ super("#{self.class}: #{message}")
75
+ end
76
+ end
77
+ end
@@ -13,15 +13,15 @@ module Lolcommits
13
13
  end
14
14
 
15
15
  def initialize
16
- debug 'GitInfo: parsed the following values from commit:'
17
- debug "GitInfo: \t#{message}"
18
- debug "GitInfo: \t#{sha}"
19
- debug "GitInfo: \t#{repo_internal_path}"
20
- debug "GitInfo: \t#{repo}"
21
- debug "GitInfo: \t#{branch}"
22
- debug "GitInfo: \t#{commit_date}"
23
- debug "GitInfo: \t#{author_name}" if author_name
24
- debug "GitInfo: \t#{author_email}" if author_email
16
+ debug 'parsed the following values from commit:'
17
+ debug "\t#{message}"
18
+ debug "\t#{sha}"
19
+ debug "\t#{repo_internal_path}"
20
+ debug "\t#{repo}"
21
+ debug "\t#{branch}"
22
+ debug "\t#{commit_date}"
23
+ debug "\t#{author_name}" if author_name
24
+ debug "\t#{author_email}" if author_email
25
25
  end
26
26
 
27
27
  def branch
@@ -44,7 +44,7 @@ module Lolcommits
44
44
  end
45
45
 
46
46
  def url
47
- @url ||= remote_repo? ? remote_https_url(repository.remote.url) : nil
47
+ @url ||= remote_repo? ? remote_https_url(repository.remote&.url) : nil
48
48
  end
49
49
 
50
50
  def repo
@@ -73,6 +73,10 @@ module Lolcommits
73
73
 
74
74
  private
75
75
 
76
+ def debug(message)
77
+ super("#{self.class}: #{message}")
78
+ end
79
+
76
80
  def remote_https_url(url)
77
81
  url.tr(':', '/').gsub(/^git@/, 'https://').gsub(/\.git$/, '') + '/commit/'
78
82
  end
@@ -86,7 +90,7 @@ module Lolcommits
86
90
  end
87
91
 
88
92
  def remote_repo?
89
- repository.remote && repository.remote.url
93
+ !repository.remote&.url.nil?
90
94
  end
91
95
  end
92
96
  end
@@ -70,9 +70,10 @@ module Lolcommits
70
70
  end
71
71
 
72
72
  <<-HOOK
73
- ### lolcommits hook (begin) ###
74
- #{exports} && #{capture_cmd}
75
- ### lolcommits hook (end) ###
73
+
74
+ ### lolcommits hook (begin) ###
75
+ #{exports} && #{capture_cmd}
76
+ ### lolcommits hook (end) ###
76
77
  HOOK
77
78
  end
78
79
 
@@ -5,7 +5,7 @@ module Lolcommits
5
5
  # Methods to handle enabling and disabling of lolcommits
6
6
  #
7
7
  class InstallationMercurial
8
- HOOK_SECTION = 'hooks'.freeze
8
+ HOOK_SECTION = 'hooks'
9
9
  HOOK_OPERATIONS = %w(commit record crecord).freeze
10
10
 
11
11
  #
@@ -20,15 +20,15 @@ module Lolcommits
20
20
  Mercurial.configure do |conf|
21
21
  conf.hg_binary_path = 'hg'
22
22
  end
23
- debug 'MercurialInfo: parsed the following values from commit:'
24
- debug "MercurialInfo: \t#{message}"
25
- debug "MercurialInfo: \t#{sha}"
26
- debug "MercurialInfo: \t#{repo_internal_path}"
27
- debug "MercurialInfo: \t#{repo}"
28
- debug "MercurialInfo: \t#{branch}"
29
- debug "MercurialInfo: \t#{commit_date}"
30
- debug "MercurialInfo: \t#{author_name}" if author_name
31
- debug "MercurialInfo: \t#{author_email}" if author_email
23
+ debug 'parsed the following values from commit:'
24
+ debug "\t#{message}"
25
+ debug "\t#{sha}"
26
+ debug "\t#{repo_internal_path}"
27
+ debug "\t#{repo}"
28
+ debug "\t#{branch}"
29
+ debug "\t#{commit_date}"
30
+ debug "\t#{author_name}" if author_name
31
+ debug "\t#{author_email}" if author_email
32
32
  end
33
33
 
34
34
  def branch
@@ -72,6 +72,10 @@ module Lolcommits
72
72
 
73
73
  private
74
74
 
75
+ def debug(message)
76
+ super("#{self.class}: #{message}")
77
+ end
78
+
75
79
  def repository(path = '.')
76
80
  @repository ||= Mercurial::Repository.open(path)
77
81
  end
@@ -2,23 +2,31 @@
2
2
 
3
3
  module Lolcommits
4
4
  class Capturer
5
- attr_accessor :capture_device, :capture_delay, :snapshot_location,
6
- :video_location, :frames_location, :animated_duration
5
+ attr_accessor :capture_device, :capture_delay, :capture_duration,
6
+ :capture_path
7
7
 
8
8
  def initialize(attributes = {})
9
9
  attributes.each do |attr, val|
10
10
  send("#{attr}=", val)
11
11
  end
12
- debug 'Capturer: initializing new instance ' + to_s
12
+ end
13
+
14
+ def system_call(call_str, capture_output = false)
15
+ debug "making system call for \n #{call_str}"
16
+ capture_output ? `#{call_str}` : system(call_str)
17
+ end
18
+
19
+ def debug(message)
20
+ super("#{self.class}: #{message}")
13
21
  end
14
22
  end
15
23
  end
16
24
 
17
25
  require 'lolcommits/capturer/capture_mac'
18
- require 'lolcommits/capturer/capture_mac_animated'
26
+ require 'lolcommits/capturer/capture_mac_video'
19
27
  require 'lolcommits/capturer/capture_linux'
20
- require 'lolcommits/capturer/capture_linux_animated'
28
+ require 'lolcommits/capturer/capture_linux_video'
21
29
  require 'lolcommits/capturer/capture_windows'
22
- require 'lolcommits/capturer/capture_windows_animated'
30
+ require 'lolcommits/capturer/capture_windows_video'
23
31
  require 'lolcommits/capturer/capture_cygwin'
24
32
  require 'lolcommits/capturer/capture_fake'
@@ -1,23 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lolcommits
4
- class CaptureCygwin < Capturer
4
+ class CaptureCygwin < CaptureWindows
5
5
  def capture
6
- # DirectShow takes a while to show... at least for me anyway
7
- delaycmd = ' /delay 3000'
8
- if capture_delay > 0
9
- # CommandCam delay is in milliseconds
10
- delaycmd = " /delay #{capture_delay * 1000}"
11
- end
6
+ _stdin, stdout, _stderr = Open3.popen3("#{executable_path} /filename `cygpath -w #{capture_path}`#{delay_arg}")
12
7
 
13
- _stdin, stdout, _stderr = Open3.popen3("#{executable_path} /filename `cygpath -w #{snapshot_location}`#{delaycmd}")
14
-
15
- # looks like we still need to read the output for something to happen
8
+ # need to read the output for something to happen
16
9
  stdout.read
17
10
  end
18
-
19
- def executable_path
20
- File.join(Configuration::LOLCOMMITS_ROOT, 'vendor', 'ext', 'CommandCam', 'CommandCam.exe')
21
- end
22
11
  end
23
12
  end
@@ -3,8 +3,14 @@
3
3
  module Lolcommits
4
4
  class CaptureFake < Capturer
5
5
  def capture
6
- test_image = File.join Configuration::LOLCOMMITS_ROOT, 'test', 'images', 'test_image.jpg'
7
- FileUtils.cp test_image, snapshot_location
6
+ FileUtils.cp(test_file, capture_path)
7
+ end
8
+
9
+ private
10
+
11
+ def test_file
12
+ filename = capture_duration.zero? ? 'test_image.jpg' : 'test_video.mp4'
13
+ File.join(Configuration::LOLCOMMITS_ROOT, 'test', 'assets', filename)
8
14
  end
9
15
  end
10
16
  end
@@ -4,12 +4,7 @@ module Lolcommits
4
4
  class CaptureLinux < Capturer
5
5
  MPLAYER_FPS = 25
6
6
 
7
- def capture_device_string
8
- @capture_device.nil? ? nil : "-tv device=\"#{@capture_device}\""
9
- end
10
-
11
7
  def capture
12
- debug 'LinuxCapturer: making tmp directory'
13
8
  tmpdir = Dir.mktmpdir
14
9
 
15
10
  # Default delay is 1s
@@ -20,13 +15,13 @@ module Lolcommits
20
15
  # multiply the set value (in seconds) by 25
21
16
  frames = delay.to_i * MPLAYER_FPS
22
17
 
23
- debug 'LinuxCapturer: calling out to mplayer to capture image'
18
+ debug 'calling out to mplayer to capture image'
24
19
  # mplayer's output is ugly and useless, let's throw it away
25
20
  _stdin, stdout, _stderr = Open3.popen3("mplayer -vo jpeg:outdir=#{tmpdir} #{capture_device_string} -frames #{frames} -fps #{MPLAYER_FPS} tv://")
26
21
  # looks like we still need to read the output for something to happen
27
22
  stdout.read
28
23
 
29
- debug 'LinuxCapturer: calling out to mplayer to capture image'
24
+ debug 'calling out to mplayer to capture image'
30
25
 
31
26
  # get last frame from tmpdir (regardless of fps)
32
27
  all_frames = Dir.glob("#{tmpdir}/*.jpg").sort_by do |f|
@@ -34,13 +29,19 @@ module Lolcommits
34
29
  end
35
30
 
36
31
  if all_frames.empty?
37
- debug 'LinuxCapturer: failed to capture any image'
32
+ debug 'failed to capture any image'
38
33
  else
39
- FileUtils.mv(all_frames.last, snapshot_location)
40
- debug 'LinuxCapturer: cleaning up'
34
+ FileUtils.mv(all_frames.last, capture_path)
35
+ debug 'cleaning up'
41
36
  end
42
37
 
43
38
  FileUtils.rm_rf(tmpdir)
44
39
  end
40
+
41
+ private
42
+
43
+ def capture_device_string
44
+ "-tv device=\"#{capture_device || Dir.glob('/dev/video*').first}\""
45
+ end
45
46
  end
46
47
  end