lolcommits 0.5.0.pre3 → 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
  SHA1:
3
- metadata.gz: ad3bb7059d1456292c62655602fe093d02489634
4
- data.tar.gz: d58ec1f441f2e30b8cc5a1dda9884dffb29ac9e9
3
+ metadata.gz: 1feac734020184b6e062b2db34194eedaf54821c
4
+ data.tar.gz: 8b651d7e62a750d42a582226c3750d3dd14405eb
5
5
  SHA512:
6
- metadata.gz: 5725cfe06bb7f1dcf77e42f6c4a3b29f17403743ea25bb88473996a5c05e3cbccd1d238332fb02a8da2da618cdcde7b6530a25a1e08c08fe0b5c5a7b5ae8d68f
7
- data.tar.gz: 0b6a84abbd2db137131a753933d92ad6f1b60b46e513730dde74ec6fab1bbe2dabb6052ef8b5e7479139599fc2c15892b4216a9d71824b902b727dc2598bf64b
6
+ metadata.gz: 0fa9dc7db5600ffaa9aacd066d214309e65b33568dbb7038611d276d118b33ec36e1136ff97f2059af15f02fdce1902cf43b461a5d52288acb97d9d688440740
7
+ data.tar.gz: e81be290e664334907c884b5d8d3d8d3eaf9f4181ba26fd7e4fa5e6aba357a80c8f6db217596852fd6c4feeba5058cd6f0ddf9ac0d034a1f124f9583bf8be14d
data/CHANGELOG CHANGED
@@ -1,7 +1,7 @@
1
1
  0.x.x (in development)
2
2
  * TODO: figure out problems with GUI clients
3
3
 
4
- 0.5.0 (9 September 2013)
4
+ 0.5.0 (10 September 2013)
5
5
  * better handling of LOLCOMMITS_DELAY (thx @leewillis77, #125)
6
6
  * LOLCOMMITS_DEVICE support on Linux (thx @EbenezerEdelman, #139)
7
7
  * better handling of repository names (thx @drocamor and @andromedado, #145 and #146)
@@ -11,17 +11,48 @@ module Lolcommits
11
11
  if File.exists?(video_location)
12
12
  # convert raw video to png frames with ffmpeg
13
13
  system_call "ffmpeg -v quiet -i #{video_location} -t #{animated_duration} #{frames_location}/%09d.png"
14
- # create the looping animated gif from frames (picks every 3rd frame with seq)
15
- seq_command = "seq -f #{frames_location}/%09g.png 1 3 #{Dir["#{frames_location}/*"].length}"
16
- # delay is chosen assuming the capture was 29.97fps
17
- system_call "convert -layers OptimizeTransparency -delay 7 -loop 0 `#{seq_command}` -coalesce #{snapshot_location}"
14
+
15
+ # use fps to set delay and number of frames to skip (for lower filesized gifs)
16
+ fps = video_fps(video_location)
17
+ skip = frame_skip(fps)
18
+ delay = frame_delay(fps, skip)
19
+ debug "Capturer: anaimated gif choosing every #{skip} frames with a frame delay of #{delay}"
20
+
21
+ # create the looping animated gif from frames (picks nth frame with seq)
22
+ seq_command = "seq -f #{frames_location}/%09g.png 1 #{skip} #{Dir["#{frames_location}/*"].length}"
23
+ # convert to animated gif with delay and gif optimisation
24
+ system_call "convert -layers OptimizeTransparency -delay #{delay} -loop 0 `#{seq_command}` -coalesce #{snapshot_location}"
18
25
  end
19
26
  end
20
27
 
21
28
  private
22
- def system_call(call_str)
29
+ def system_call(call_str, capture_output = false)
23
30
  debug "Capturer: making system call for \n #{call_str}"
24
- system(call_str)
31
+ capture_output ? `#{call_str}` : system(call_str)
32
+ end
33
+
34
+ def frame_delay(fps, skip)
35
+ # calculate frame delay
36
+ delay = ((100.0 * skip)/fps.to_f).to_i
37
+ delay < 6 ? 6 : delay # hard limit for IE browsers
38
+ end
39
+
40
+ def video_fps(file)
41
+ # inspect fps of the captured video file (default to 29.97)
42
+ fps = system_call("ffmpeg -i #{file} 2>&1 | sed -n \"s/.*, \\(.*\\) fp.*/\\1/p\"", true)
43
+ fps.to_i < 1 ? 29.97 : fps.to_f
44
+ end
45
+
46
+ def frame_skip(fps)
47
+ # of frames to skip depends on movie fps
48
+ case(fps)
49
+ when 0..15
50
+ 2
51
+ when 16..28
52
+ 3
53
+ else
54
+ 4
55
+ end
25
56
  end
26
57
 
27
58
  def videosnap_bin
@@ -1,3 +1,3 @@
1
1
  module Lolcommits
2
- VERSION = "0.5.0.pre3"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lolcommits
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0.pre3
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Rothenberg
@@ -319,9 +319,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
319
319
  version: '0'
320
320
  required_rubygems_version: !ruby/object:Gem::Requirement
321
321
  requirements:
322
- - - '>'
322
+ - - '>='
323
323
  - !ruby/object:Gem::Version
324
- version: 1.3.1
324
+ version: '0'
325
325
  requirements: []
326
326
  rubyforge_project: lolcommits
327
327
  rubygems_version: 2.0.3