paperclip-wav-mp3 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +4 -0
- data/lib/paperclip-wav-mp3.rb +34 -0
- data/paperclip-wav-mp3.gemspec +17 -0
- metadata +61 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b6809f83bc3f0d4ec6054ef15838e69fdb86edce
|
4
|
+
data.tar.gz: d9950d2afe8d89a90bd2323e841fa2e9e5b53146
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c6c6acf2fe581e39ad80386a5b67b9ec9fe4c01a9a5459166df41c113ee95b6819330554a7666faea00a9803399a1b9d6d17d200e7f8debd34f5285c0eceb8e1
|
7
|
+
data.tar.gz: 158fbe2bdbb5db5954167c357c6aa34d6a6fc7dd4700a2f1f00c924a6fb6b1e4b4272b525077333dd3dd1daf9a69fc71b8f9f100d4afb612681d3d736a321a2e
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Jon Pascoe
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'paperclip'
|
2
|
+
|
3
|
+
module Paperclip
|
4
|
+
class FfmpegWav2Mp3 < Processor
|
5
|
+
|
6
|
+
attr_accessor :file, :params, :format
|
7
|
+
|
8
|
+
def initialize(file, options = {}, attachment = nil)
|
9
|
+
super
|
10
|
+
@file = file
|
11
|
+
@params = options[:params]
|
12
|
+
@current_format = File.extname(@file.path)
|
13
|
+
@basename = File.basename(@file.path, @current_format)
|
14
|
+
@format = options[:format]
|
15
|
+
end
|
16
|
+
|
17
|
+
def make
|
18
|
+
src = @file
|
19
|
+
dst = Tempfile.new([@basename, @format ? ".#{@format}" : '' ])
|
20
|
+
|
21
|
+
begin
|
22
|
+
parameters = []
|
23
|
+
parameters << @params
|
24
|
+
parameters << ":source"
|
25
|
+
parameters << ":dest"
|
26
|
+
parameters = parameters.flatten.compact.join(' ').strip.squeeze(' ')
|
27
|
+
success = Paperclip.run('ffmpeg', parameters, :source => File.expand_path(src.path), :dest => File.expand_path(dst.path))
|
28
|
+
rescue PaperclipCommandLineError => e
|
29
|
+
raise PaperclipError, "There was an error converting #{@basename} to mp3"
|
30
|
+
end
|
31
|
+
dst
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'paperclip-wav-mp3'
|
3
|
+
s.version = '0.0.0'
|
4
|
+
s.authors = ['Jon Pascoe']
|
5
|
+
s.email = 'jon.pascoe@me.com'
|
6
|
+
s.homepage = 'https://github.com/pacso/paperclip-wav-mp3'
|
7
|
+
s.summary = 'Paperclip WAV to MP3 Processor'
|
8
|
+
s.description = 'Paperclip processor to convert WAV format audio to MP3 using ffmpeg'
|
9
|
+
|
10
|
+
s.add_dependency "paperclip", "~> 2.3"
|
11
|
+
s.files = `git ls-files`.split("\n")
|
12
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
13
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
14
|
+
s.require_paths = ["lib"]
|
15
|
+
|
16
|
+
s.license = 'MIT'
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: paperclip-wav-mp3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jon Pascoe
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-19 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: '2.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.3'
|
27
|
+
description: Paperclip processor to convert WAV format audio to MP3 using ffmpeg
|
28
|
+
email: jon.pascoe@me.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- LICENSE
|
34
|
+
- README.md
|
35
|
+
- lib/paperclip-wav-mp3.rb
|
36
|
+
- paperclip-wav-mp3.gemspec
|
37
|
+
homepage: https://github.com/pacso/paperclip-wav-mp3
|
38
|
+
licenses:
|
39
|
+
- MIT
|
40
|
+
metadata: {}
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
requirements: []
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 2.2.0
|
58
|
+
signing_key:
|
59
|
+
specification_version: 4
|
60
|
+
summary: Paperclip WAV to MP3 Processor
|
61
|
+
test_files: []
|