paperclip-av-transcoder 0.6.3 → 0.6.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea21b7a277ffa9f666d26ed95b469a6ee4afa7b4
4
- data.tar.gz: e6c81e05cbecb7f258bcc02e8cafdddedfdb35e0
3
+ metadata.gz: a074944a6e3e188a5d8a9c07d37a2376f1100293
4
+ data.tar.gz: 910ff46af4e3d15c37dc79f489c030806725d3ef
5
5
  SHA512:
6
- metadata.gz: e4f800b29571e09eebaf76bb888a6b56cdb6b3baf1d41f35db19bcb99061221f9a32dfc5dc8a80f9da21f34534c3d4e452150a668ef54718cf4bb6ce18dbb28f
7
- data.tar.gz: 8b960fcca8db70c7436ea4d724bb188754979473cf6bcfd3e3495acbc5ded65ab412d8f0ae25df503a3cefccbc07d22e95d09e34905a4db8af757f17c4168367
6
+ metadata.gz: c1855588506b42660888569df9732e955054c46cd199ff73029c6818c8a22e5c3984a30afa2ee901af4167d62160216158fa3bdaddc21a9b332d644eea74592d
7
+ data.tar.gz: db07821e78d7f901df5b08a4ce546bc810c1ba9c784bd0988d5c5cd6ab1d39e7f78ffc94354531f00087cccf1815bc0fd10e1cf6edb3cf6f093b90016dffa2e9
data/README.md CHANGED
@@ -10,6 +10,7 @@ This is a replacement for ( https://github.com/owahab/paperclip-ffmpeg ).
10
10
  [![Coverage Status](https://coveralls.io/repos/ruby-av/paperclip-av-transcoder/badge.png?branch=master)](https://coveralls.io/r/ruby-av/paperclip-av-transcoder?branch=master)
11
11
  [![Code Climate](https://codeclimate.com/github/ruby-av/paperclip-av-transcoder/badges/gpa.svg)](https://codeclimate.com/github/ruby-av/paperclip-av-transcoder)
12
12
  [![Dependency Status](https://gemnasium.com/ruby-av/paperclip-av-transcoder.svg)](https://gemnasium.com/ruby-av/paperclip-av-transcoder)
13
+ [![Gem Version](https://badge.fury.io/rb/paperclip-av-transcoder.svg)](http://badge.fury.io/rb/paperclip-av-transcoder)
13
14
 
14
15
  ## Installation
15
16
 
@@ -1,7 +1,7 @@
1
1
  module Paperclip
2
2
  module Av
3
3
  module Transcoder
4
- VERSION = "0.6.3"
4
+ VERSION = "0.6.4"
5
5
  end
6
6
  end
7
7
  end
@@ -34,7 +34,7 @@ module Paperclip
34
34
  @auto_rotate = options[:auto_rotate].nil? ? false : options[:auto_rotate]
35
35
  @pad_color = options[:pad_color].nil? ? "black" : options[:pad_color]
36
36
 
37
- @convert_options[:output][:s] = format_geometry(@geometry) if @gemotry.present?
37
+ @convert_options[:output][:s] = format_geometry(@geometry) if @geometry.present?
38
38
 
39
39
  attachment.instance_write(:meta, @meta) if attachment
40
40
  end
@@ -52,6 +52,12 @@ module Paperclip
52
52
  @cli.add_source(@file.path)
53
53
  @cli.add_destination(dst.path)
54
54
  @cli.reset_input_filters
55
+
56
+ if output_is_image?
57
+ @time = @time.call(@meta, @options) if @time.respond_to?(:call)
58
+ @cli.filter_seek @time
59
+ end
60
+
55
61
  if @convert_options.present?
56
62
  if @convert_options[:input]
57
63
  @convert_options[:input].each do |h|
@@ -94,6 +100,10 @@ module Paperclip
94
100
  return unless geometry.present?
95
101
  return geometry.gsub(/[#!<>)]/, '')
96
102
  end
103
+
104
+ def output_is_image?
105
+ !!@format.to_s.match(/jpe?g|png|gif$/)
106
+ end
97
107
  end
98
108
 
99
109
  class Attachment
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "rails", ">= 4.0.0"
25
25
  spec.add_development_dependency "sqlite3"
26
26
  spec.add_development_dependency "coveralls"
27
-
27
+
28
28
  spec.add_dependency "paperclip", ">=2.5.2"
29
- spec.add_dependency "av", "~> 0.8.1"
29
+ spec.add_dependency "av", "~> 0.9.0"
30
30
  end
@@ -41,6 +41,10 @@ class Document < ActiveRecord::Base
41
41
  ac: 2
42
42
  }
43
43
  }
44
+ },
45
+ thumb: {
46
+ format: 'jpg',
47
+ time: 0
44
48
  }
45
49
  },
46
50
  processors: [:transcoder]
@@ -53,8 +57,8 @@ class Document < ActiveRecord::Base
53
57
  styles: {
54
58
  small: "100x100"
55
59
  },
56
- processors: [:transcoder, :thumbnail]
57
-
60
+ processors: [:transcoder, :thumbnail]
61
+
58
62
  do_not_validate_attachment_file_type :video
59
63
  do_not_validate_attachment_file_type :image
60
64
  end
@@ -3,18 +3,19 @@ require 'spec_helper'
3
3
  describe Paperclip::Transcoder do
4
4
  let(:supported) { File.new(Dir.pwd + '/spec/support/assets/sample.mp4') }
5
5
  let(:unsupported) { File.new(File.expand_path('spec/support/assets/image.png')) }
6
-
6
+
7
7
  let(:destination) { Pathname.new("#{Dir.tmpdir}/transcoder/") }
8
-
8
+
9
9
  describe "supported formats" do
10
10
  let(:subject) { Paperclip::Transcoder.new(supported) }
11
11
  let(:document) { Document.create(video: Rack::Test::UploadedFile.new(supported, 'video/mp4')) }
12
-
12
+
13
13
  describe ".transcode" do
14
14
  it { expect(File.exists?(document.video.path(:small))).to eq true }
15
+ it { expect(File.exists?(document.video.path(:thumb))).to eq true }
15
16
  end
16
17
  end
17
-
18
+
18
19
  describe "unsupported formats" do
19
20
  let(:subject) { Paperclip::Transcoder.new(unsupported) }
20
21
  let(:document) { Document.create(image: Rack::Test::UploadedFile.new(unsupported, 'image/png')) }
@@ -22,5 +23,5 @@ describe Paperclip::Transcoder do
22
23
  it { expect(File.exists?(document.image.path(:small))).to eq true }
23
24
  end
24
25
  end
25
-
26
+
26
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip-av-transcoder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Omar Abdel-Wahab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-11 00:00:00.000000000 Z
11
+ date: 2015-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - ~>
116
116
  - !ruby/object:Gem::Version
117
- version: 0.8.1
117
+ version: 0.9.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ~>
123
123
  - !ruby/object:Gem::Version
124
- version: 0.8.1
124
+ version: 0.9.0
125
125
  description: Audio/Video Transcoder for Paperclip using FFMPEG/Avconv
126
126
  email:
127
127
  - owahab@gmail.com