paperclip_video_processor 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +21 -0
- data/README.md +24 -1
- data/lib/paperclip_video_processor.rb +1 -1
- data/lib/paperclip_video_processor/version.rb +1 -1
- metadata +3 -2
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
20
|
+
|
21
|
+
|
data/README.md
CHANGED
@@ -1,2 +1,25 @@
|
|
1
1
|
paperclip_video_processor
|
2
|
-
=========================
|
2
|
+
=========================
|
3
|
+
|
4
|
+
Installation
|
5
|
+
===========
|
6
|
+
|
7
|
+
Add this line to your Gemfile
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'paperclip_video_processor'
|
11
|
+
```
|
12
|
+
|
13
|
+
Configuration
|
14
|
+
=============
|
15
|
+
|
16
|
+
You will have to specify the processor explicitly by adding :paperclip_video_processor to your processors attribute. If you want to convert to different formats, you can make use of the styles attribute.
|
17
|
+
I will recommend you use dynamic configurations if you want to process image files. Here is an example.
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
has_attached_file :asset,
|
21
|
+
:processors => lambda { |upload| upload.processors },
|
22
|
+
:styles => lambda { |upload| upload.instance.video? ? { :flv => ['960x600', 'flv'], :mp4 => ['960x600', 'mp4'] } : { :small => "40x40", :med => "120x120" } }
|
23
|
+
```
|
24
|
+
|
25
|
+
Please feel free to shoot me an email (bzbnhang@gmail.com) if you occur any bug.
|
@@ -5,7 +5,6 @@ module Paperclip
|
|
5
5
|
def initialize(file, options = {}, attachment = nil)
|
6
6
|
super
|
7
7
|
# Set options
|
8
|
-
@aspect = options[:size].try(:gsub, /x/, ':') || '480:320'
|
9
8
|
@audio_bitrate = options[:audio_bitrate] || '64k'
|
10
9
|
@audio_codec = options[:audio_codec] || 'libfaac'
|
11
10
|
@bitrate = options[:bitrate] || '256k'
|
@@ -14,6 +13,7 @@ module Paperclip
|
|
14
13
|
@basename = File.basename(@file.path, @current_format)
|
15
14
|
@file = file
|
16
15
|
@size = options[:size] || '960x600'
|
16
|
+
@aspect = @size.gsub(/x/, ':')
|
17
17
|
@format = options[:format] || 'flv'
|
18
18
|
end
|
19
19
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paperclip_video_processor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
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: 2012-06-
|
12
|
+
date: 2012-06-19 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Video Converter
|
15
15
|
email:
|
@@ -20,6 +20,7 @@ extra_rdoc_files: []
|
|
20
20
|
files:
|
21
21
|
- .gitignore
|
22
22
|
- Gemfile
|
23
|
+
- LICENSE
|
23
24
|
- README.md
|
24
25
|
- Rakefile
|
25
26
|
- lib/paperclip_video_processor.rb
|