vtools 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -4
- data/Rakefile +3 -4
- data/Vtools.komodoproject +12 -0
- data/Vtools.project +12 -0
- data/doc/CONFIG.md +5 -5
- data/doc/HOOKS.md +1 -1
- data/doc/LIB_EXAMPLE.md +28 -15
- data/extconf.rb +10 -0
- data/lib/vtools/config.rb +19 -16
- data/lib/vtools/convert_options.rb +3 -3
- data/lib/vtools/errors.rb +8 -4
- data/lib/vtools/shared_methods.rb +18 -8
- data/lib/vtools/thumbs_options.rb +1 -1
- data/lib/vtools/version.rb +1 -1
- data/lib/vtools/video.rb +1 -1
- data/spec/convert_options_spec.rb +3 -3
- data/spec/converter_spec.rb +1 -1
- data/spec/errors_spec.rb +12 -4
- data/spec/handler_spec.rb +1 -1
- data/spec/job_spec.rb +2 -2
- data/spec/options_spec.rb +4 -4
- data/spec/shared_methods_spec.rb +33 -14
- data/spec/spec_helper.rb +1 -1
- data/spec/storage_spec.rb +1 -1
- data/spec/thumbnailer_spec.rb +1 -1
- data/spec/thumbs_options_spec.rb +1 -1
- data/vtools.gemspec +5 -4
- metadata +57 -52
- data/vtools-0.0.2.gem +0 -0
data/README.md
CHANGED
@@ -19,7 +19,7 @@ Please read changelog to check ffmpeg versions compatibility (vtools understands
|
|
19
19
|
Before start, daemon should be configured correctly, to have valid access to the storage.
|
20
20
|
Mandatory methods are: **connect**, **recv** and **send**.
|
21
21
|
|
22
|
-
```
|
22
|
+
```ruby
|
23
23
|
#--file library.rb--#
|
24
24
|
# encoding: binary
|
25
25
|
|
@@ -103,7 +103,7 @@ To launch daemon - is enough to require library with storage setup:
|
|
103
103
|
|
104
104
|
By default the `logger` gem is used. But there is possibility to set custom logger, that is compatible with the default logger.
|
105
105
|
|
106
|
-
```
|
106
|
+
```ruby
|
107
107
|
VTools.logger = CustomLoger.new($stdout)
|
108
108
|
```
|
109
109
|
|
@@ -112,7 +112,7 @@ VTools.logger = CustomLoger.new($stdout)
|
|
112
112
|
Path generator is used by the thumnailer, converter or both to generate necessary dir tree logic for the media.
|
113
113
|
It accepts file name and should return relative path (excluding file name itself)
|
114
114
|
|
115
|
-
```
|
115
|
+
```ruby
|
116
116
|
# path generator (used to )
|
117
117
|
VTools.path_generator do |file_name|
|
118
118
|
# ..
|
@@ -123,7 +123,7 @@ end
|
|
123
123
|
|
124
124
|
**Network calls** (TCP GET request, that will return message body content, ignoring response headers)
|
125
125
|
|
126
|
-
```
|
126
|
+
```ruby
|
127
127
|
|
128
128
|
# http calls
|
129
129
|
VTools.network_call "site.com/some/uri"
|
data/Rakefile
CHANGED
@@ -8,13 +8,12 @@ require "vtools/version"
|
|
8
8
|
spec = Gem::Specification.new do |s|
|
9
9
|
s.name = "vtools"
|
10
10
|
s.summary = "Daemon tools to operate the video (get info, encode & generate thumbnails)."
|
11
|
-
s.description = "
|
12
|
-
s.extensions = 'extconf.rb'
|
11
|
+
s.description = "FFMPEG & FFMPEGTHUMBNAILER based video processor. Permits to generate thumbs and encode/edit video. Can be started as daemon."
|
13
12
|
s.version = VTools::VERSION.join('.')
|
14
|
-
s.requirements = ['ffmpeg v >=
|
13
|
+
s.requirements = ['ffmpeg v >= 0.5', 'ffmpegthumbnailer v >= 2', 'gem Daemons v >= 1.1.4']
|
15
14
|
s.author = "tofir"
|
16
15
|
s.email = "v.tofir@gmail.com"
|
17
|
-
s.homepage = "
|
16
|
+
s.homepage = "https://github.com/tofir/vtools"
|
18
17
|
s.platform = Gem::Platform::RUBY
|
19
18
|
s.required_ruby_version = ">=1.9"
|
20
19
|
s.files = Dir['**/**']
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!-- Komodo Project File - DO NOT EDIT -->
|
3
|
+
<project id="dce3e17b-c7b8-448c-9806-1c687a505039" kpf_version="5" name="Hephaestus.komodoproject">
|
4
|
+
<preference-set idref="dce3e17b-c7b8-448c-9806-1c687a505039">
|
5
|
+
<string relative="path" id="import_dirname"></string>
|
6
|
+
<string id="import_exclude_matches">*.*~;*.bak;*.tmp;CVS;.#*;*.pyo;*.pyc;.svn;*%*;tmp*.html;.DS_Store;.git;*.komodo*;*.kpf</string>
|
7
|
+
<string id="import_include_matches"></string>
|
8
|
+
<boolean id="import_live">1</boolean>
|
9
|
+
<boolean id="import_recursive">1</boolean>
|
10
|
+
<string id="import_type">useFolders</string>
|
11
|
+
</preference-set>
|
12
|
+
</project>
|
data/Vtools.project
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!-- Komodo Project File - DO NOT EDIT -->
|
3
|
+
<project id="dce3e17b-c7b8-448c-9806-1c687a505039" kpf_version="4" name="VTools">
|
4
|
+
<preference-set idref="dce3e17b-c7b8-448c-9806-1c687a505039">
|
5
|
+
<string id="import_exclude_matches">*.*~;*.bak;*.tmp;CVS;.#*;*.pyo;*.pyc;.svn;*%*;tmp*.html;.DS_Store;.git;*.komodo*;*.project;*.kpf;</string>
|
6
|
+
<string id="import_include_matches"></string>
|
7
|
+
<boolean id="import_live">1</boolean>
|
8
|
+
<boolean id="import_recursive">1</boolean>
|
9
|
+
<string id="import_type">useFolders</string>
|
10
|
+
<string relative="path" id="rubyExtraPaths">lib</string>
|
11
|
+
</preference-set>
|
12
|
+
</project>
|
data/doc/CONFIG.md
CHANGED
@@ -12,24 +12,24 @@ To make VTools parse config file it should be given to it with -c option:
|
|
12
12
|
:ffmpeg_binary: 'ffmpeg'
|
13
13
|
:thumb_binary: 'ffmpegthumbnailer'
|
14
14
|
:library: ['lib.rb']
|
15
|
-
|
15
|
+
|
16
16
|
#harvester
|
17
17
|
:max_jobs: 5
|
18
18
|
:harvester_timer: 3 # timeout between job requests
|
19
19
|
:temp_dir: "/tmp"
|
20
|
-
|
20
|
+
|
21
21
|
#converter
|
22
22
|
:validate_duration: false
|
23
23
|
:video_storage: "/home/projects/video_storage"
|
24
|
-
|
24
|
+
|
25
25
|
#thumbnailer
|
26
26
|
:thumb_storage: "/home/projects/thumb_storage"
|
27
|
-
|
27
|
+
|
28
28
|
#predefined video qualities
|
29
29
|
:video_set:
|
30
30
|
# SET_NAME -vcodec -acodec -s WDTxHGT -vb -ab -ar -ac EXT POSTFIX [-vpre]
|
31
31
|
:x264_180p: [ 'libx264', 'libfaac', '240x180', '96k', '64k', 22050, 2, 'mp4', '_180', 'normal' ]
|
32
|
-
|
32
|
+
|
33
33
|
# predefined thumbnailer setup
|
34
34
|
:thumb_set:
|
35
35
|
# SET_NAME -s -q count start%
|
data/doc/HOOKS.md
CHANGED
data/doc/LIB_EXAMPLE.md
CHANGED
@@ -7,43 +7,56 @@ $ vtools start -- -r library
|
|
7
7
|
$ vtools start -- -r library.rb
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
#
|
10
|
+
# encoding: binary
|
11
|
+
|
11
12
|
|
12
13
|
# path generator
|
13
|
-
VTools.path_generator do |file_name|
|
14
|
+
VTools.path_generator("video") do |file_name|
|
14
15
|
|
15
|
-
storage_path = VTools::CONFIG[:PWD] + "/../test_storage"
|
16
16
|
first = file_name[0...2]
|
17
17
|
second = file_name[2...4]
|
18
|
-
# create all parent dirs (storage... path .. )
|
19
|
-
|
20
|
-
|
18
|
+
# create all parent dirs (storage... path .. )
|
19
|
+
error = `mkdir -p #{VTools::CONFIG[:video_storage]}/#{first}/#{second}`
|
20
|
+
if error.empty?
|
21
|
+
"#{first}/#{second}"
|
21
22
|
else
|
22
23
|
raise Exception, "Can't create storage dirs (#{error})"
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
26
|
-
|
27
|
+
|
28
|
+
# setup storage:
|
27
29
|
VTools::Storage.setup do
|
28
30
|
|
31
|
+
# connection setup
|
29
32
|
connect_action do
|
30
|
-
|
31
|
-
|
33
|
+
require "zmq"
|
34
|
+
@mq = ZMQ::Context.new(1)
|
35
|
+
|
36
|
+
@pull = @mq.socket(ZMQ::PULL)
|
37
|
+
@push = @mq.socket(ZMQ::PUSH)
|
38
|
+
|
39
|
+
# connect to the mq fibers
|
40
|
+
@pull.bind("tcp://*:4440");
|
41
|
+
@push.connect("tcp://*:5555");
|
32
42
|
end
|
33
43
|
|
34
|
-
#
|
44
|
+
# message reciever
|
45
|
+
# should return JSON encoded string
|
46
|
+
# see complete storage setup reference for details
|
35
47
|
recv_action do
|
36
|
-
|
37
|
-
setup = "{\"set\" : \"flv_240p\", \"acodec\" : \"#{job}\" }"
|
38
|
-
"{\"action\" : \"#{action}\", \"file\" : \"#{file}\", \"setup\" : #{setup} }"
|
48
|
+
@pull.recv
|
39
49
|
end
|
40
50
|
|
51
|
+
# message sender
|
52
|
+
# receives hash: { :data => execution_result, :action => executed_action }
|
53
|
+
# execution_result can be video object or array with thumbnails
|
41
54
|
send_action do |result|
|
42
|
-
@
|
43
|
-
print "----------------> 'terminated' MQ sent (#{result[:data].to_json}) - action #{result[:action]}\n"
|
55
|
+
@push.send "#{result[:action]} #{result[:data].name}"
|
44
56
|
end
|
45
57
|
end
|
46
58
|
|
59
|
+
|
47
60
|
# hooks
|
48
61
|
VTools::Handler.collection do
|
49
62
|
|
data/extconf.rb
ADDED
data/lib/vtools/config.rb
CHANGED
@@ -6,25 +6,28 @@ module VTools
|
|
6
6
|
CONFIG = {
|
7
7
|
|
8
8
|
# system environment
|
9
|
-
:PWD
|
10
|
-
:library
|
11
|
-
:logging
|
12
|
-
:log_file
|
13
|
-
:config_file
|
14
|
-
:ffmpeg_binary
|
15
|
-
:thumb_binary
|
9
|
+
:PWD => Dir.getwd,
|
10
|
+
:library => [],
|
11
|
+
:logging => nil,
|
12
|
+
:log_file => nil,
|
13
|
+
:config_file => nil,
|
14
|
+
:ffmpeg_binary => '/usr/bin/ffmpeg',
|
15
|
+
:thumb_binary => '/usr/bin/ffmpegthumbnailer',
|
16
16
|
|
17
17
|
# harvester
|
18
|
-
:max_jobs
|
19
|
-
:store_jobs
|
20
|
-
:harvester_timer
|
21
|
-
:temp_dir
|
18
|
+
:max_jobs => 5,
|
19
|
+
:store_jobs => 10,
|
20
|
+
:harvester_timer => 3,
|
21
|
+
:temp_dir => '',
|
22
22
|
|
23
23
|
# converter
|
24
|
-
:video_storage
|
25
|
-
:
|
24
|
+
:video_storage => '',
|
25
|
+
:video_path_generator => nil,
|
26
|
+
:validate_duration => nil,
|
27
|
+
|
26
28
|
# thumbnailer
|
27
|
-
:thumb_storage
|
29
|
+
:thumb_storage => '',
|
30
|
+
:thumb_path_generator => nil,
|
28
31
|
|
29
32
|
# predefined video qualities
|
30
33
|
:video_set => {
|
@@ -61,7 +64,7 @@ module VTools
|
|
61
64
|
:w600 => [600, 10, 5, 0],
|
62
65
|
}
|
63
66
|
}
|
64
|
-
|
67
|
+
|
65
68
|
# parse external config file
|
66
69
|
def CONFIG.load!
|
67
70
|
begin
|
@@ -72,7 +75,7 @@ module VTools
|
|
72
75
|
raise ConfigError, "Invalid config data #{e}"
|
73
76
|
end if self[:config_file]
|
74
77
|
end
|
75
|
-
|
78
|
+
|
76
79
|
# merge config data
|
77
80
|
def CONFIG.append! data
|
78
81
|
direct = [:ffmpeg_binary, :thumb_binary, :max_jobs, :store_jobs,
|
@@ -94,14 +94,14 @@ module VTools
|
|
94
94
|
hash[:t] = hash[:duration] if hash[:duration]
|
95
95
|
|
96
96
|
dimmensions = hash[:resolution] ||
|
97
|
-
("#{hash[:width]}x#{hash[:height]}" if hash[:width] && hash[:height]) ||
|
97
|
+
("#{hash[:width].to_i}x#{hash[:height].to_i}" if hash[:width] && hash[:height]) ||
|
98
98
|
hash[:s]
|
99
99
|
|
100
100
|
if dimmensions
|
101
101
|
# recreate dimmensions dimmensions
|
102
102
|
if hash[:preserve_aspect]
|
103
103
|
width, height = recalculate dimmensions
|
104
|
-
dimmensions = "#{width}x#{height}"
|
104
|
+
dimmensions = "#{width.to_i}x#{height.to_i}"
|
105
105
|
end
|
106
106
|
|
107
107
|
hash[:s] = dimmensions
|
@@ -114,7 +114,7 @@ module VTools
|
|
114
114
|
def recalculate dimm
|
115
115
|
width, height = dimm.split("x").map(&:to_f)
|
116
116
|
|
117
|
-
return [width, height] unless self[:aspect]
|
117
|
+
return [width, height].map(&:to_i) unless self[:aspect]
|
118
118
|
|
119
119
|
# width main:
|
120
120
|
if self[:aspect] > 1
|
data/lib/vtools/errors.rb
CHANGED
@@ -3,19 +3,23 @@
|
|
3
3
|
# VTools exceptions
|
4
4
|
module VTools
|
5
5
|
|
6
|
+
# basic error
|
7
|
+
class Error < Exception
|
8
|
+
end
|
9
|
+
|
6
10
|
# confuguration error
|
7
|
-
class ConfigError <
|
11
|
+
class ConfigError < Error
|
8
12
|
end
|
9
13
|
|
10
14
|
# specified file does not exist
|
11
|
-
class FileError <
|
15
|
+
class FileError < Error
|
12
16
|
end
|
13
17
|
|
14
18
|
# invalid video format
|
15
|
-
class FormatError <
|
19
|
+
class FormatError < Error
|
16
20
|
end
|
17
21
|
|
18
22
|
# invalid video format
|
19
|
-
class ProcessError <
|
23
|
+
class ProcessError < Error
|
20
24
|
end
|
21
25
|
end # VTools
|
@@ -8,7 +8,7 @@ module VTools
|
|
8
8
|
module Common
|
9
9
|
|
10
10
|
@@logger = nil
|
11
|
-
|
11
|
+
|
12
12
|
# custom logger
|
13
13
|
def logger= logger
|
14
14
|
@@logger = logger
|
@@ -16,7 +16,7 @@ module VTools
|
|
16
16
|
|
17
17
|
# logger mechanics
|
18
18
|
def log level, message = ""
|
19
|
-
|
19
|
+
|
20
20
|
if CONFIG[:logging]
|
21
21
|
unless @@logger
|
22
22
|
output = CONFIG[:log_file] || STDOUT
|
@@ -28,7 +28,7 @@ module VTools
|
|
28
28
|
@@logger.send(level, message) if @@logger
|
29
29
|
end
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
# converts json to the ruby object
|
33
33
|
# returns nil on invalid JSON
|
34
34
|
def json_to_obj json_str
|
@@ -78,18 +78,28 @@ module VTools
|
|
78
78
|
|
79
79
|
# function to create correct subdirectories to the file
|
80
80
|
def generate_path file_name, scope = "video"
|
81
|
-
|
82
|
-
|
83
|
-
|
81
|
+
generator = CONFIG[:"#{scope}_path_generator"]
|
82
|
+
begin
|
83
|
+
generator = instance_exec(file_name, &generator).to_s if generator.is_a? Proc
|
84
|
+
rescue => e
|
85
|
+
generator = nil
|
86
|
+
raise ConfigError, "Path generator error (#{e})"
|
87
|
+
end
|
88
|
+
|
89
|
+
storage = CONFIG[:"#{scope}_storage"].to_s
|
90
|
+
storage += "/" unless storage.empty?
|
91
|
+
storage += generator || ""
|
92
|
+
|
93
|
+
(!storage || storage.empty? ? CONFIG[:PWD] : storage).to_s.strip.gsub(%r#/+#, '/').gsub(%r#/$#, '')
|
84
94
|
end
|
85
95
|
|
86
96
|
# path generator setter
|
87
97
|
def path_generator scope = nil, &block
|
88
98
|
if scope
|
89
99
|
scope = "thumb" unless scope == "video"
|
90
|
-
CONFIG[:"#{scope}
|
100
|
+
CONFIG[:"#{scope}_path_generator"] = block
|
91
101
|
else
|
92
|
-
CONFIG[:
|
102
|
+
CONFIG[:thumb_path_generator] = CONFIG[:video_path_generator] = block
|
93
103
|
end if block_given?
|
94
104
|
end
|
95
105
|
|
data/lib/vtools/version.rb
CHANGED
data/lib/vtools/video.rb
CHANGED
@@ -155,7 +155,7 @@ describe VTools::ConvertOptions do
|
|
155
155
|
@options.method(:perform).call values
|
156
156
|
values[:s].should be nil
|
157
157
|
end
|
158
|
-
end
|
158
|
+
end
|
159
159
|
|
160
160
|
context "#parse!" do
|
161
161
|
|
@@ -205,7 +205,7 @@ describe VTools::ConvertOptions do
|
|
205
205
|
expect {@options.method(:parse!).call(123) }.to raise_error VTools::ConfigError
|
206
206
|
expect {@options.method(:parse!).call("nonexistent") }.to raise_error VTools::ConfigError
|
207
207
|
end
|
208
|
-
end
|
208
|
+
end
|
209
209
|
|
210
210
|
context "#recalculate" do
|
211
211
|
|
@@ -271,7 +271,7 @@ describe VTools::ConvertOptions do
|
|
271
271
|
height.should == result[1]
|
272
272
|
end
|
273
273
|
end
|
274
|
-
end
|
274
|
+
end
|
275
275
|
|
276
276
|
context "#initialize" do
|
277
277
|
it "valid calls methods" do
|
data/spec/converter_spec.rb
CHANGED
data/spec/errors_spec.rb
CHANGED
@@ -8,32 +8,40 @@ require "errors"
|
|
8
8
|
|
9
9
|
describe VTools do
|
10
10
|
|
11
|
+
# specs
|
12
|
+
context "#VToolsError" do
|
13
|
+
|
14
|
+
it "valid exception tree" do
|
15
|
+
expect { raise VTools::Error }.to raise_error Exception
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
11
19
|
# specs
|
12
20
|
context "#ConfigError" do
|
13
21
|
|
14
22
|
it "valid exception tree" do
|
15
|
-
expect { raise VTools::ConfigError }.to raise_error
|
23
|
+
expect { raise VTools::ConfigError }.to raise_error VTools::Error
|
16
24
|
end
|
17
25
|
end
|
18
26
|
|
19
27
|
context "#FileError" do
|
20
28
|
|
21
29
|
it "valid exception tree" do
|
22
|
-
expect { raise VTools::FileError }.to raise_error
|
30
|
+
expect { raise VTools::FileError }.to raise_error VTools::Error
|
23
31
|
end
|
24
32
|
end
|
25
33
|
|
26
34
|
context "#FormatError" do
|
27
35
|
|
28
36
|
it "valid exception tree" do
|
29
|
-
expect { raise VTools::FormatError }.to raise_error
|
37
|
+
expect { raise VTools::FormatError }.to raise_error VTools::Error
|
30
38
|
end
|
31
39
|
end
|
32
40
|
|
33
41
|
context "#ProcessError" do
|
34
42
|
|
35
43
|
it "valid exception tree" do
|
36
|
-
expect { raise VTools::ProcessError }.to raise_error
|
44
|
+
expect { raise VTools::ProcessError }.to raise_error VTools::Error
|
37
45
|
end
|
38
46
|
end
|
39
47
|
end
|
data/spec/handler_spec.rb
CHANGED
data/spec/job_spec.rb
CHANGED
@@ -68,7 +68,7 @@ describe VTools::Job do
|
|
68
68
|
context "#validate" do
|
69
69
|
|
70
70
|
it "accepts options" do
|
71
|
-
|
71
|
+
|
72
72
|
["convert", "thumbs", "info"].each do |action|
|
73
73
|
conf = config.dup
|
74
74
|
conf.action = action
|
@@ -84,7 +84,7 @@ describe VTools::Job do
|
|
84
84
|
expect { @job.validate(conf) }.to raise_error VTools::ConfigError, message_rx
|
85
85
|
end
|
86
86
|
|
87
|
-
|
87
|
+
|
88
88
|
["convert", "thumbs", "info"].each do |action|
|
89
89
|
# empty config
|
90
90
|
conf = OpenStruct.new({})
|
data/spec/options_spec.rb
CHANGED
data/spec/shared_methods_spec.rb
CHANGED
@@ -57,7 +57,7 @@ describe VTools::SharedMethods do
|
|
57
57
|
|
58
58
|
@class.logger = tester
|
59
59
|
tester.should_not_receive :send
|
60
|
-
|
60
|
+
|
61
61
|
@class.log :test, "test"
|
62
62
|
end
|
63
63
|
|
@@ -148,7 +148,7 @@ describe VTools::SharedMethods do
|
|
148
148
|
|
149
149
|
let(:sock) { double nil }
|
150
150
|
let(:tcp_request) { "GET / HTTP/1.0\r\n\r\n" }
|
151
|
-
|
151
|
+
|
152
152
|
def validate_request body
|
153
153
|
sock.should_receive(:print).with( tcp_request ).once
|
154
154
|
sock.should_receive(:read).once.and_return "headers\r\n\r\n#{body}"
|
@@ -209,8 +209,24 @@ describe VTools::SharedMethods do
|
|
209
209
|
"test/path"
|
210
210
|
end
|
211
211
|
|
212
|
-
VTools::CONFIG[:video_storage] =
|
213
|
-
|
212
|
+
VTools::CONFIG[:video_storage] = '/root/'
|
213
|
+
VTools::CONFIG[:video_path_generator] = prc
|
214
|
+
@class.generate_path("test.filename", "video").should == "/root/test/path"
|
215
|
+
|
216
|
+
VTools::CONFIG[:thumb_storage] = 'root'
|
217
|
+
VTools::CONFIG[:thumb_path_generator] = prc
|
218
|
+
@class.generate_path("test.filename", "thumb").should == "root/test/path"
|
219
|
+
end
|
220
|
+
|
221
|
+
it "raises exception on invalid block" do
|
222
|
+
prc = proc do
|
223
|
+
CONFIG[:thumb_storage]
|
224
|
+
end
|
225
|
+
|
226
|
+
VTools::CONFIG[:video_path_generator] = prc
|
227
|
+
expect do
|
228
|
+
@class.generate_path("test.filename", "video").should == "/root/test/path"
|
229
|
+
end.to raise_error VTools::ConfigError, /Path generator error/
|
214
230
|
end
|
215
231
|
end
|
216
232
|
|
@@ -219,42 +235,45 @@ describe VTools::SharedMethods do
|
|
219
235
|
before do
|
220
236
|
VTools::CONFIG[:video_storage] = nil
|
221
237
|
VTools::CONFIG[:thumb_storage] = nil
|
238
|
+
VTools::CONFIG[:thumb_path_generator] = nil
|
239
|
+
VTools::CONFIG[:video_path_generator] = nil
|
222
240
|
end
|
223
241
|
|
224
242
|
let(:block) { proc { nil } }
|
225
243
|
|
226
244
|
it "appends generator to thumbs" do
|
227
245
|
@class.path_generator "thumb", &block
|
228
|
-
VTools::CONFIG[:
|
246
|
+
VTools::CONFIG[:thumb_path_generator].should == block
|
247
|
+
VTools::CONFIG[:video_path_generator].should be nil
|
229
248
|
end
|
230
249
|
|
231
250
|
it "appends generator to thumbs (invalid placeholedr given)" do
|
232
251
|
@class.path_generator "invalid", &block
|
233
|
-
VTools::CONFIG[:
|
234
|
-
VTools::CONFIG[:
|
252
|
+
VTools::CONFIG[:thumb_path_generator].should == block
|
253
|
+
VTools::CONFIG[:video_path_generator].should be nil
|
235
254
|
end
|
236
255
|
|
237
256
|
it "appends generator to video" do
|
238
257
|
@class.path_generator "video", &block
|
239
|
-
VTools::CONFIG[:
|
240
|
-
VTools::CONFIG[:
|
258
|
+
VTools::CONFIG[:video_path_generator].should == block
|
259
|
+
VTools::CONFIG[:thumb_path_generator].should be nil
|
241
260
|
end
|
242
261
|
|
243
262
|
it "appends generator to both (default)" do
|
244
263
|
@class.path_generator &block
|
245
|
-
VTools::CONFIG[:
|
246
|
-
VTools::CONFIG[:
|
264
|
+
VTools::CONFIG[:video_path_generator].should == block
|
265
|
+
VTools::CONFIG[:thumb_path_generator].should == block
|
247
266
|
end
|
248
267
|
|
249
268
|
it "skips generator appending" do
|
250
269
|
@class.path_generator
|
251
|
-
VTools::CONFIG[:
|
252
|
-
VTools::CONFIG[:
|
270
|
+
VTools::CONFIG[:video_path_generator].should be nil
|
271
|
+
VTools::CONFIG[:thumb_path_generator].should be nil
|
253
272
|
end
|
254
273
|
end
|
255
274
|
|
256
275
|
context "#fix_encoding" do
|
257
|
-
|
276
|
+
|
258
277
|
it "fixes encoding" do
|
259
278
|
path = "#{File.realpath(File.dirname(__FILE__))}/fixtures/outputs/"
|
260
279
|
source = File.open("#{path}file_with_iso-8859-1.txt", "r").read
|
data/spec/spec_helper.rb
CHANGED
data/spec/storage_spec.rb
CHANGED
@@ -99,7 +99,7 @@ describe VTools::Storage do
|
|
99
99
|
context "#fails" do
|
100
100
|
it "raises error with valid message" do
|
101
101
|
expect do
|
102
|
-
VTools::Storage.method(:fails).call("test_method")
|
102
|
+
VTools::Storage.method(:fails).call("test_method")
|
103
103
|
end.to raise_error NotImplementedError, "VTools::Storage#test_method_action must be set"
|
104
104
|
end
|
105
105
|
end
|
data/spec/thumbnailer_spec.rb
CHANGED
data/spec/thumbs_options_spec.rb
CHANGED
@@ -91,7 +91,7 @@ describe VTools::ThumbsOptions do
|
|
91
91
|
it "converts valid data" do
|
92
92
|
values = { :quality => 5, :width => 600, :time => 123 }
|
93
93
|
@options.method(:perform).call values
|
94
|
-
|
94
|
+
|
95
95
|
values[:q].should == values[:quality]
|
96
96
|
values[:s].should == values[:width]
|
97
97
|
values[:t].should == values[:t]
|
data/vtools.gemspec
CHANGED
@@ -7,21 +7,22 @@ Gem::Specification.new do |s|
|
|
7
7
|
|
8
8
|
s.name = "vtools"
|
9
9
|
s.summary = "Daemon tools to operate the video (get info, encode & generate thumbnails)."
|
10
|
-
s.description = "
|
10
|
+
s.description = "FFMPEG & FFMPEGTHUMBNAILER based video processor. Permits to generate thumbs and encode/edit video. Can be started as daemon."
|
11
11
|
|
12
|
-
s.requirements = ['ffmpeg v >=
|
12
|
+
s.requirements = ['ffmpeg v >= 0.5', 'ffmpegthumbnailer v >= 2', 'gem Daemons v >= 1.1.4']
|
13
13
|
|
14
14
|
s.files = Dir['**/**']
|
15
15
|
s.test_files = Dir["spec/*_spec.rb"]
|
16
16
|
s.executables = ["vtools"]
|
17
|
+
s.extensions = ["extconf.rb"]
|
17
18
|
|
18
19
|
s.version = VTools::VERSION.join('.')
|
19
20
|
s.author = "tofir"
|
20
21
|
s.email = "v.tofir@gmail.com"
|
21
|
-
s.homepage = "
|
22
|
+
s.homepage = "https://github.com/tofir/vtools"
|
22
23
|
s.platform = Gem::Platform::RUBY
|
23
24
|
s.required_ruby_version = ">=1.9"
|
24
|
-
|
25
|
+
|
25
26
|
s.add_dependency 'daemons', '>= 1.1.4'
|
26
27
|
s.add_dependency 'json'
|
27
28
|
s.add_development_dependency 'rspec'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vtools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-12-13 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: daemons
|
16
|
-
requirement: &
|
16
|
+
requirement: &82591300 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.1.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *82591300
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: json
|
27
|
-
requirement: &
|
27
|
+
requirement: &82591110 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *82591110
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &82590880 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,60 +43,65 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
47
|
-
description:
|
46
|
+
version_requirements: *82590880
|
47
|
+
description: FFMPEG & FFMPEGTHUMBNAILER based video processor. Permits to generate
|
48
|
+
thumbs and encode/edit video. Can be started as daemon.
|
48
49
|
email: v.tofir@gmail.com
|
49
50
|
executables:
|
50
51
|
- vtools
|
51
|
-
extensions:
|
52
|
+
extensions:
|
53
|
+
- extconf.rb
|
52
54
|
extra_rdoc_files: []
|
53
55
|
files:
|
56
|
+
- extconf.rb
|
57
|
+
- vtools.gemspec
|
58
|
+
- Rakefile
|
59
|
+
- vtools-0.1.0.gem
|
60
|
+
- INSTALL
|
61
|
+
- doc/HOOKS.md
|
62
|
+
- doc/LIB_EXAMPLE.md
|
63
|
+
- doc/CONFIG.md
|
54
64
|
- bin/vtools
|
55
65
|
- README.md
|
56
|
-
-
|
57
|
-
- lib/vtools.rb
|
58
|
-
- lib/vtools/video.rb
|
59
|
-
- lib/vtools/harvester.rb
|
66
|
+
- Vtools.komodoproject
|
60
67
|
- lib/vtools/storage.rb
|
61
|
-
- lib/vtools/
|
62
|
-
- lib/vtools/version.rb
|
68
|
+
- lib/vtools/options.rb
|
63
69
|
- lib/vtools/errors.rb
|
64
|
-
- lib/vtools/job.rb
|
65
70
|
- lib/vtools/convert_options.rb
|
71
|
+
- lib/vtools/version.rb
|
72
|
+
- lib/vtools/video.rb
|
66
73
|
- lib/vtools/thumbnailer.rb
|
67
74
|
- lib/vtools/shared_methods.rb
|
68
|
-
- lib/vtools/
|
75
|
+
- lib/vtools/converter.rb
|
76
|
+
- lib/vtools/harvester.rb
|
69
77
|
- lib/vtools/config.rb
|
70
|
-
- lib/vtools/options.rb
|
71
78
|
- lib/vtools/thumbs_options.rb
|
72
|
-
-
|
73
|
-
-
|
74
|
-
-
|
75
|
-
-
|
76
|
-
-
|
77
|
-
-
|
78
|
-
- spec/
|
79
|
-
- spec/
|
80
|
-
- spec/
|
79
|
+
- lib/vtools/job.rb
|
80
|
+
- lib/vtools/handler.rb
|
81
|
+
- lib/vtools.rb
|
82
|
+
- setup.rb
|
83
|
+
- Vtools.project
|
84
|
+
- LICENSE
|
85
|
+
- spec/thumbs_options_spec.rb
|
86
|
+
- spec/handler_spec.rb
|
87
|
+
- spec/shared_methods_spec.rb
|
81
88
|
- spec/harvester_spec.rb
|
89
|
+
- spec/video_spec.rb
|
82
90
|
- spec/storage_spec.rb
|
83
91
|
- spec/errors_spec.rb
|
84
|
-
- spec/
|
85
|
-
- spec/
|
86
|
-
- spec/
|
87
|
-
- spec/spec_helper.rb
|
92
|
+
- spec/convert_options_spec.rb
|
93
|
+
- spec/config_spec.rb
|
94
|
+
- spec/job_spec.rb
|
88
95
|
- spec/thumbnailer_spec.rb
|
96
|
+
- spec/fixtures/outputs/file_with_start_value.txt
|
97
|
+
- spec/fixtures/outputs/file_with_non_supported_audio.txt
|
98
|
+
- spec/fixtures/outputs/file_with_no_audio.txt
|
99
|
+
- spec/fixtures/outputs/file_with_surround_sound.txt
|
100
|
+
- spec/fixtures/outputs/file_with_iso-8859-1.txt
|
89
101
|
- spec/options_spec.rb
|
90
|
-
- spec/
|
91
|
-
- spec/
|
92
|
-
|
93
|
-
- doc/LIB_EXAMPLE.md
|
94
|
-
- doc/CONFIG.md
|
95
|
-
- LICENSE
|
96
|
-
- vtools-0.0.2.gem
|
97
|
-
- setup.rb
|
98
|
-
- vtools.gemspec
|
99
|
-
homepage: http://tofir.comuv.com
|
102
|
+
- spec/spec_helper.rb
|
103
|
+
- spec/converter_spec.rb
|
104
|
+
homepage: https://github.com/tofir/vtools
|
100
105
|
licenses: []
|
101
106
|
post_install_message:
|
102
107
|
rdoc_options: []
|
@@ -115,25 +120,25 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
120
|
- !ruby/object:Gem::Version
|
116
121
|
version: '0'
|
117
122
|
requirements:
|
118
|
-
- ffmpeg v >=
|
123
|
+
- ffmpeg v >= 0.5
|
119
124
|
- ffmpegthumbnailer v >= 2
|
120
125
|
- gem Daemons v >= 1.1.4
|
121
126
|
rubyforge_project:
|
122
|
-
rubygems_version: 1.8.
|
127
|
+
rubygems_version: 1.8.12
|
123
128
|
signing_key:
|
124
129
|
specification_version: 3
|
125
130
|
summary: Daemon tools to operate the video (get info, encode & generate thumbnails).
|
126
131
|
test_files:
|
127
|
-
- spec/
|
128
|
-
- spec/
|
129
|
-
- spec/
|
132
|
+
- spec/thumbs_options_spec.rb
|
133
|
+
- spec/handler_spec.rb
|
134
|
+
- spec/shared_methods_spec.rb
|
130
135
|
- spec/harvester_spec.rb
|
136
|
+
- spec/video_spec.rb
|
131
137
|
- spec/storage_spec.rb
|
132
138
|
- spec/errors_spec.rb
|
133
|
-
- spec/
|
134
|
-
- spec/
|
135
|
-
- spec/
|
139
|
+
- spec/convert_options_spec.rb
|
140
|
+
- spec/config_spec.rb
|
141
|
+
- spec/job_spec.rb
|
136
142
|
- spec/thumbnailer_spec.rb
|
137
143
|
- spec/options_spec.rb
|
138
|
-
- spec/
|
139
|
-
- spec/thumbs_options_spec.rb
|
144
|
+
- spec/converter_spec.rb
|
data/vtools-0.0.2.gem
DELETED
Binary file
|