vcs_ruby 1.1.8 → 1.1.9
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/bin/vcs.rb +171 -169
- data/lib/FFmpeg/ffmpeg.rb +121 -121
- data/lib/FFmpeg/ffmpeg_audio_stream.rb +37 -37
- data/lib/FFmpeg/ffmpeg_meta_info.rb +36 -36
- data/lib/FFmpeg/ffmpeg_video_stream.rb +62 -56
- data/lib/MPlayer/mplayer.rb +101 -101
- data/lib/MPlayer/mplayer_audio_stream.rb +33 -33
- data/lib/MPlayer/mplayer_meta_info.rb +39 -39
- data/lib/MPlayer/mplayer_video_stream.rb +44 -44
- data/lib/black.yml +12 -12
- data/lib/capturer.rb +69 -69
- data/lib/command.rb +51 -51
- data/lib/configuration.rb +150 -150
- data/lib/contact_sheet.rb +380 -366
- data/lib/defaults.yml +39 -39
- data/lib/font.rb +81 -81
- data/lib/frame.rb +161 -161
- data/lib/libAV/libav.rb +151 -151
- data/lib/libAV/libav_audio_stream.rb +37 -37
- data/lib/libAV/libav_meta_info.rb +36 -36
- data/lib/libAV/libav_video_stream.rb +62 -56
- data/lib/oldstyle.yml +22 -22
- data/lib/stream.rb +24 -24
- data/lib/time_index.rb +121 -121
- data/lib/tools.rb +81 -70
- data/lib/vcs.rb +26 -26
- data/lib/version.info +1 -1
- data/lib/version.rb +25 -25
- data/lib/video.rb +92 -88
- data/lib/white.yml +12 -12
- metadata +39 -47
data/lib/time_index.rb
CHANGED
@@ -1,121 +1,121 @@
|
|
1
|
-
#
|
2
|
-
# Time interval
|
3
|
-
#
|
4
|
-
|
5
|
-
module VCSRuby
|
6
|
-
class TimeIndex
|
7
|
-
include Comparable
|
8
|
-
attr_reader :total_seconds
|
9
|
-
|
10
|
-
def initialize time_index = ''
|
11
|
-
if time_index.instance_of? Float or time_index.instance_of? Fixnum
|
12
|
-
@total_seconds = time_index
|
13
|
-
else
|
14
|
-
@total_seconds = 0.0
|
15
|
-
@to_parse = time_index.strip
|
16
|
-
|
17
|
-
unless @to_parse.empty?
|
18
|
-
try_parse_ffmpeg_index
|
19
|
-
try_parse_vcs_index
|
20
|
-
try_parse_as_number
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def try_parse_ffmpeg_index
|
26
|
-
parts = @to_parse.split(':')
|
27
|
-
if parts.count == 3
|
28
|
-
@total_seconds += parts[0].to_i * 60 * 60
|
29
|
-
@total_seconds += parts[1].to_i * 60
|
30
|
-
@total_seconds += parts[2].to_f
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def try_parse_vcs_index
|
35
|
-
if @to_parse =~ /\d*m|\d*h|\d*s/
|
36
|
-
parts = @to_parse.split(/(\d*h)|(\d*m)|(\d*s)/).select{|e| !e.empty?}
|
37
|
-
parts.each do |part|
|
38
|
-
add_vcs_part part
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def add_vcs_part part
|
44
|
-
return @total_seconds += part.to_i * 60 * 60 if part.end_with? 'h'
|
45
|
-
return @total_seconds += part.to_i * 60 if part.end_with? 'm'
|
46
|
-
@total_seconds += part.to_i
|
47
|
-
end
|
48
|
-
|
49
|
-
def try_parse_as_number
|
50
|
-
temp = @to_parse.to_i
|
51
|
-
if temp.to_s == @to_parse
|
52
|
-
@total_seconds += temp
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def total_seconds
|
57
|
-
@total_seconds
|
58
|
-
end
|
59
|
-
|
60
|
-
def hours
|
61
|
-
(@total_seconds.abs / 3600).to_i
|
62
|
-
end
|
63
|
-
|
64
|
-
def minutes
|
65
|
-
((@total_seconds.abs / 60) % 60).to_i
|
66
|
-
end
|
67
|
-
|
68
|
-
def seconds
|
69
|
-
@total_seconds.abs % 60
|
70
|
-
end
|
71
|
-
|
72
|
-
def + operand
|
73
|
-
if operand.instance_of? Fixnum
|
74
|
-
TimeIndex.new @total_seconds + operand
|
75
|
-
else
|
76
|
-
TimeIndex.new @total_seconds + operand.total_seconds
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def - operand
|
81
|
-
if operand.instance_of? Fixnum
|
82
|
-
TimeIndex.new @total_seconds - operand
|
83
|
-
else
|
84
|
-
TimeIndex.new @total_seconds - operand.total_seconds
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def * operand
|
89
|
-
TimeIndex.new total_seconds * operand
|
90
|
-
end
|
91
|
-
|
92
|
-
def / operand
|
93
|
-
if operand.instance_of? Fixnum
|
94
|
-
TimeIndex.new @total_seconds / operand
|
95
|
-
else
|
96
|
-
@total_seconds / operand.total_seconds
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def <=> operand
|
101
|
-
@total_seconds <=> operand.total_seconds
|
102
|
-
end
|
103
|
-
|
104
|
-
def sign
|
105
|
-
return '-' if @total_seconds < 0
|
106
|
-
''
|
107
|
-
end
|
108
|
-
|
109
|
-
def to_s
|
110
|
-
"#{sign}#{hours}h#{"%02d" % minutes}m#{"%02d" % seconds}s"
|
111
|
-
end
|
112
|
-
|
113
|
-
def to_timestamp
|
114
|
-
if hours == 0
|
115
|
-
"#{sign}#{"%02d" % minutes}:#{"%02d" % seconds}"
|
116
|
-
else
|
117
|
-
"#{sign}#{hours}:#{"%02d" % minutes}:#{"%02d" % seconds}"
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
1
|
+
#
|
2
|
+
# Time interval
|
3
|
+
#
|
4
|
+
|
5
|
+
module VCSRuby
|
6
|
+
class TimeIndex
|
7
|
+
include Comparable
|
8
|
+
attr_reader :total_seconds
|
9
|
+
|
10
|
+
def initialize time_index = ''
|
11
|
+
if time_index.instance_of? Float or time_index.instance_of? Fixnum
|
12
|
+
@total_seconds = time_index
|
13
|
+
else
|
14
|
+
@total_seconds = 0.0
|
15
|
+
@to_parse = time_index.strip
|
16
|
+
|
17
|
+
unless @to_parse.empty?
|
18
|
+
try_parse_ffmpeg_index
|
19
|
+
try_parse_vcs_index
|
20
|
+
try_parse_as_number
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def try_parse_ffmpeg_index
|
26
|
+
parts = @to_parse.split(':')
|
27
|
+
if parts.count == 3
|
28
|
+
@total_seconds += parts[0].to_i * 60 * 60
|
29
|
+
@total_seconds += parts[1].to_i * 60
|
30
|
+
@total_seconds += parts[2].to_f
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def try_parse_vcs_index
|
35
|
+
if @to_parse =~ /\d*m|\d*h|\d*s/
|
36
|
+
parts = @to_parse.split(/(\d*h)|(\d*m)|(\d*s)/).select{|e| !e.empty?}
|
37
|
+
parts.each do |part|
|
38
|
+
add_vcs_part part
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def add_vcs_part part
|
44
|
+
return @total_seconds += part.to_i * 60 * 60 if part.end_with? 'h'
|
45
|
+
return @total_seconds += part.to_i * 60 if part.end_with? 'm'
|
46
|
+
@total_seconds += part.to_i
|
47
|
+
end
|
48
|
+
|
49
|
+
def try_parse_as_number
|
50
|
+
temp = @to_parse.to_i
|
51
|
+
if temp.to_s == @to_parse
|
52
|
+
@total_seconds += temp
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def total_seconds
|
57
|
+
@total_seconds
|
58
|
+
end
|
59
|
+
|
60
|
+
def hours
|
61
|
+
(@total_seconds.abs / 3600).to_i
|
62
|
+
end
|
63
|
+
|
64
|
+
def minutes
|
65
|
+
((@total_seconds.abs / 60) % 60).to_i
|
66
|
+
end
|
67
|
+
|
68
|
+
def seconds
|
69
|
+
@total_seconds.abs % 60
|
70
|
+
end
|
71
|
+
|
72
|
+
def + operand
|
73
|
+
if operand.instance_of? Fixnum
|
74
|
+
TimeIndex.new @total_seconds + operand
|
75
|
+
else
|
76
|
+
TimeIndex.new @total_seconds + operand.total_seconds
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def - operand
|
81
|
+
if operand.instance_of? Fixnum
|
82
|
+
TimeIndex.new @total_seconds - operand
|
83
|
+
else
|
84
|
+
TimeIndex.new @total_seconds - operand.total_seconds
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def * operand
|
89
|
+
TimeIndex.new total_seconds * operand
|
90
|
+
end
|
91
|
+
|
92
|
+
def / operand
|
93
|
+
if operand.instance_of? Fixnum
|
94
|
+
TimeIndex.new @total_seconds / operand
|
95
|
+
else
|
96
|
+
@total_seconds / operand.total_seconds
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def <=> operand
|
101
|
+
@total_seconds <=> operand.total_seconds
|
102
|
+
end
|
103
|
+
|
104
|
+
def sign
|
105
|
+
return '-' if @total_seconds < 0
|
106
|
+
''
|
107
|
+
end
|
108
|
+
|
109
|
+
def to_s
|
110
|
+
"#{sign}#{hours}h#{"%02d" % minutes}m#{"%02d" % seconds}s"
|
111
|
+
end
|
112
|
+
|
113
|
+
def to_timestamp
|
114
|
+
if hours == 0
|
115
|
+
"#{sign}#{"%02d" % minutes}:#{"%02d" % seconds}"
|
116
|
+
else
|
117
|
+
"#{sign}#{hours}:#{"%02d" % minutes}:#{"%02d" % seconds}"
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
data/lib/tools.rb
CHANGED
@@ -1,70 +1,81 @@
|
|
1
|
-
#
|
2
|
-
# Dependencies
|
3
|
-
#
|
4
|
-
|
5
|
-
module VCSRuby
|
6
|
-
|
7
|
-
class Tools
|
8
|
-
def self.windows?
|
9
|
-
return ((RUBY_PLATFORM =~ /win32/ or RUBY_PLATFORM =~ /mingw32/) or (RbConfig::CONFIG['host_os'] =~ /mswin|windows/i))
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.linux?
|
13
|
-
return ((RUBY_PLATFORM =~ /linux/) or (RbConfig::CONFIG['host_os'] =~ /linux/i))
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.list_arguments arguments
|
17
|
-
arguments.map{ |argument| argument.to_s }.join(', ')
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.print_help optparse
|
21
|
-
puts optparse.summarize
|
22
|
-
exit 0
|
23
|
-
end
|
24
|
-
|
25
|
-
MagickVersion = Struct.new(:major, :minor, :revision)
|
26
|
-
def self.magick_version
|
27
|
-
output = %x[convert -version]
|
28
|
-
m = output.match /(\d+)\.(\d+)\.(\d+)(-(\d+))?/
|
29
|
-
MagickVersion.new(m[1].to_i, m[2].to_i, m[3].to_i)
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.contact_sheet_with_options video, options
|
33
|
-
Configuration.instance.load_profile options[:profile] if options[:profile]
|
34
|
-
Configuration.instance.capturer = options[:capturer]
|
35
|
-
|
36
|
-
video = VCSRuby::Video.new video
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
sheet.
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
1
|
+
#
|
2
|
+
# Dependencies
|
3
|
+
#
|
4
|
+
|
5
|
+
module VCSRuby
|
6
|
+
|
7
|
+
class Tools
|
8
|
+
def self.windows?
|
9
|
+
return ((RUBY_PLATFORM =~ /win32/ or RUBY_PLATFORM =~ /mingw32/) or (RbConfig::CONFIG['host_os'] =~ /mswin|windows/i))
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.linux?
|
13
|
+
return ((RUBY_PLATFORM =~ /linux/) or (RbConfig::CONFIG['host_os'] =~ /linux/i))
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.list_arguments arguments
|
17
|
+
arguments.map{ |argument| argument.to_s }.join(', ')
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.print_help optparse
|
21
|
+
puts optparse.summarize
|
22
|
+
exit 0
|
23
|
+
end
|
24
|
+
|
25
|
+
MagickVersion = Struct.new(:major, :minor, :revision)
|
26
|
+
def self.magick_version
|
27
|
+
output = %x[convert -version]
|
28
|
+
m = output.match /(\d+)\.(\d+)\.(\d+)(-(\d+))?/
|
29
|
+
MagickVersion.new(m[1].to_i, m[2].to_i, m[3].to_i)
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.contact_sheet_with_options video, options
|
33
|
+
Configuration.instance.load_profile options[:profile] if options[:profile]
|
34
|
+
Configuration.instance.capturer = options[:capturer]
|
35
|
+
|
36
|
+
video = VCSRuby::Video.new video
|
37
|
+
|
38
|
+
unless video.valid?
|
39
|
+
puts "Video '#{video.full_path}' cannot be read by Capturer '#{video.capturer_name}'"
|
40
|
+
return nil
|
41
|
+
end
|
42
|
+
|
43
|
+
sheet = video.contact_sheet
|
44
|
+
|
45
|
+
sheet.format = options[:format] if options[:format]
|
46
|
+
sheet.title = options[:title] if options[:title]
|
47
|
+
sheet.signature = options[:signature] if options[:signature]
|
48
|
+
sheet.signature = nil if options[:no_signature]
|
49
|
+
|
50
|
+
if options[:rows] || options[:columns] || options[:interval]
|
51
|
+
sheet.initialize_geometry(options[:rows], options[:columns], options[:interval])
|
52
|
+
end
|
53
|
+
|
54
|
+
if options[:width] && options[:height]
|
55
|
+
sheet.aspect_ratio = Rational(options[:width], options[:height])
|
56
|
+
else
|
57
|
+
sheet.aspect_ratio = options[:aspect_ratio] if options[:aspect_ratio]
|
58
|
+
end
|
59
|
+
sheet.thumbnail_width = options[:width] if options[:width]
|
60
|
+
sheet.thumbnail_height = options[:height] if options[:height]
|
61
|
+
sheet.from = options[:from] if options[:from]
|
62
|
+
sheet.to = options[:to] if options[:to]
|
63
|
+
sheet.highlight = options[:highlight] if options[:highlight]
|
64
|
+
|
65
|
+
sheet.timestamp = options[:timestamp] if options[:timestamp] != nil
|
66
|
+
sheet.softshadow = options[:softshadow] if options[:softshadow] != nil
|
67
|
+
sheet.polaroid = options[:polaroid] if options[:polaroid] != nil
|
68
|
+
|
69
|
+
return sheet
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.to_human_size size
|
73
|
+
powers = { 'B' => 1 << 10, 'KiB' => 1 << 20, 'MiB' => 1 << 30, 'GiB' => 1 << 40, 'TiB' => 1 << 50 }
|
74
|
+
powers.each_pair do |prefix, power|
|
75
|
+
if size < power
|
76
|
+
return format('%.2f',size.to_f / (power >> 10)) + ' ' + prefix
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
data/lib/vcs.rb
CHANGED
@@ -1,26 +1,26 @@
|
|
1
|
-
#
|
2
|
-
# Video Contact Sheet Ruby
|
3
|
-
#
|
4
|
-
|
5
|
-
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
|
6
|
-
|
7
|
-
require 'command'
|
8
|
-
require 'configuration'
|
9
|
-
require 'contact_sheet'
|
10
|
-
require 'video'
|
11
|
-
require 'frame'
|
12
|
-
require 'time_index'
|
13
|
-
require 'tools'
|
14
|
-
require 'version'
|
15
|
-
require 'FFmpeg/ffmpeg'
|
16
|
-
require 'FFmpeg/ffmpeg_audio_stream'
|
17
|
-
require 'FFmpeg/ffmpeg_video_stream'
|
18
|
-
require 'FFmpeg/ffmpeg_meta_info'
|
19
|
-
require 'libAV/libav'
|
20
|
-
require 'libAV/libav_audio_stream'
|
21
|
-
require 'libAV/libav_video_stream'
|
22
|
-
require 'libAV/libav_meta_info'
|
23
|
-
require 'MPlayer/mplayer'
|
24
|
-
require 'MPlayer/mplayer_audio_stream'
|
25
|
-
require 'MPlayer/mplayer_video_stream'
|
26
|
-
require 'MPlayer/mplayer_meta_info'
|
1
|
+
#
|
2
|
+
# Video Contact Sheet Ruby
|
3
|
+
#
|
4
|
+
|
5
|
+
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
|
6
|
+
|
7
|
+
require 'command'
|
8
|
+
require 'configuration'
|
9
|
+
require 'contact_sheet'
|
10
|
+
require 'video'
|
11
|
+
require 'frame'
|
12
|
+
require 'time_index'
|
13
|
+
require 'tools'
|
14
|
+
require 'version'
|
15
|
+
require 'FFmpeg/ffmpeg'
|
16
|
+
require 'FFmpeg/ffmpeg_audio_stream'
|
17
|
+
require 'FFmpeg/ffmpeg_video_stream'
|
18
|
+
require 'FFmpeg/ffmpeg_meta_info'
|
19
|
+
require 'libAV/libav'
|
20
|
+
require 'libAV/libav_audio_stream'
|
21
|
+
require 'libAV/libav_video_stream'
|
22
|
+
require 'libAV/libav_meta_info'
|
23
|
+
require 'MPlayer/mplayer'
|
24
|
+
require 'MPlayer/mplayer_audio_stream'
|
25
|
+
require 'MPlayer/mplayer_video_stream'
|
26
|
+
require 'MPlayer/mplayer_meta_info'
|
data/lib/version.info
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.9
|
data/lib/version.rb
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
#
|
2
|
-
# Version of vcs.rb
|
3
|
-
#
|
4
|
-
|
5
|
-
module VCSRuby
|
6
|
-
def self.version_path
|
7
|
-
File.expand_path("version.info", File.dirname(__FILE__))
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.read_version
|
11
|
-
File.open(version_path, &:readline)
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.update_version
|
15
|
-
current_version = read_version
|
16
|
-
parts = File.open(version_path, &:readline).split('.').map(&:strip)
|
17
|
-
parts[2] = (parts[2].to_i + 1).to_s
|
18
|
-
File.open(version_path, 'w') {|f| f.write(parts.join('.')) }
|
19
|
-
current_version
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
$vcs_ruby_version = Gem::Version.new(VCSRuby::read_version)
|
24
|
-
$vcs_ruby_name = 'Video Contact Sheet Ruby'
|
25
|
-
$vcs_ruby_short = 'vcr.rb'
|
1
|
+
#
|
2
|
+
# Version of vcs.rb
|
3
|
+
#
|
4
|
+
|
5
|
+
module VCSRuby
|
6
|
+
def self.version_path
|
7
|
+
File.expand_path("version.info", File.dirname(__FILE__))
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.read_version
|
11
|
+
File.open(version_path, &:readline)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.update_version
|
15
|
+
current_version = read_version
|
16
|
+
parts = File.open(version_path, &:readline).split('.').map(&:strip)
|
17
|
+
parts[2] = (parts[2].to_i + 1).to_s
|
18
|
+
File.open(version_path, 'w') {|f| f.write(parts.join('.')) }
|
19
|
+
current_version
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
$vcs_ruby_version = Gem::Version.new(VCSRuby::read_version)
|
24
|
+
$vcs_ruby_name = 'Video Contact Sheet Ruby'
|
25
|
+
$vcs_ruby_short = 'vcr.rb'
|