vcs_ruby 1.1.10 → 1.1.11
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 +7 -0
- data/lib/FFmpeg/ffmpeg.rb +3 -2
- data/lib/MPlayer/mplayer.rb +1 -1
- data/lib/MockCap/mock_capturer.rb +42 -0
- data/lib/capturer.rb +0 -4
- data/lib/command.rb +1 -1
- data/lib/configuration.rb +5 -4
- data/lib/contact_sheet.rb +1 -3
- data/lib/font.rb +1 -1
- data/lib/libAV/libav.rb +1 -1
- data/lib/libAV/libav_video_stream.rb +1 -1
- data/lib/stream.rb +0 -2
- data/lib/time_index.rb +1 -5
- data/lib/tools.rb +2 -2
- data/lib/vcs.rb +1 -0
- data/lib/version.info +1 -1
- data/lib/video.rb +4 -4
- data/test/command_test.rb +13 -0
- data/test/test_helper.rb +5 -0
- data/test/time_index_test.rb +80 -0
- data/test/video_test.rb +14 -0
- metadata +49 -48
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 85791e1e6f01c52a62bd1cf9d2464a91be7dfb3e
|
4
|
+
data.tar.gz: 7778a25b6432d84a550f851ebcf2b2d19be00a7d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ac320880819e49a35953e424469fd4d923d121362a643358aa23dea1a87c37191673ca5c84162782f12853415efff3dc5eee8ec9d53324880f1253856dfb5192
|
7
|
+
data.tar.gz: 96a803da37fc27152ed4295c58b99eecf95cfd1a36f6acf8ee66ae138faff2d8d5e9544bdbf668f10017403841bd5073cde4c3db0371ea4358734d186150cff3
|
data/lib/FFmpeg/ffmpeg.rb
CHANGED
@@ -19,6 +19,7 @@ module VCSRuby
|
|
19
19
|
@video = video
|
20
20
|
@ffmpeg = Command.new :ffmpeg, 'ffmpeg'
|
21
21
|
@ffprobe = Command.new :ffmpeg, 'ffprobe'
|
22
|
+
@libav = nil
|
22
23
|
|
23
24
|
detect_version if available?
|
24
25
|
end
|
@@ -41,9 +42,9 @@ module VCSRuby
|
|
41
42
|
|
42
43
|
def detect_version
|
43
44
|
info = @ffmpeg.execute('-version')
|
44
|
-
match = /avconv ([\d
|
45
|
+
match = /avconv ([\d|\.|\-|:]*)/.match(info)
|
45
46
|
@libav = !!match
|
46
|
-
match = /ffmpeg version ([\d
|
47
|
+
match = /ffmpeg version ([\d|\.]*)/.match(info)
|
47
48
|
if match
|
48
49
|
@version = match[1]
|
49
50
|
end
|
data/lib/MPlayer/mplayer.rb
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
#
|
2
|
+
# Mock Implementation for Tests
|
3
|
+
#
|
4
|
+
|
5
|
+
require 'capturer'
|
6
|
+
require 'command'
|
7
|
+
|
8
|
+
module VCSRuby
|
9
|
+
class MockCapturer < Capturer
|
10
|
+
attr_reader :info, :video_streams, :audio_streams
|
11
|
+
|
12
|
+
def initialize video
|
13
|
+
@video = video
|
14
|
+
@info = nil
|
15
|
+
@video_streams = nil
|
16
|
+
@audio_streams = nil
|
17
|
+
end
|
18
|
+
|
19
|
+
def file_valid?
|
20
|
+
true
|
21
|
+
end
|
22
|
+
|
23
|
+
def name
|
24
|
+
:mock
|
25
|
+
end
|
26
|
+
|
27
|
+
def available?
|
28
|
+
true
|
29
|
+
end
|
30
|
+
|
31
|
+
def grab time, image_path
|
32
|
+
end
|
33
|
+
|
34
|
+
def available_formats
|
35
|
+
['png', 'tiff', 'bmp', 'mjpeg']
|
36
|
+
end
|
37
|
+
|
38
|
+
def to_s
|
39
|
+
"Mock 1.0"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/capturer.rb
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
# Capturer Baseclass
|
3
3
|
#
|
4
4
|
|
5
|
-
require 'vcs'
|
6
|
-
|
7
5
|
module VCSRuby
|
8
6
|
class Capturer
|
9
7
|
$formats = { :png => 'png', :bmp => 'bmp', :tiff => 'tif', :mjpeg => 'jpg', :jpeg => 'jpg', :jpg => 'jpg' }
|
@@ -13,8 +11,6 @@ module VCSRuby
|
|
13
11
|
end
|
14
12
|
|
15
13
|
def self.initialize_capturers video
|
16
|
-
capturers = []
|
17
|
-
|
18
14
|
puts "Available capturers: #{available_capturers.map{ |c| c.to_s }.join(', ')}" if Tools.verbose?
|
19
15
|
end
|
20
16
|
|
data/lib/command.rb
CHANGED
data/lib/configuration.rb
CHANGED
@@ -22,6 +22,7 @@ module VCSRuby
|
|
22
22
|
def initialize
|
23
23
|
default_config_file = File.expand_path("defaults.yml", File.dirname(__FILE__))
|
24
24
|
@config = ::YAML::load_file(default_config_file)
|
25
|
+
@verbose = false
|
25
26
|
|
26
27
|
local_config_files = ['~/.vcs.rb.yml']
|
27
28
|
local_config_files.select{ |f| File.exists?(f) }.each do |local_config_file|
|
@@ -39,10 +40,10 @@ module VCSRuby
|
|
39
40
|
profiles = [File.expand_path("#{profile}.yml", File.dirname(__FILE__)), "~/#{profile}.yml"]
|
40
41
|
|
41
42
|
found = false
|
42
|
-
profiles.each do |
|
43
|
-
if File.exists?(
|
43
|
+
profiles.each do |p|
|
44
|
+
if File.exists?(p)
|
44
45
|
puts "Profile loaded: #{profile}" if verbose?
|
45
|
-
config = YAML::load_file(
|
46
|
+
config = YAML::load_file(p)
|
46
47
|
@config = @config.deep_merge(config)
|
47
48
|
found = true
|
48
49
|
end
|
@@ -147,4 +148,4 @@ module VCSRuby
|
|
147
148
|
!!@config['filter']['softshadow']
|
148
149
|
end
|
149
150
|
end
|
150
|
-
|
151
|
+
end
|
data/lib/contact_sheet.rb
CHANGED
@@ -6,8 +6,6 @@ require 'fileutils'
|
|
6
6
|
require 'tmpdir'
|
7
7
|
require 'yaml'
|
8
8
|
|
9
|
-
require 'vcs'
|
10
|
-
|
11
9
|
module VCSRuby
|
12
10
|
class ContactSheet
|
13
11
|
attr_accessor :signature, :title, :highlight
|
@@ -254,7 +252,7 @@ private
|
|
254
252
|
convert << file_path
|
255
253
|
end
|
256
254
|
file_path
|
257
|
-
|
255
|
+
end
|
258
256
|
|
259
257
|
def create_title montage
|
260
258
|
file_path = File::join(@tempdir, 'title.png')
|
data/lib/font.rb
CHANGED
data/lib/libAV/libav.rb
CHANGED
@@ -54,7 +54,7 @@ module VCSRuby
|
|
54
54
|
|
55
55
|
colon = ":"
|
56
56
|
if @raw['display_aspect_ratio'].include? colon
|
57
|
-
w,h = @raw['display_aspect_ratio'].split(colon)
|
57
|
+
w,h = @raw['display_aspect_ratio'].split(colon).map { |n| n.to_i }
|
58
58
|
Rational(w,h)
|
59
59
|
else
|
60
60
|
@raw['display_aspect_ratio'].to_f
|
data/lib/stream.rb
CHANGED
data/lib/time_index.rb
CHANGED
@@ -47,16 +47,12 @@ module VCSRuby
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def try_parse_as_number
|
50
|
-
temp = @to_parse.
|
50
|
+
temp = @to_parse.to_f
|
51
51
|
if temp.to_s == @to_parse
|
52
52
|
@total_seconds += temp
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
def total_seconds
|
57
|
-
@total_seconds
|
58
|
-
end
|
59
|
-
|
60
56
|
def hours
|
61
57
|
(@total_seconds.abs / 3600).to_i
|
62
58
|
end
|
data/lib/tools.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
#
|
2
|
+
# Various Tool Functions
|
3
3
|
#
|
4
4
|
|
5
5
|
module VCSRuby
|
@@ -25,7 +25,7 @@ module VCSRuby
|
|
25
25
|
MagickVersion = Struct.new(:major, :minor, :revision)
|
26
26
|
def self.magick_version
|
27
27
|
output = %x[convert -version]
|
28
|
-
m = output.match
|
28
|
+
m = output.match(/(\d+)\.(\d+)\.(\d+)(-(\d+))?/)
|
29
29
|
MagickVersion.new(m[1].to_i, m[2].to_i, m[3].to_i)
|
30
30
|
end
|
31
31
|
|
data/lib/vcs.rb
CHANGED
data/lib/version.info
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.11
|
data/lib/video.rb
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
# Represents the video file
|
3
3
|
#
|
4
4
|
|
5
|
-
require 'vcs'
|
6
|
-
|
7
5
|
module VCSRuby
|
8
6
|
class Video
|
9
7
|
attr_reader :config
|
@@ -77,7 +75,9 @@ private
|
|
77
75
|
|
78
76
|
def capturer
|
79
77
|
result = nil
|
80
|
-
if Configuration.instance.capturer == :
|
78
|
+
if Configuration.instance.capturer == :mock
|
79
|
+
result = MockCapturer.new(self)
|
80
|
+
elsif Configuration.instance.capturer == :any
|
81
81
|
result = available_capturers.first
|
82
82
|
else
|
83
83
|
result = available_capturers.select{ |c| c.name == Configuration.instance.capturer }.first
|
@@ -90,4 +90,4 @@ private
|
|
90
90
|
return result
|
91
91
|
end
|
92
92
|
end
|
93
|
-
end
|
93
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'minitest'
|
2
|
+
require 'vcs'
|
3
|
+
|
4
|
+
class CommandTest < Minitest::Test
|
5
|
+
def test_command
|
6
|
+
command = VCSRuby::Command.new 'test_find', 'find'
|
7
|
+
|
8
|
+
assert_equal 'test_find', command.name
|
9
|
+
assert command.available?, 'Command find not found'
|
10
|
+
|
11
|
+
command.execute '--help'
|
12
|
+
end
|
13
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'minitest'
|
2
|
+
require 'vcs'
|
3
|
+
|
4
|
+
class TimeIndexTest < Minitest::Test
|
5
|
+
def test_simple_initialisation
|
6
|
+
time = VCSRuby::TimeIndex.new 60
|
7
|
+
|
8
|
+
assert_equal 60, time.total_seconds
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_valid_ffmpeg_parse
|
12
|
+
time = VCSRuby::TimeIndex.new '00:59:59'
|
13
|
+
|
14
|
+
assert_equal 3599, time.total_seconds
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_valid_comma_ffmpeg_parse
|
18
|
+
time = VCSRuby::TimeIndex.new '01:09:59.13'
|
19
|
+
|
20
|
+
assert_equal 4199.13, time.total_seconds
|
21
|
+
assert_equal 1, time.hours
|
22
|
+
assert_equal 9, time.minutes
|
23
|
+
assert_equal 59, time.seconds.to_i
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_invalid_ffmpeg_parse
|
27
|
+
time = VCSRuby::TimeIndex.new '59:59'
|
28
|
+
|
29
|
+
assert_equal 0, time.total_seconds
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_valid_vcs_parse
|
33
|
+
time = VCSRuby::TimeIndex.new '5m'
|
34
|
+
|
35
|
+
assert_equal 300, time.total_seconds
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_complex_vcs_parse
|
39
|
+
time = VCSRuby::TimeIndex.new '1h 5m 17s'
|
40
|
+
|
41
|
+
assert_equal 3917, time.total_seconds
|
42
|
+
assert_equal 1, time.hours
|
43
|
+
assert_equal 5, time.minutes
|
44
|
+
assert_equal 17, time.seconds
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_invalid_string_parse
|
48
|
+
time = VCSRuby::TimeIndex.new 'invalid'
|
49
|
+
|
50
|
+
assert_equal 0, time.total_seconds
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_valid_string_parse
|
54
|
+
time = VCSRuby::TimeIndex.new '55.55'
|
55
|
+
|
56
|
+
assert_equal 55.55, time.total_seconds
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_multiply
|
60
|
+
time = VCSRuby::TimeIndex.new '1m 13s'
|
61
|
+
five = time * 5
|
62
|
+
|
63
|
+
assert_equal "0h06m05s", five.to_s
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_addition
|
67
|
+
time1 = VCSRuby::TimeIndex.new '1m 13s'
|
68
|
+
time2 = VCSRuby::TimeIndex.new 3600
|
69
|
+
total = time1 + time2
|
70
|
+
|
71
|
+
assert_equal "1:01:13", total.to_timestamp
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_valid_substraction
|
75
|
+
time = VCSRuby::TimeIndex.new '3h 17m'
|
76
|
+
total = time - 20000
|
77
|
+
|
78
|
+
assert_equal "-2h16m20s", total.to_s
|
79
|
+
end
|
80
|
+
end
|
data/test/video_test.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'minitest'
|
2
|
+
require 'vcs'
|
3
|
+
|
4
|
+
class VideoTest < Minitest::Test
|
5
|
+
def setup
|
6
|
+
VCSRuby::Configuration.instance.capturer = :mock
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_video_basic_setup
|
10
|
+
video = VCSRuby::Video.new 'mock.mpg'
|
11
|
+
assert_equal :mock, video.capturer_name
|
12
|
+
assert video.valid?
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,80 +1,73 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vcs_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.11
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Thomas Bruderer
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2017-
|
11
|
+
date: 2017-03-14 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: mini_magick
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '4.0'
|
22
|
-
- -
|
20
|
+
- - ">="
|
23
21
|
- !ruby/object:Gem::Version
|
24
22
|
version: 4.0.0
|
25
23
|
type: :runtime
|
26
24
|
prerelease: false
|
27
25
|
version_requirements: !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
26
|
requirements:
|
30
|
-
- - ~>
|
27
|
+
- - "~>"
|
31
28
|
- !ruby/object:Gem::Version
|
32
29
|
version: '4.0'
|
33
|
-
- -
|
30
|
+
- - ">="
|
34
31
|
- !ruby/object:Gem::Version
|
35
32
|
version: 4.0.0
|
36
33
|
- !ruby/object:Gem::Dependency
|
37
34
|
name: bundler
|
38
35
|
requirement: !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
36
|
requirements:
|
41
|
-
- - ~>
|
37
|
+
- - "~>"
|
42
38
|
- !ruby/object:Gem::Version
|
43
39
|
version: '1.5'
|
44
|
-
- -
|
40
|
+
- - ">="
|
45
41
|
- !ruby/object:Gem::Version
|
46
42
|
version: 1.5.0
|
47
43
|
type: :development
|
48
44
|
prerelease: false
|
49
45
|
version_requirements: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
46
|
requirements:
|
52
|
-
- - ~>
|
47
|
+
- - "~>"
|
53
48
|
- !ruby/object:Gem::Version
|
54
49
|
version: '1.5'
|
55
|
-
- -
|
50
|
+
- - ">="
|
56
51
|
- !ruby/object:Gem::Version
|
57
52
|
version: 1.5.0
|
58
53
|
- !ruby/object:Gem::Dependency
|
59
54
|
name: rake
|
60
55
|
requirement: !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
62
56
|
requirements:
|
63
|
-
- - ~>
|
57
|
+
- - "~>"
|
64
58
|
- !ruby/object:Gem::Version
|
65
59
|
version: '11.0'
|
66
|
-
- -
|
60
|
+
- - ">="
|
67
61
|
- !ruby/object:Gem::Version
|
68
62
|
version: 11.0.0
|
69
63
|
type: :development
|
70
64
|
prerelease: false
|
71
65
|
version_requirements: !ruby/object:Gem::Requirement
|
72
|
-
none: false
|
73
66
|
requirements:
|
74
|
-
- - ~>
|
67
|
+
- - "~>"
|
75
68
|
- !ruby/object:Gem::Version
|
76
69
|
version: '11.0'
|
77
|
-
- -
|
70
|
+
- - ">="
|
78
71
|
- !ruby/object:Gem::Version
|
79
72
|
version: 11.0.0
|
80
73
|
description: Creates a contact sheet, a preview, of a video, usable as library or
|
@@ -86,60 +79,68 @@ executables:
|
|
86
79
|
extensions: []
|
87
80
|
extra_rdoc_files: []
|
88
81
|
files:
|
89
|
-
-
|
90
|
-
- lib/
|
91
|
-
- lib/
|
82
|
+
- bin/vcs.rb
|
83
|
+
- lib/FFmpeg/ffmpeg.rb
|
84
|
+
- lib/FFmpeg/ffmpeg_audio_stream.rb
|
85
|
+
- lib/FFmpeg/ffmpeg_meta_info.rb
|
86
|
+
- lib/FFmpeg/ffmpeg_video_stream.rb
|
92
87
|
- lib/MPlayer/mplayer.rb
|
93
88
|
- lib/MPlayer/mplayer_audio_stream.rb
|
94
89
|
- lib/MPlayer/mplayer_meta_info.rb
|
90
|
+
- lib/MPlayer/mplayer_video_stream.rb
|
91
|
+
- lib/MockCap/mock_capturer.rb
|
92
|
+
- lib/black.yml
|
93
|
+
- lib/capturer.rb
|
94
|
+
- lib/command.rb
|
95
|
+
- lib/configuration.rb
|
96
|
+
- lib/contact_sheet.rb
|
97
|
+
- lib/defaults.yml
|
98
|
+
- lib/font.rb
|
99
|
+
- lib/frame.rb
|
100
|
+
- lib/libAV/libav.rb
|
95
101
|
- lib/libAV/libav_audio_stream.rb
|
96
102
|
- lib/libAV/libav_meta_info.rb
|
97
103
|
- lib/libAV/libav_video_stream.rb
|
98
|
-
- lib/
|
99
|
-
- lib/time_index.rb
|
100
|
-
- lib/font.rb
|
104
|
+
- lib/oldstyle.yml
|
101
105
|
- lib/stream.rb
|
106
|
+
- lib/time_index.rb
|
102
107
|
- lib/tools.rb
|
103
|
-
- lib/
|
108
|
+
- lib/vcs.rb
|
109
|
+
- lib/version.info
|
104
110
|
- lib/version.rb
|
111
|
+
- lib/video.rb
|
105
112
|
- lib/white.yml
|
106
|
-
-
|
107
|
-
-
|
108
|
-
-
|
109
|
-
-
|
110
|
-
- lib/FFmpeg/ffmpeg_audio_stream.rb
|
111
|
-
- lib/version.info
|
112
|
-
- lib/vcs.rb
|
113
|
-
- lib/command.rb
|
114
|
-
- lib/black.yml
|
115
|
-
- lib/configuration.rb
|
116
|
-
- lib/oldstyle.yml
|
117
|
-
- lib/defaults.yml
|
118
|
-
- bin/vcs.rb
|
113
|
+
- test/command_test.rb
|
114
|
+
- test/test_helper.rb
|
115
|
+
- test/time_index_test.rb
|
116
|
+
- test/video_test.rb
|
119
117
|
homepage: https://github.com/FreeApophis/vcs.rb
|
120
118
|
licenses:
|
121
119
|
- GPL3
|
120
|
+
metadata: {}
|
122
121
|
post_install_message:
|
123
122
|
rdoc_options: []
|
124
123
|
require_paths:
|
125
124
|
- lib
|
126
125
|
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
-
none: false
|
128
126
|
requirements:
|
129
|
-
- -
|
127
|
+
- - ">="
|
130
128
|
- !ruby/object:Gem::Version
|
131
129
|
version: 1.8.6
|
132
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
-
none: false
|
134
131
|
requirements:
|
135
|
-
- -
|
132
|
+
- - ">="
|
136
133
|
- !ruby/object:Gem::Version
|
137
134
|
version: '0'
|
138
135
|
requirements:
|
139
136
|
- libav or ffmpeg or mplayer
|
140
137
|
rubyforge_project:
|
141
|
-
rubygems_version:
|
138
|
+
rubygems_version: 2.6.10
|
142
139
|
signing_key:
|
143
|
-
specification_version:
|
140
|
+
specification_version: 4
|
144
141
|
summary: Generates contact sheets of videos
|
145
|
-
test_files:
|
142
|
+
test_files:
|
143
|
+
- test/video_test.rb
|
144
|
+
- test/command_test.rb
|
145
|
+
- test/time_index_test.rb
|
146
|
+
- test/test_helper.rb
|