carrierwave-video 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -65,6 +65,9 @@ Logging:
65
65
  progress: :method # method that accepts a value of progress e.g. 0.2 (20%)
66
66
  # from https://github.com/streamio/streamio-ffmpeg#transcoding
67
67
 
68
+ progress can take 1 or 3 arguments. With three arguments, it receives format, format_options, and the value of progress.
69
+ e.g. `def progress(format, format_options, progress)` would receive something like `progress(:mp4, {}, 0.2)`
70
+
68
71
  Custom:
69
72
  streamio-ffmpeg accepts custom params. You may pass these in but keep in mind the watermarking params will be appended if there were any.
70
73
  custom: '-b 1500k'
@@ -1,5 +1,5 @@
1
1
  module Carrierwave
2
2
  module Video
3
- VERSION = "0.5.3"
3
+ VERSION = "0.5.4"
4
4
  end
5
5
  end
@@ -24,7 +24,10 @@ module CarrierWave
24
24
  end
25
25
 
26
26
  def progress(model)
27
- lambda {|val| model.send(@progress, val)} if @progress
27
+ if @progress
28
+ args = model.method(@progress).arity == 3 ? [@format, @format_options] : []
29
+ lambda { |val| model.send(@progress, *(args + [val])) }
30
+ end
28
31
  end
29
32
 
30
33
  def encoder_options
@@ -155,11 +155,20 @@ describe CarrierWave::Video do
155
155
  File.should_receive(:rename)
156
156
  movie.stub(:transcode).and_yield(0.0).and_yield(1.0)
157
157
  end
158
+ let(:opts) { {progress: :progress} }
159
+
158
160
  it "logs progress" do
159
161
  converter.model.should_receive(:progress).with(0.0)
160
162
  converter.model.should_receive(:progress).with(1.0)
161
163
  converter.encode_video(format, progress: :progress)
162
164
  end
165
+
166
+ it "logs progress with format and options" do
167
+ converter.model.stub_chain(:method, :arity).and_return(3)
168
+ converter.model.should_receive(:progress).with(format, hash_including(opts), 0.0)
169
+ converter.model.should_receive(:progress).with(format, hash_including(opts), 1.0)
170
+ converter.encode_video(format, opts)
171
+ end
163
172
  end
164
173
 
165
174
  context "with watermark set" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave-video
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-02 00:00:00.000000000 Z
12
+ date: 2013-11-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -111,7 +111,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
111
  version: '0'
112
112
  segments:
113
113
  - 0
114
- hash: 3465872708842603125
114
+ hash: -2491521969780735956
115
115
  required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  segments:
122
122
  - 0
123
- hash: 3465872708842603125
123
+ hash: -2491521969780735956
124
124
  requirements:
125
125
  - ruby, version 1.9 or greater
126
126
  - ffmpeg, version 0.11.1 or greater with libx256, libfaac, libtheora, libvorbid, libvpx