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 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
- ``` ruby
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
- ``` ruby
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
- ``` ruby
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
- ``` ruby
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 = "Daemon tools to operate the video (get info, encode & generate thumbnails)."
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 >= 1.8', 'ffmpegthumbnailer v >= 2', 'gem Daemons v >= 1.1.4']
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 = "http://tofir.comuv.com"
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>
@@ -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>
@@ -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%
@@ -17,7 +17,7 @@ Multiple actions can be attached for a single hook.
17
17
  * thumb_success (video, thumbs_array)
18
18
  * thumb_error (video, errors)
19
19
 
20
- ``` ruby
20
+ ```ruby
21
21
  # multiple hooks setup
22
22
  VTools::Handler.collection do
23
23
  set :in_convert do |video|
@@ -7,43 +7,56 @@ $ vtools start -- -r library
7
7
  $ vtools start -- -r library.rb
8
8
 
9
9
  ```ruby
10
- # -*- encoding: binary -*-
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
- if (error = `mkdir -p #{storage_path}/#{first}/#{second}`).empty?
20
- "#{storage_path}/#{first}/#{second}"
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
- # storage setup
27
+
28
+ # setup storage:
27
29
  VTools::Storage.setup do
28
30
 
31
+ # connection setup
29
32
  connect_action do
30
- @mq = MQ.new
31
- print "----------- connected to the MQ -------\n"
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
- # recieve data for processing
44
+ # message reciever
45
+ # should return JSON encoded string
46
+ # see complete storage setup reference for details
35
47
  recv_action do
36
- job = @mq.recv
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
- @mq.send "video.success #{result[:action]} "
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
 
@@ -0,0 +1,10 @@
1
+ # -*- encoding: binary -*-
2
+
3
+ require 'mkmf'
4
+
5
+ if find_executable("ffmpeg") || find_executable("ffmpegthumbnailer")
6
+ create_makefile("VTools")
7
+ else
8
+ stars = "#{"*" * 10}"
9
+ puts "", stars, "No ffmpeg / ffmpegthumbnailer support available.", stars
10
+ end
@@ -6,25 +6,28 @@ module VTools
6
6
  CONFIG = {
7
7
 
8
8
  # system environment
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',
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 => 5,
19
- :store_jobs => 10,
20
- :harvester_timer => 3,
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 => nil,
25
- :validate_duration => nil,
24
+ :video_storage => '',
25
+ :video_path_generator => nil,
26
+ :validate_duration => nil,
27
+
26
28
  # thumbnailer
27
- :thumb_storage => nil,
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
@@ -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 < ArgumentError
11
+ class ConfigError < Error
8
12
  end
9
13
 
10
14
  # specified file does not exist
11
- class FileError < Errno::ENOENT
15
+ class FileError < Error
12
16
  end
13
17
 
14
18
  # invalid video format
15
- class FormatError < IOError
19
+ class FormatError < Error
16
20
  end
17
21
 
18
22
  # invalid video format
19
- class ProcessError < IOError
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
- storage = CONFIG[:"#{scope}_storage"]
82
- return instance_exec(file_name, &storage) if storage.is_a? Proc
83
- (!storage || storage.empty? ? CONFIG[:PWD] : storage).to_s.strip.gsub(%r#/$#, '')
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}_storage"] = block
100
+ CONFIG[:"#{scope}_path_generator"] = block
91
101
  else
92
- CONFIG[:thumb_storage] = CONFIG[:video_storage] = block
102
+ CONFIG[:thumb_path_generator] = CONFIG[:video_path_generator] = block
93
103
  end if block_given?
94
104
  end
95
105
 
@@ -42,7 +42,7 @@ module VTools
42
42
 
43
43
  params.join " "
44
44
  end
45
-
45
+
46
46
  # options parser
47
47
  def parse! options
48
48
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  # current version
4
4
  module VTools
5
- VERSION = [ 0, 0, 3 ]
5
+ VERSION = [ 0, 1, 0 ]
6
6
  end
@@ -3,7 +3,7 @@
3
3
  module VTools
4
4
 
5
5
  # Video instance
6
- class Video
6
+ class Video
7
7
 
8
8
  attr_reader :path, :name, :duration, :start, :bitrate,
9
9
  :video_stream, :video_codec, :video_bitrate, :colorspace, :frame_rate,
@@ -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
@@ -78,7 +78,7 @@ describe VTools::Converter do
78
78
 
79
79
  @converter.run
80
80
  end
81
-
81
+
82
82
  context "fails encoding" do
83
83
 
84
84
  it "--no time received" do
@@ -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 ArgumentError
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 Errno::ENOENT
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 IOError
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 IOError
44
+ expect { raise VTools::ProcessError }.to raise_error VTools::Error
37
45
  end
38
46
  end
39
47
  end
@@ -25,7 +25,7 @@ describe VTools::Handler do
25
25
  :action_one => [ block ], :action_two => [ other_block ]
26
26
  }
27
27
  end
28
-
28
+
29
29
  it "skips set when no block given" do
30
30
  @handler.set :action_one
31
31
  @handler.set :action_one
@@ -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({})
@@ -5,21 +5,21 @@ describe VTools::Options do
5
5
 
6
6
  # hooks
7
7
  before :all do
8
-
8
+
9
9
  end
10
10
 
11
11
  # around to test inside the methods
12
12
 
13
13
  before do
14
-
14
+
15
15
  end
16
16
 
17
17
  after do
18
-
18
+
19
19
  end
20
20
 
21
21
  after :all do
22
-
22
+
23
23
  end
24
24
 
25
25
  # specs
@@ -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] = prc
213
- @class.generate_path("test.filename", "video").should == "test/path"
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[:thumb_storage].should == block
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[:thumb_storage].should == block
234
- VTools::CONFIG[:video_storage].should be nil
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[:video_storage].should == block
240
- VTools::CONFIG[:thumb_storage].should be nil
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[:video_storage].should == block
246
- VTools::CONFIG[:thumb_storage].should == block
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[:video_storage].should be nil
252
- VTools::CONFIG[:thumb_storage].should be nil
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
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: binary -*-
2
-
2
+
3
3
  ["..", "../../lib", "../../lib/vtools"].each do |path|
4
4
  dir = File.expand_path(path, __FILE__)
5
5
  $:.unshift dir if dir and not $:.include?(dir)
@@ -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
@@ -66,7 +66,7 @@ describe VTools::Thumbnailer do
66
66
  end
67
67
 
68
68
  it "creates thumb with postfix and offset" do
69
-
69
+
70
70
  @options = {:thumb_count => 1, :thumb_start_point => 3, :postfix => "test.postfix"}
71
71
  prepare_thumbnailer
72
72
 
@@ -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]
@@ -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 = "Daemon tools to operate the video (get info, encode & generate thumbnails)."
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 >= 1.8', 'ffmpegthumbnailer v >= 2', 'gem Daemons v >= 1.1.4']
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 = "http://tofir.comuv.com"
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.3
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-11-24 00:00:00.000000000Z
12
+ date: 2011-12-13 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: daemons
16
- requirement: &79494300 !ruby/object:Gem::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: *79494300
24
+ version_requirements: *82591300
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
27
- requirement: &79494110 !ruby/object:Gem::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: *79494110
35
+ version_requirements: *82591110
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &79493880 !ruby/object:Gem::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: *79493880
47
- description: Daemon tools to operate the video (get info, encode & generate thumbnails).
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
- - Rakefile
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/converter.rb
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/handler.rb
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
- - INSTALL
73
- - spec/job_spec.rb
74
- - spec/convert_options_spec.rb
75
- - spec/fixtures/outputs/file_with_start_value.txt
76
- - spec/fixtures/outputs/file_with_surround_sound.txt
77
- - spec/fixtures/outputs/file_with_iso-8859-1.txt
78
- - spec/fixtures/outputs/file_with_no_audio.txt
79
- - spec/fixtures/outputs/file_with_non_supported_audio.txt
80
- - spec/config_spec.rb
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/handler_spec.rb
85
- - spec/converter_spec.rb
86
- - spec/video_spec.rb
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/shared_methods_spec.rb
91
- - spec/thumbs_options_spec.rb
92
- - doc/HOOKS.md
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 >= 1.8
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.10
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/job_spec.rb
128
- - spec/convert_options_spec.rb
129
- - spec/config_spec.rb
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/handler_spec.rb
134
- - spec/converter_spec.rb
135
- - spec/video_spec.rb
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/shared_methods_spec.rb
139
- - spec/thumbs_options_spec.rb
144
+ - spec/converter_spec.rb
Binary file