lolcommits 0.5.0.pre3 → 0.5.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.
- checksums.yaml +4 -4
- data/CHANGELOG +1 -1
- data/lib/lolcommits/capture_mac_animated.rb +37 -6
- data/lib/lolcommits/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1feac734020184b6e062b2db34194eedaf54821c
|
4
|
+
data.tar.gz: 8b651d7e62a750d42a582226c3750d3dd14405eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 (
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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
|
data/lib/lolcommits/version.rb
CHANGED
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
|
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:
|
324
|
+
version: '0'
|
325
325
|
requirements: []
|
326
326
|
rubyforge_project: lolcommits
|
327
327
|
rubygems_version: 2.0.3
|