wav-mp3 0.0.1
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.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +2 -0
- data/lib/wav-mp3/version.rb +7 -0
- data/lib/wav-mp3.rb +32 -0
- data/wav-mp3.gemspec +22 -0
- metadata +102 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/lib/wav-mp3.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require "paperclip"
|
2
|
+
module Paperclip
|
3
|
+
class WavMp3 < Processor
|
4
|
+
|
5
|
+
attr_accessor :file, :params, :format
|
6
|
+
|
7
|
+
def initialize file, options = {}, attachment = nil
|
8
|
+
super
|
9
|
+
@file = file
|
10
|
+
@params = options[:params]
|
11
|
+
@current_format = File.extname(@file.path)
|
12
|
+
@basename = File.basename(@file.path, @current_format)
|
13
|
+
@format = options[:format]
|
14
|
+
end
|
15
|
+
|
16
|
+
def make
|
17
|
+
src = @file
|
18
|
+
dst = Tempfile.new([@basename, @format ? ".#{@format}" : ''])
|
19
|
+
begin
|
20
|
+
parameters = []
|
21
|
+
parameters << @params
|
22
|
+
parameters << ":source"
|
23
|
+
parameters << ":dest"
|
24
|
+
parameters = parameters.flatten.compact.join(" ").strip.squeeze(" ")
|
25
|
+
success = Paperclip.run("lame", parameters, :source => "#{File.expand_path(src.path)}",:dest => File.expand_path(dst.path))
|
26
|
+
rescue PaperclipCommandLineError => e
|
27
|
+
raise PaperclipError, "There was an error converting #{@basename} to mp3"
|
28
|
+
end
|
29
|
+
dst
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/wav-mp3.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "wav-mp3/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "wav-mp3"
|
7
|
+
s.version = WavMp3::Paperclip::Processor::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["moonFlash, Mojmir Novakovic"]
|
10
|
+
s.email = ["moonflash.as3@gmail.com"]
|
11
|
+
s.homepage = "https://github.com/moonflash"
|
12
|
+
s.summary = %q{Wav to MP3 paperclip-processor}
|
13
|
+
s.description = %q{Easy Wav to MP3 conversion using lame}
|
14
|
+
|
15
|
+
s.rubyforge_project = "wav-mp3"
|
16
|
+
s.add_dependency "rails", "~> 3.0"
|
17
|
+
s.add_dependency "paperclip", "~> 2.3"
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wav-mp3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- moonFlash, Mojmir Novakovic
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-05-04 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rails
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 7
|
30
|
+
segments:
|
31
|
+
- 3
|
32
|
+
- 0
|
33
|
+
version: "3.0"
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: paperclip
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 5
|
45
|
+
segments:
|
46
|
+
- 2
|
47
|
+
- 3
|
48
|
+
version: "2.3"
|
49
|
+
type: :runtime
|
50
|
+
version_requirements: *id002
|
51
|
+
description: Easy Wav to MP3 conversion using lame
|
52
|
+
email:
|
53
|
+
- moonflash.as3@gmail.com
|
54
|
+
executables: []
|
55
|
+
|
56
|
+
extensions: []
|
57
|
+
|
58
|
+
extra_rdoc_files: []
|
59
|
+
|
60
|
+
files:
|
61
|
+
- .gitignore
|
62
|
+
- Gemfile
|
63
|
+
- Rakefile
|
64
|
+
- lib/wav-mp3.rb
|
65
|
+
- lib/wav-mp3/version.rb
|
66
|
+
- wav-mp3.gemspec
|
67
|
+
has_rdoc: true
|
68
|
+
homepage: https://github.com/moonflash
|
69
|
+
licenses: []
|
70
|
+
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
hash: 3
|
82
|
+
segments:
|
83
|
+
- 0
|
84
|
+
version: "0"
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
hash: 3
|
91
|
+
segments:
|
92
|
+
- 0
|
93
|
+
version: "0"
|
94
|
+
requirements: []
|
95
|
+
|
96
|
+
rubyforge_project: wav-mp3
|
97
|
+
rubygems_version: 1.4.2
|
98
|
+
signing_key:
|
99
|
+
specification_version: 3
|
100
|
+
summary: Wav to MP3 paperclip-processor
|
101
|
+
test_files: []
|
102
|
+
|