paperclip_mp3 0.1.0

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 ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZjhlNDllMmYxYWM4Yjk4OTgzM2VlYWZlZWYzZjc1NWM2YzY0ZWRhMg==
5
+ data.tar.gz: !binary |-
6
+ YWQwMTBiYTU4YmRlMTU1YzQxODhhMGYzMjIyNjUyNjBlOWU4MTdhNA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MjQ3N2YxNzE2NGU5OTg1NWE5YmU4Mjg2ZTk3NjQ1NDc2YTBmMGRmYmFlYjcw
10
+ OTY2ZTMzMmM3ZGY0OTY0YjljNDA5YzU2MmQ3YTMxY2ExMjliYjk4MTAzZWYz
11
+ YjU0MDlhOTVhNDRmZjhmNzc3Njk0MDZkMWMzZWQ0YzUzMmVkZTI=
12
+ data.tar.gz: !binary |-
13
+ YTU5NWY1ZDMyODZkNjJiYmViYTQxMWRjZjM2ZTdhZTc0MzEzMDg4MzhlYmRl
14
+ NDYwOGU4NTAxYTM5ZDNiZWYxZjRiMTE4NTdmYTk4NGFiZDU1YWE0ZGQ4NGMx
15
+ OGRiZDY2ZTgzZTYxNjg1MTgzOGFkNTE2MGNmYjMzZjBiOWZlNGE=
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.idea/.name ADDED
@@ -0,0 +1 @@
1
+ paperclip_mp3
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
4
+ </project>
5
+
data/.idea/misc.xml ADDED
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-1.9.3-p194" project-jdk-type="RUBY_SDK" />
4
+ </project>
5
+
data/.idea/modules.xml ADDED
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/paperclip_mp3.iml" filepath="$PROJECT_DIR$/.idea/paperclip_mp3.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
9
+
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="FacetManager">
4
+ <facet type="gem" name="Gem">
5
+ <configuration>
6
+ <option name="GEM_APP_ROOT_PATH" value="$MODULE_DIR$" />
7
+ <option name="GEM_APP_TEST_PATH" value="" />
8
+ <option name="GEM_APP_LIB_PATH" value="" />
9
+ </configuration>
10
+ </facet>
11
+ </component>
12
+ <component name="NewModuleRootManager">
13
+ <content url="file://$MODULE_DIR$" />
14
+ <orderEntry type="inheritedJdk" />
15
+ <orderEntry type="sourceFolder" forTests="false" />
16
+ <orderEntry type="library" scope="PROVIDED" name="activemodel (v3.2.13, RVM: ruby-1.9.3-p194) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="activerecord (v3.2.13, RVM: ruby-1.9.3-p194) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="activesupport (v3.2.13, RVM: ruby-1.9.3-p194) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="arel (v3.0.2, RVM: ruby-1.9.3-p194) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="builder (v3.0.4, RVM: ruby-1.9.3-p194) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v1.3.4, RVM: ruby-1.9.3-p194) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="climate_control (v0.0.3, RVM: ruby-1.9.3-p194) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="cocaine (v0.5.1, RVM: ruby-1.9.3-p194) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="i18n (v0.6.1, RVM: ruby-1.9.3-p194) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="mime-types (v1.21, RVM: ruby-1.9.3-p194) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="multi_json (v1.7.2, RVM: ruby-1.9.3-p194) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="paperclip (v3.4.1, RVM: ruby-1.9.3-p194) [gem]" level="application" />
28
+ <orderEntry type="library" scope="PROVIDED" name="rake (v10.0.4, RVM: ruby-1.9.3-p194) [gem]" level="application" />
29
+ <orderEntry type="library" scope="PROVIDED" name="tzinfo (v0.3.37, RVM: ruby-1.9.3-p194) [gem]" level="application" />
30
+ </component>
31
+ </module>
32
+
@@ -0,0 +1,5 @@
1
+ <component name="DependencyValidationManager">
2
+ <state>
3
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
4
+ </state>
5
+ </component>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
7
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in paperclip_mp3.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Yunfei
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # PaperclipMp3
2
+
3
+ Paperclip Mp3 is a Paperclip post-processor that convert to mp3 file of the audio attachment .
4
+
5
+ has_attached_file :sound,
6
+ styles: {
7
+ mp3: {
8
+ format: :mp3,
9
+ :convert_options => {:ar => '44100', :ac => '2', :ab => '192000'},
10
+ :processors => [:mp3]
11
+ }
12
+ }
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,3 @@
1
+ module PaperclipMp3
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,7 @@
1
+ require 'paperclip'
2
+ require 'paperclip_mp3/version'
3
+ require 'paperclip_processors/mp3'
4
+
5
+ module PaperclipMp3
6
+ # Your code goes here...
7
+ end
@@ -0,0 +1,25 @@
1
+ module Paperclip
2
+ class Mp3 < Processor
3
+ def initialize file, options = {}, attachment = nil
4
+ super
5
+
6
+ @basename = File.basename(file.path)
7
+ @mp3_opts = {:ar => '44100', :ac => '2', :ab => '128000'}
8
+ @mp3_opts = options[:convert_options]
9
+ end
10
+
11
+ def make
12
+ mp3 = Tempfile.new [@basename, '.mp3']
13
+ mp3.binmode
14
+
15
+ begin
16
+ Paperclip.run("ffmpeg", "-y -i :source -vn -acodec libmp3lame -ar :ar -ac :ac -ab :ab :dest", :source => "#{File.expand_path(file.path)}",
17
+ :ar => @mp3_opts[:ar], :ac => @mp3_opts[:ac], :ab => @mp3_opts[:ab], :dest => File.expand_path(mp3.path))
18
+ rescue Cocaine::ExitStatusError => e
19
+ raise Paperclip::Error, "error while processing mp3 for #{@basename}: #{e}"
20
+ end
21
+
22
+ mp3
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'paperclip_mp3/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "paperclip_mp3"
8
+ spec.version = PaperclipMp3::VERSION
9
+ spec.authors = ["Yunfei"]
10
+ spec.email = ["yunfei.1982@gmail.com"]
11
+ spec.description = "Paperclip Mp3 is a Paperclip post-processor that convert to mp3 file of the audio attachment."
12
+ spec.summary = "Paperclip post-processor that generates a mp3 from audio files."
13
+ spec.homepage = "https://github.com/yunfei1982/paperclip_mp3"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "paperclip"
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "rake"
24
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: paperclip_mp3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Yunfei
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-03-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: paperclip
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Paperclip Mp3 is a Paperclip post-processor that convert to mp3 file
56
+ of the audio attachment.
57
+ email:
58
+ - yunfei.1982@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - .idea/.name
65
+ - .idea/encodings.xml
66
+ - .idea/misc.xml
67
+ - .idea/modules.xml
68
+ - .idea/paperclip_mp3.iml
69
+ - .idea/scopes/scope_settings.xml
70
+ - .idea/vcs.xml
71
+ - Gemfile
72
+ - LICENSE.txt
73
+ - README.md
74
+ - Rakefile
75
+ - lib/paperclip_mp3.rb
76
+ - lib/paperclip_mp3/version.rb
77
+ - lib/paperclip_processors/mp3.rb
78
+ - paperclip_mp3.gemspec
79
+ homepage: https://github.com/yunfei1982/paperclip_mp3
80
+ licenses:
81
+ - MIT
82
+ metadata: {}
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 2.0.3
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: Paperclip post-processor that generates a mp3 from audio files.
103
+ test_files: []