video_to_mp3 0.0.1 → 0.0.2
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/LICENSE +26 -0
- data/README.md +38 -0
- data/errors/video_to_mp3_error.rb +3 -0
- data/lib/video_to_mp3.rb +39 -0
- data/video_to_mp3.gemspec +30 -0
- metadata +9 -4
data/LICENSE
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
LICENSE
|
3
|
+
|
4
|
+
The MIT License
|
5
|
+
|
6
|
+
Copyright (c) 2008 Jon Yurek and thoughtbot, inc.
|
7
|
+
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
10
|
+
in the Software without restriction, including without limitation the rights
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
13
|
+
furnished to do so, subject to the following conditions:
|
14
|
+
|
15
|
+
The above copyright notice and this permission notice shall be included in
|
16
|
+
all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
THE SOFTWARE.
|
25
|
+
|
26
|
+
|
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
Video to mp3
|
2
|
+
=========
|
3
|
+
|
4
|
+
This is a video to mp3 convertor. iT converts your video files into mp3
|
5
|
+
|
6
|
+
Requirements
|
7
|
+
------------
|
8
|
+
|
9
|
+
ffmpeg must be installed on your system. For information on how to install ffmpeg please
|
10
|
+
check http://ffmpeg.org/download.html
|
11
|
+
|
12
|
+
Installation
|
13
|
+
------------
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem "video_to_mp3", "~> 0.0.1"
|
17
|
+
```
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
Quick Start
|
22
|
+
-----------
|
23
|
+
|
24
|
+
In your code
|
25
|
+
|
26
|
+
VideoToMp3.new.connvert_to_mp3("\path\to\video\file", "outputfile_name", "\destination\path")
|
27
|
+
|
28
|
+
if you do not prove the output filename and destination path then inputfile name is set as
|
29
|
+
outfile name and mp3_files directory get created if you donot provide the destination path
|
30
|
+
|
31
|
+
you can find the converted file at destination\path\outputfile_name.mp3
|
32
|
+
|
33
|
+
|
34
|
+
License
|
35
|
+
-------
|
36
|
+
|
37
|
+
video_to_mp3 is free software, and may be
|
38
|
+
redistributed under the terms specified in the MIT-LICENSE file.
|
data/lib/video_to_mp3.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require "../errors/video_to_mp3_error"
|
2
|
+
|
3
|
+
class VideoToMp3
|
4
|
+
|
5
|
+
#method to convert thhe video file to mp3
|
6
|
+
def connvert_to_mp3(input_filename, output_filename = nil, destination_path = "")
|
7
|
+
raise VideoToMp3Error, "No input file supplied" if input_filename.nil? or input_filename.empty?
|
8
|
+
|
9
|
+
#set the output filename sames as input filename if it is not supplied
|
10
|
+
output_filename = input_filename.split("/")[-1] if output_filename.nil? or input_filename.empty?
|
11
|
+
ffmpeg = `which ffmpeg`
|
12
|
+
|
13
|
+
raise VideoToMp3Error, "Please install ffmpeg on your system. \n
|
14
|
+
Chackout the installation guide at http://ffmpeg.org/download.html
|
15
|
+
" if ffmpeg.nil? or ffmpeg.empty?
|
16
|
+
|
17
|
+
if destination_path.nil? or destination_path.empty?
|
18
|
+
#create the mp3_files directory
|
19
|
+
default_path = "mp3_files"
|
20
|
+
system("mkdir #{default_path}")
|
21
|
+
destination_path = default_path
|
22
|
+
end
|
23
|
+
|
24
|
+
path = "#{destination_path}/#{output_filename}.mp3"
|
25
|
+
ffmpeg_command = "#{ffmpeg} -i #{input_filename} -q 1 #{path}"
|
26
|
+
|
27
|
+
#system method runs the command and return the true or false
|
28
|
+
command_status = system(ffmpeg_command)
|
29
|
+
|
30
|
+
if command_status == true
|
31
|
+
return path
|
32
|
+
else
|
33
|
+
system("rm -rf #{default_path}")
|
34
|
+
raise VideoToMp3Error, "Wrong file name or check the ffmpeg installation on your system"
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "video_to_mp3"
|
5
|
+
s.version = "0.0.2"
|
6
|
+
s.platform = Gem::Platform::RUBY
|
7
|
+
s.author = "Naveen Agarwal"
|
8
|
+
s.email = ["naveenagarwal287@gmail.com"]
|
9
|
+
s.homepage = "https://github.com/naveenagarwal/video_to_mp3.git"
|
10
|
+
s.summary = "Converts the video files into mp3 using ffmpeg"
|
11
|
+
s.description = "audio/video media convertor"
|
12
|
+
|
13
|
+
s.require_paths = ["lib"]
|
14
|
+
|
15
|
+
if File.exists?('UPGRADING')
|
16
|
+
s.post_install_message = File.read("UPGRADING")
|
17
|
+
end
|
18
|
+
|
19
|
+
s.requirements << "ffmpeg"
|
20
|
+
s.required_ruby_version = ">= 1.9.2"
|
21
|
+
|
22
|
+
s.files = [
|
23
|
+
"lib/video_to_mp3.rb",
|
24
|
+
"errors/video_to_mp3_error.rb",
|
25
|
+
"LICENSE",
|
26
|
+
"README.md",
|
27
|
+
"video_to_mp3.gemspec"
|
28
|
+
]
|
29
|
+
|
30
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: video_to_mp3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -17,7 +17,12 @@ email:
|
|
17
17
|
executables: []
|
18
18
|
extensions: []
|
19
19
|
extra_rdoc_files: []
|
20
|
-
files:
|
20
|
+
files:
|
21
|
+
- lib/video_to_mp3.rb
|
22
|
+
- errors/video_to_mp3_error.rb
|
23
|
+
- LICENSE
|
24
|
+
- README.md
|
25
|
+
- video_to_mp3.gemspec
|
21
26
|
homepage: https://github.com/naveenagarwal/video_to_mp3.git
|
22
27
|
licenses: []
|
23
28
|
post_install_message:
|
@@ -29,7 +34,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
31
36
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.
|
37
|
+
version: 1.9.2
|
33
38
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
39
|
none: false
|
35
40
|
requirements:
|
@@ -38,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
38
43
|
version: '0'
|
39
44
|
requirements:
|
40
45
|
- ffmpeg
|
41
|
-
rubyforge_project:
|
46
|
+
rubyforge_project:
|
42
47
|
rubygems_version: 1.8.24
|
43
48
|
signing_key:
|
44
49
|
specification_version: 3
|